Ruby on Rails: Starting

My better half is about to start working on an application.  So I’ve been rehashing some work I did a couple of years back with Ruby on Rails – I built an automated watering system that pulled down weather forecasts and observations from the web, and calculated the amount of watering to do based on temperature, evaporation, recent rainfall and forecast rainfall.  I was pretty happy with it, as it reduced my water usage, which is useful when you’re using tank water and your tanks aren’t too big.

Anyway, the hardware controller I had for the valves eventually died, and I went back to a standard watering system largely in the interests of “decluttering” my life – one less thing to maintain.

I’ve been looking at that work and writing some sample apps in Ruby so I can remember how to do it.  I’m going to be posting some thoughts on Ruby, and information that I’ve gleaned.

Starting off – what is Ruby, what is Rails?  So Ruby is a programming language similar to Perl or Python – it’s a scripting language that is pretty powerful, it was created in the last 10 years or so by a guy in Japan.  Being a reasonably new language, the implementation is reasonably clean – it is easier to understand than Perl for example.

Rails is an application development framework that works with Ruby.  Rails provides a clean application framework, and requires very little code to get any particular function working through the use of:

  • DRY: don’t repeat yourself.  If you’ve created a database table with 10 fields in it, and you declare an object that uses that table, it should automatically know that the object should have those 10 fields in it too
  • Convention over configuration: you shouldn’t have to write screeds of detail about how each bit of your application works – it should have sensible defaults, it should make assumptions about what you mean by the way you write it

It is actually ridiculously easy to get a basic application up and running – the first time I did it I think it took around 2 hours to get to a point where I had running code that I could edit to do stuff.  Not bad for a new language from scratch!!

So, number one learning at the moment is that if you want to write Ruby on Rails, you should start by getting the book.  The book that seems most recommended is Agile Web Development with Rails.  We also got The RSpec Book: Behaviour-Driven Development with RSpec, Cucumber, and Friends which also is very good.

I’ll be putting a few posts up on the process of building an app with Rails, and then the process of hosting a development environment on my local servers.  Later on, I’ll perhaps be posting some information on hosting on the Amazon cloud.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s