Compared to other languages you may have used Ruby can seem a little odd. Flexible syntax, talking foxes and mad Japanese geniuses all make it look rather more like an arcane formula than a programming language.
Though learning it really couldn’t be simpler because it flows like your mind. In fact the hardest part of all is realising Ruby makes sense!
Let me take an example of Ruby and PHP code that does exactly the same thing:
// PHP
if(strpos(”restaurant”, “aura”)){
exit;
}
# Ruby
exit unless “restaurant”.include? “aura”
And the definition of elegance is….
So how to learn this beautiful language? Here’s 5 simple steps:
1. Deprogram
Stop thnking in strict programming terms. Think more fluidly about what you want to achieve and if needs be find out the Ruby Way of doing things.
2. Read Existing Code
As with other languages one of the best ways to learn is reading existing code. With the proliferation of Rails apps you can’t help stumble across quality code to peruse and learn from.
3. Read a Good Book
The Ruby Way is the one book I’ve really cherished since starting Ruby and blows the usual recommended tome of “Pickaxe” out of the water.
4. Don’t Rail It – Yet
As much as I love Rails I wouldn’t recommend it as a first project in Ruby. It teaches a lot of good practices (if you don’t do them already) such as MVC programming and strong testing. However, it can also lull you into false securities. As the old saying goes: Don’t make your first app in a language a production app. Rails is too nice to resist that urge so don’t!
5. Teach, Blog, Talk
Teaching other people and blogging about it really, really helps you re- inforce your own knowledge. Regardless of how confident you may feel you always know more than someone else and even if you get corrected or someone puts you down – you’re learning. So go forth and blog, preach and shout ahbout Ruby to make yourself a master.
Hello…
I have been searching for an image of a ruby for my website. Can you tell me where you acquired this image? And whether it is subject to copyright?
http://www.straw-dogs.co.uk/wp-content/uploads/2007/10/ruby.png
Thank you…
Kate
Its from the Ruby language website. I’ve tried to find it but I can’t seem to. It comes as a zip file with a variety of sizes and formats of the Ruby logo.
As its an open source language I would imagine the logo is also open and probably comes under creative commons.
If I was you I’d use it – if someone takes issue with it they’d contact you.
Hope that helps.