Montreal Tech Watch





TOPICS:
STARTUPS
ENTREPRENEURSHIP
WEB2.0
EVENTS
MOBILE
VIDEO GAMES
JOBS
HACKING

Archive for August 13th, 2007

Ruby Rocks! — à la Francois Lamontagne (4)

Monday, August 13th, 2007 · by Heri · hacking

This is a guest post from François Lamontagne, a Ruby web developer, or shall I say, a Ruby guru from Trois-Rivieres. There are some personal info about him in the first part, but the real deal is in the second part where he writes what are Ruby’s strengths

ruby

Hello Montreal Tech Watch readers!

Heri got in touch with me a few days ago and asked me if I would be interested to write an article on Montreal Tech Watch. I accepted right away!

Now I guess you wonder : Who’s that guy?

My name is François Lamontagne and I’m a 26 years old web developer living in Trois-Rivières. About 1 year ago, I came across a programming language that litteraly changed the way I look at programming in general : this language is ruby. If you’re a programmer, chances are you already heared about this language since it is the one behind the increasingly popular web framework : Ruby On Rails. I then realized something funny concerning ruby and ruby on rails : everyone seem to talk about it… but only a small percentage of people seem to use it… for real. In this article, my goal is to talk about the main advantages of ruby and why you should seriously consider using this language if you are a programmer. I will “try” not being too technical since I am aware that not every readers here are developers.

Ruby is not Rails

The first mistake people are doing is to confuse Ruby with Rails. Ruby is a high-level, general purpose programming language written in C (well, at least the official interpreter is written in C). It is a language interpreted, meaning that the instructions are parsed and executed at runtime. Most of the time, interpreted languages are slower but more flexible than compiled languages.

Rails is a web framework that was created to help developers build web applications easily and rapidly. To achieve this, a software architecture called MVC that existed long ago was crafted and inserted inside the framework to become its fondations. MVC stands for Model – View – Controller. It is a pattern (a way to develop an application) that force the developer to put his code into some predefined areas. The folks who created Rails decided to write the code of their framework in ruby… that’s why the framework is called Ruby On Rails. Someone could very well decide to rewrite the entire framework in PHP and call it PHP On Rails.

My blog : Ruby Fleebie

Ruby is one of these “new genre” programming languages that has a lot less constraints than other more traditional languages. I was so amazed by the beauty of the ruby syntax and by all of its possibilities that I decided to start my own blog (named Ruby Fleebie) in March 2007. Inside the blog, readers can expect informative and tutorial-like articles concerning the language concepts. I am learning Ruby everyday and the more I learn about it, the more I like it. I also learn a lot from the comments left by some very knowledgeable readers. Heck, I may be the one who write the articles, but it doesn’t mean I know more than everyone :)

I am pretty satisfied with the people reaction so far. There are about 650 readers subscribed to the RSS feed… not bad at all! Ruby Fleebie was also the main subject of an interview I gave to Peter Cooper, the maintainer of the reknown ruby blog : Ruby Inside. You can read the Interview here if you want. I hope I will enjoy maintaining Ruby Fleebie for a long time to come!

Why ruby rocks

Here is my personal reasons explaining why Ruby should not be missed by anyone :

#1 : Very expressive and readable syntax


3.times {puts "Ho! "} if person_speaking == :santa_claus

If you have some really basic experience in programming, chances are you understood the above instruction the first time you read it. Look how short this instruction is and how readable it remains. Note how there is no “looping construct” to write “Ho! ” 3 times. Instead, you just have to use a Ruby key concept called “code blocks” (have a look at this post if you want to know more about code blocks). Secondly, do you see where is the conditional operation? Yep! at the end of the instruction… and on the same line! Now read the instruction aloud and realize how readable it is. With some aesthetic changes, what you read is in fact : 3 times, puts ” Ho!” on the screen if the person speaking is Santa Claus. In another language, the above code could have look like this :


if (person_speaking == "santa claus") {
for (i=0; i<3;i++) {
print ("Ho! ");
}
}

Hmm… That certainly does the job, but I still prefer the Ruby way… not you?

#2 : Object oriented to the extreme

Unlike many other languages, we cannot just say that Ruby “is composed of” object oriented components. In Ruby, almost every single thing is an object. If you want to know more about that feature, I suggest that you read the following posts : 3 steps to understand how classes and objects work in ruby, Diving into ruby object model : Part 1, Diving into ruby object model : Part 2

#3 : Dynamic and open

In Ruby, a class is never “closed”. The developer can always reopen an already defined class to add a new method or a new attribute. Some “hardcore” developers don’t like that facet of Ruby because they feel it isn’t safe enough. What? That developer I don’t really trust can decide to reopen my class and remove/change my methods at runtime? That’s totally unacceptable! Well, that’s the price to pay for all the flexibility you have with Ruby. Ruby never tries to protect you from yourself nor does it tries to protect your code from other developers.

#4 : The “Ruby way”

Whatever the problem you are trying to solve, it seems that you can always do it “the ruby way”. You will know you did something “the ruby way” when you do it… it will smell ruby and feel ruby. Don’t worry however, doing something “the ruby way” absolutely doesn’t mean that there is only one single way to achieve something! You always have tons of possibilities… it’s just that some feel more ruby than others. I have started a new collection of posts on my blog that I called ” Rubyize this”. Readers have to change a (poorly written) code snippet into short and readable ruby. That is kind of fun actually.

There are tons of other reasons to try Ruby, but these 4 are the most important to me.

TimmyOnTime

I also want to talk about a project that I developed with Dan Simard, a web developer from Trois-Rivieres as well as a good friend of mine. The project is called TimmyOnTime. It is a time tracking tool based on instant messaging (Jabber, MSN or AIM). You write commands like “create project new website”, “start task build mockups”, etc and Timmy (the bot) will do the rest! We are extremely proud of what we’ve done. We have that amazing feeling of being the first to have done this kind of application. If you are curious and want to try it out, go here to get you started! I must warn you however that we are currently working on some stability issues with our robot… everything will return to the normal in the near future.

timmy  on time

90% of TimmyOnTime has been developed with Ruby On Rails, the other 10% (the bot) was written in plain Ruby. TimmyOnTime is another proof that Ruby and Rails are not only buzz words, these are efficient technologies that work for real.

Thanks for your time and I hope to see you on Ruby Fleebie!

if you are interested in programming languages, you might also check out the article about Scheme/Lisp, featured one month ago on Montreal Tech Watch

Found

  • According to a report by the Milken Institute, the Canadian high-tech sector has grown faster than anywhere else in North America. The report compares metropolitan data between 2003 and 2007 (the latest available) and includes data from Canada and Mexico for the first time. Toronto is the highest ranked city in Canada at 15 (up from 25), Montreal comes in at 19 (up from 27). Vancouver and Otta
  • New updates at TechEntreprise: new homepage, with the colorful TE logo tagline changed to "Network for Tech Entreprneneurs, Designers and Hackers" focus on members and people Projects&Startups now has a city when submitting, it plays better with geolocation this way Forum (aka Q&A section) has now commentable answers. So instead of answering a question, you can commenting on an ans
  • IT Development in Quebec (How to Save Money with Tax Subsidies) - VIDEO PRESENTATION BY KOVASYS INC. (IT RECRUITMENT AGENCY IN MONTREAL) TEAM
  • Heading Teralys is Jacques Bernier, a serial technology entrepreneur, executive and investor in many technology companies. Jacques Bernier was approached by FTQ’s president back in early 2004 — he found the offer interesting but still had his heart in building technology companies. Moreover, at that time, the FTQ was interested in having a tech fund, but Jacques Bernier thought there wa
  • Montreal-based IT recruitment agency Kovasys Inc. receives frequent phone calls from U.S.-based IT companies looking to expand operations in the city, and acquire local IT talent. It's a surge in interest the director of operations Alex Kovalenko credits to employee salary subsidies for high-tech companies, introduced by the Government of Quebec last year. While tax credits for R&D are st
  • $5 billion to end up in the hands of Canadian entrepreneurs, as a result of Québec’s support of Venture Capital initiatives nothing less! Now that the dust is starting to settle down around the recent Québec government budget announcements, the high tech community is wondering what concrete actions will come out of what is believed to be the most important “commitments&
  •  Design, Build, and Launch in one weekend Blitzweekend is an unique experience where designers, developers, and entrepreneurs are challenged to create a working product in 48 hours, beginning Friday 29th February at 5pm in 1111 rue St-Charles, Montreal, Canada. Find a solution to a current problem, meet and innovate with bright creatives, work in an environment built for rapid development, an
  • It feels good to hear more about these type of initiatives. In addition to the $825M fund of fund and the $500M later stage fund initiatives, announced earlier this week by the Quebec government (read more here) Quebec will be put in place 3 new seed funds for an additional aggregate amount of $125M… or more. Managers of these funds are still to be confirmed, via a committee put in place b
  •  Beyond the Rack is a private shopping club for men and women who want designer brands at prices up to 70% off retail. We work with major brands to hold limited-time sales that are open exclusively to our members. Each sale starts at a specific time (usually noon) and typically lasts only 48 hours. After the sales ends the merchandise is no longer available. Members are notified by email in ad
  • Dans le cadre de Capital Innovation 2009, nous avons le plaisir de vous inviter mercredi le 25 mars 2009 au dîner-conférence de Guy Kawasaki, fondateur et PDG de Garage Technology Ventures. M. Kawasaki présentera son expérience en tant que “Apple Fellow” chez Apple Computer, Inc. comme modèle de stratégie d’innovation pour les entrepri

Feedback

Archives

Events

  • Sat Jul 11 9:30 AM - Sun Jul 12 5:00 PM: WordCamp Montréal 2009 (1195 St-Laurent boulevard, Montreal)
  • Thu Sep 10 7:15 AM - 4:00 PM: eConcordia Summit 2009 (7141 rue Sherbrooke Ouest, Montreal)

  • Register and see upcoming events at TechEntreprise

    Canada

    Montreal

    Technology



    Flickr

    DSCF3033DSCF3031DSCF3028DSCF3025StartupDrinks AprilStartupDrinks AprilStartupDrinks AprilStartupDrinks AprilStartupDrinks AprilStartupDrinks April

    MTW is brought to you by:

    Montreal Tech Watch is also

    See the Montreal Technology community at TechEntreprise

    Follow MTW's activity with the twitter feed



    © 2007 Montreal Tech Watch
    Photographs taken by MTW are under Creative Commons. Attribution-NonCommercial-ShareAlike 2.0
    Screenshots, logos, videos, and trademarks showcased on Montreal Tech Watch are the property of their respective owners.