Femgineer

Ruby Tuesday: Test Driving Ruby on Rails

I’ve been getting feedback from my fellow femgineers that they enjoyed Ruby Bootcamp Basics, and they want more info on Ruby and Rails.  So I’m starting a series on my blog called Ruby Tuesday, I’ll spend anywhere from a couple hours to the entire day reading, writing, and researching Ruby and Rails and then blog about my findings.

I’ve also gotten some feedback from my girlfriends who are in tech, who aren’t formal femgineers (i.e. the don’t have an engineering degree or work in engineering deparments), but want to know how to program so that they can independently execute database queries, program emails, or setup simple web pages.  I’m looking out for you gals and I’ll think about doing a series of posts on that 🙂

I was hunting for a good book on Rails and a few people suggested: Agile Web Development with Rails by Sam Ruby, Dave Thomas, and David Heinemeier Hansson.  If you have done web development and don’t know Ruby I’d recommend reading the introduction and then turning to Appendix on page 667 and go through the Ruby language constructs.  Then continue on with the rest of the book, or if you’re an antsy developer like me go through the Appendix, and then skip to Ruby Bootcamp Basics.  In any event I would learn the language constructs first before reading or writing any code.

But lets back track to the topic at hand: Test Driving Ruby on Rails.  One question I ask all my interview candidates is: have you been responsible for evaluating technology?  This is a required skill in startups because you want to be up and running, and understand the trade-offs to using various forms of technology.  It’s not enough to say well all the cool kids are using it.  Its important to match the tool or language to the task at hand.  I learned Java in college, but when I really started seriously coding in it three years ago people were already onto Ruby on Rails.  It seemed to have a cult following at the time, and all the other startup kids mocked me for using Java (I’m used to being mocked by mengineers), but I stuck it out.  I discovered the Spring Framework, which I thought was really cool, but now I realize that it just adds additional configuration time (apparently Spring 3.0 has gotten rid of a lot of XML, but I haven’t evaluated it yet).  Regardless, I’ve been coding in Java because its reliable and scalable, which meet the requirements for a financial services application, and outweighed the costs of configuration.

But I was always curious about Ruby on Rails, and having finally gotten a web app up and running here are the immediate advantages I see:

  1. Ease of installation
  2. Quick database setup: no need for complex ORM mapping XML files like you need with Hibernate and Java.  Active Record is the ORM layer that comes with Ruby and handles mapping Ruby objects to MySQL tables.
  3. Quick MVC: in Java it would have take me at least an hour to configure in XML the model, view, and controller, write the code for each, and then of course add XMLC classes to support view layout.  In Ruby, I can generate each of the classes using a script or scaffolding, and use Embedded Ruby (ERb) to create a view.
  4. No compilation!  Just start the web app.

The  main reason I am going through the exercise of learning Ruby on Rails is because I want to create a prototype and rapidly iterate on it.  Ruby on Rails is good for getting a web app and running and showing it to customers within a short period of time.  Eventually, my product will have more complicated backend logic that I will probably use Java or another language for.


Exit mobile version