There are many reasons why Rails is special, but in order to keep things fairly short, relaxed and n00b friendly, I won’t delve too deeply into the mechanics. Instead I’ll cover the things that first drew me to the framework… and subsequently got me hooked!
The best technologies
One of the biggest draws to Rails is that it saves you a heap of trouble having to spend weeks or months researching/agonising over which technologies to adopt or methodologies to follow. If you’ve ever wanted someone to just tell you what the best are, then consider yourself told!
Here’s a list of some of them:
- MVC – Model View Controller architecture
- Convention over Configuration – design paradigm; spend less time configuring things!
- DRY – Don’t Repeat Yourself
- TDD – Test Driven Development
- SASS – Better CSS (variables &∓ conditionals!)
- REST – REpresentational State Transfer – architecture for (stateless) networked applications
Ok, so it’s all opinion – but does it really matter so long as they are some of (if not the) best? If they’re good enough for a large number of talented devs then they’re good enough for me! I’m more than happy to bow to their superior knowledge (and if you’re smart, so should you).
It’s widely accepted that most of the default technologies, and the way Rails is set-up or goes about things is nothing short of awesomeness (it’s not called the best web framework for nothing you know!) and where you might feel the defaults are not to your taste, it’s easy to swap and change. Want to use jQuery? Fine. Want to use Prototype? That’s cool too. Prefer RSpec? No problem!
Another big draw is the underlying language. Ruby is beautiful, powerful, elegant – and doesn’t get in your way. In fact, it’s not uncommon for people to say Ruby devs are happy devs, and they really are! The syntax is clear, constructs make sense and it all just flows naturally, making it a lovely language to work with. But make no mistake, the simple exterior harbours a very powerful interior. One that allows Ruby programmers to do things that programmers of many other languages can only dream of. Such as metaprogramming.
Another common saying is that while many come to Ruby because of Rails, they stay because of Ruby – and I couldn’t agree more. Rails wouldn’t be possible in another language, you’d get something similar, but it wouldn’t be the same – you’d be left feeling something wasn’t quite right, or that it’s almost there. Ruby is a key reason why Rails is so awe-inspiring and why so much of what it does is possible. Ruby is an all-purpose language too, so it’s not just for web apps (like say PHP).
Its creator Yukihiro “Matz” Matsumoto, has said that he is “trying to make Ruby natural, not simple” in a way that mirrors life. And many would argue he’s done just that – and then some.
The Ruby community rocks. You get the feeling everyone is on the same wavelength, most Rails devs seem to use OS X and TextMate for example (even down to the same ‘theme’!) but the conventions run a lot deeper. Whether it’s indentation style or using parentheses in your method definitions or calls (they’re optional in Ruby) there’s a ‘Ruby way’ and most in the community stick to it. It’s not because Ruby users are mindless zombies mind you, it’s because we genuinely like the same things and have similarly high standards.
The most important thing however, is how passionate and helpful the community is. Good enough just isn’t good enough. That’s why test driven development (TDD) is such a big thing in the Ruby community, and why you can rest assured that your peers will always help you remain on top of your game.
As you might expect, with something so cherished at its heart the community are eager to help each other get the best out of it. Testament to this are all the resources that are not only free, but have clearly taken a lot of time and effort to put together. Here’s a quick list: tryruby.org – where you get to try (and learn) Ruby in your browser, the extremely enjoyable Rails for Zombies where the Envy Labs team take you through some gory screencasts then test your knowledge via the
brain browser, the fantastic Railscasts which is nearly as old as Rails itself (!) and Rails Tutorial which is an excellent step-by-step that helps you build a twitter clone. There’s also the IRC #rubyonrails channel (irc.freenode.net) where there’s always some cheery soul willing to lend a helping hand, and the utterly brilliant Ruby Mendicant University (and Ruby Best Practises from the same person, Gregory Brown). Finally I just have to include Rails Hotline where if you get stuck and fancy talking to someone who might be able to help, you can – for free!
Pretty awesome don’t you think? And did I mention they are all free!?
If all of that isn’t enough for you (it should be, but if it isn’t…) then there’s one last thing that I find quite remarkable. I’m fairly new to Ruby, yet many leading or well known figures in the community have taken time out to speak to me. Yehuda Katz talked to me at length about learning Rails. Gregg Pollack was happy to discuss my ideas of where Rails for Zombies could lead. Ryan Bigg made the effort to get a .mobi version of his book (Rails 3 in Action) to me as he was keen on hearing my thoughts, and even DHH (the creator of Rails) has discussed totally unrelated topics via Twitter. And that’s just the people who I know are leading figures! I’ve also exchanged tweets with a number of others but won’t include them here for brevity – well apart from Russ Olsen, the author of two of my favourite Ruby books (Design Patterns in Ruby and Eloquent Ruby) who is following me on Twitter. *Faints
It’s fantastic that a large number of people high up in the community are willing to take time out for the nubes. Is there any wonder why the community is as cool as it is?
What Rails can do for you
This is probably what most of you are wondering – so what can Rails do that an off-the-shelf app/script can’t? Pretty much everything!
If you want to build a custom site, free from the constraints of a predefined app and perfectly in tune with your own vision and style, then using a framework like Rails is probably your best option. You could just skip the framework, and code everything from scratch – but why bother when so much of the hard work has already been done for you? Most of the fiddly ‘boring’ stuff is all set ready to go – you can just concentrate on the exciting stuff! And more importantly, if you’re not an expert already, Rails will teach you best practises that might otherwise take a lifetime to learn.
Additionally, and something that will interest you as you progress as a Rubyist, is that Rails allows you to use many of its components for your own non-Rails apps. Such as Active Record (the Object Relational Mapper) Active Support (Rails libraries) and even Action View (view helpers). Some of these even extend core Ruby classes such as Array, String and Hash – which is impossible in most other languages!
What will I need to learn?
Thankfully Rails teaches you a great deal about good web development, so you get to pick that up along the way – this in itself is pretty priceless. You will need to learn Ruby and Rails, though (and I assume you already have a working knowledge of HTML and CSS). You could get by with a little Ruby, as Rails does simplify many things – but learning Ruby is the only way to become a Rails Ninja, because Rails is Ruby, underneath it all.
If I’ve wet your appetite and you’re eager to learn but don’t know where to start or how to go about it, keep an eye out for a future blog post (Edit: the future is now! Link added…) where I will be doing a ‘Best way to learn Ruby & Rails‘ feature. In the meantime, here’s some quick tips:
- If you’re new to programming go through Learn to Program by Chris Pine – a lovely introduction to OOP and Ruby.
- Then do the excellent Kevin Skoglund, Ruby, and Ruby on Rails 3 courses over at Lynda.com – they are in perfect 5 to 10 minute clips and Kevin really knows his stuff… and knows how to get you to know it!
- After that check out David A. Black’s The Well Grounded Rubyist – one of the best Ruby books I have read to date. David is a real-life teacher, and it shows. He takes nothing for granted and walks you through every bit of code in the book so you never feel like giving up. This book really is a gem and I’m sure you’ll love it every bit as much as I do.
There’s more of course, but that’s enough to get you started. If you already know HTML and a bit of CSS, you’re ready to jump right in. So dive in and unleash your creations onto the world – faster, better, and while enjoying, yes enjoying, yourself along the way too.
Related post: What’s Special About Ruby?Tags: rails, ruby