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

  • The 10 or 20 seconds it takes to read a resume seems to always generate a lot of controversy. Candidates comment on how disrespectful it is, how one can’t possibly read a resume in that time and some get angry at recruiters when we talk about this. I hope this article will help everyone understand how we do this. I realize that some still may not like it and will still be angry, but at least
  • A Canadian IT recruitment agency has reported a large number of overseas specialists relocating from America to Canada. An IT recruitment firm has reported it has seen an increase in overseas professions migrating from America to Canada.  Kovasys Inc, based in Montreal, cited the reason behind the increasing attractiveness of Canada for IT professions being the reduction of the ann
  • Hello/Bonjour,An English message will follow:====[Français]====Nous sommes heureux de dévoiler le programme de la conférence ConFoo.Avec plus de 130 présentations réparties dans 8 salles, ConFoo vous apporte le meilleur du développement Web. Prenez note que le tarif depré-vente prend fin le 22 janvier.Nous sommes fiers d'accueillir plus de 100 sp&eac
  • Montreal is Silicon Glacier
  • On Wednesday, a mere hour or so after the end of Day 1 of TechDays Montreal, came Career Demo Camp Montreal, a community event that combined presentations on job-hunting and career-building with demos of projects by Montreal-area developers.
  • Could cinema regenerate through the exploration, by film or cine-makers, of emerging audiovisual scripting languages? Could the editing and compositing suites progessively make room for Processing-like environment? And if so, what changes?
  • Complexe Dompark is pleased to announce the launching of its newest project, Communoloft. This unique, fully-furnished space features 16ft ceilings and a modern open-concept design for those seeking shared office space. The loft includes a conference room, kitchenette and bathroom for tenant use. Telephone and internet are also included in rental fee of $250/desk/month.   Open house Octobe
  • We offer individual workspaces in a nice 2500sqft wood, brick and concrete office, located in the Mile-End/Outremont area. We are a bunch of young entrepreneurs in design and technology, and we ask 275$/month for an equipped desk (bring your own laptop), with Internet, electricity and good vibes included ! -- contact me at sebastien@datalicious.ca to visit ! -- french version below -- Bureau
  • Lots of good people, tech entrepreneurs, developers, angel investors and the larget tech community yesterday at Helm to hear about TechStars.  Even hosted by MontrealStartup, with an initial event announced by Station-C Stars of the day were Mark O'Sullivan and Todd Burry, the two founders of the Vanilla company. Also present was Tara Hunt (@missrogue), community instigator More pictures
  • KOVASYS INC. PRESENTS FREE WHITE PAPER - SAVING MONEY IN QUEBEC FOR IT FIRMS <!-- Start_Module_616 --> This FREE White Paper will discuss: #1. Refundable Tax Credits in Quebec This part will comprise of information about advantages and conditions of programs which will help your company claim up to 30% of IT employees salaries in tax credits. #2. ‘PRIIME’ - hiring skilled im

Feedback

Archives

Events

  • 6:00 PM - 11:30 PM: Python Sprint on Distribute (1124 Marie-Anne, Montreal)

  • Register and see upcoming events at TechEntreprise

    Canada

    Montreal

    Technology



    Flickr

    StartupDrinks.caLast Drinks of the Summer, Canadian TechStars grads in MontrealLast Drinks of the Summer, Canadian TechStars grads in MontrealLast Drinks of the Summer, Canadian TechStars grads in MontrealLast Drinks of the Summer, Canadian TechStars grads in MontrealLast Drinks of the Summer, Canadian TechStars grads in MontrealLast Drinks of the Summer, Canadian TechStars grads in MontrealLast Drinks of the Summer, Canadian TechStars grads in MontrealLast Drinks of the Summer, Canadian TechStars grads in MontrealPicture 1

    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.