Monday, February 16, 2015

Top tips for Ruby on Rails beginners

Ruby forms the foundation of many top websites. If you fancy learning more about the language, here's some tips to get you started.

You've probably heard the name – Ruby on Rails. But what is it, why is it so poplar and how do you start learning about it? Ruby, like JavaScript, is a general purpose programming language that's best known for is use in web programming. It was created around twenty years ago by Yukihiro "Matz" Matsumoto.

Along the way, you've probably heard the term Rails too – Ruby on Rails. Rails, in this context, is an extension – or a software library – that's designed to expand the Ruby Programming language. The Rails framework is for building websites.

Under the hood, Rails combines CSS, HTML and JavaScript. It's let you create web applications that live on web servers. As such, it's generally considered a 'back-end' or 'server side' platform. If you fancy learning more about Ruby, our guest experts - Rik Lomas and Ben Scofield - give three piece of priceless advice...

01. Choosing a language

Why should I choose to learn Ruby over the other languages out there?

Rik Lomas: "I went through several languages before settling on Ruby. I like it because its syntax is simple and readable, and you can do a lot more with less code – I don’t want to be writing five lines of code when I can write one. The Ruby community is very open with lots of gems (Rubylibraries and plugins), and it’s friendly to coding beginners."

02. Define your terms

What is Rails and what's special about it?

Rik Lomas: "Rails is a library that is built on top of Ruby to make building complex web applications easier. It was created by David Heinemeier Hansson from Basecomp when he was building the company's web app. If you want to create your own social network, shop or any kind of site where users can sign up, look into Rails. It's bit of a steep learning curve to begin with, but once you start seeing the same patterns repeat, it gets easier and easier."

03. On the right track

What’s the best way to start learning Ruby on Rails?

Rik Lomas: "There are some great guides online to help you. For learning Ruby itself, there's a funny-but-weird guide called Why’s (Poignant) Guide to Ruby. The official Rails guides are well written compared to most technical documentation, too. The best way, of course, is to have a project and get stuck in. It can be tough but keep checking Stack Overflow and RailsCasts for help, and stay determined."

04. Different operating systems

How do we set up for Windows?

The majority of tutorials seem to be Mac focused. Ben Scofield: "Honestly, this is hard. If you're already comfortable with virtualization, I would strongly recommend using VirtualBox and Vagrant to run a Linux virtual machine on your PC. That's a significant commitment, though, so if you want to get started with something simpler your best bet is to look at RailsInstaller or RailsFTW. Neither will give you the latest and greatest versions of Ruby and Rails, but they should be enough to get you started."

05. Find inspiration

What’s the best way to get started?

Ben Scofield: "From what I've heard over the past few years, Michael Hartl's Ruby on Rails Tutorial is the gold standard for getting started learning Ruby and Rails on your own. The current version of the tutorial covers Rails 4.0, but the previous edition (which covers Rails 3.2) may be helpful as well. Beyond that, your best bet is to look for topic-specific content -- as you need to learn more about, for instance, sending email, you can check the Rails Guides, RailsCasts, or more recent blog posts."

06. Working with scaffolding tools

What's your advice for developing and deploying Rails apps where front end build is done by one of Gulp/Grunt/Yeoman?

Ben Scofield: "My personal preference is to separate the two pieces as much as possible; over the past year or so, I've seen a lot of promise in building a Rails application to provide an API, and building a pure JavaScript front-end to consume that API. In that sort of setup, you wouldn't need the front-end build tools on the Rails app, and you're free to build the front end in whatever style you favor."