Wednesday, December 07, 2005

Update on Designer Project

The "designer" project is coming along nicely. I'm about half way through programming the application. (I haven't started thinking about the billing and other "business" stuff yet. I'm concentrating on "the app".)

I'm actually at the point where I can create an account for a design company, add client companies and clients, and upload images. I need to implement a few more features, but as of tonight the foundation of the application is finally cemented. (All my user security plans, URL schemes, and relationships between my model objects are finalized.)

I've been working like crazy these last two weeks, and I'm making tons of progress. I know I've said it before, but I'm really impressed with Ruby on Rails. The claims about it making you more productive (especially over J2EE) are dead on. Here are the points I feel are saving me time and making me "more productive".

  1. Smart defaults and a convention-based approach (duh, that's what everyone says about Ruby on Rails)
  2. The Active Record ORM framework. WOW. I'm soooo loving Active Record. I never actually used one of the ORM frameworks from the Java world (but I read about Hibernate and I know what ORM frameworks do). I was working with the Spring Framework's JdbcTemplate library on the cancelled PM project. The JdbcTemplate stuff in Spring kicks ass if you want to write SQL. I'm now completely sold on the idea of ORM solutions, which means no SQL. From what I understand, there are a couple of key differences between something like Hibernate (from the Java world) and Active Record.
    1. It's all convention-based, so there is NO external configuration. I say "external" because when you start joining tables together you have to tell your model objects who is related to who. But there is NO mapping of columns to member variables.
    2. You can call methods that don't exist until runtime. I've never seen this before and I was blown away when I came across it in Dave Thomas' book, Agile Web Development with Rails. Allow me to explain.... Let's say you have an object called Person. You've got a database table named, People, that stores all your Person objects. The People table has the columns, "id", "first_name", "last_name", and "favorite_color". Now let's say you want to find all the people that have a favorite color of blue. You would call the following method, Person.find_all_by_favorite_color("blue"). And it would return and array of Person objects who have "blue" stored in their "favorite_color" column. This is impressive for the following reasons.
      1. I didn't have to write any SQL to look up the information and populate all the data in the Person objects.
      2. I didn't have to write the method, find_all_by_favorite_color. The method doesn't even exist in the class file. It's interpreted (or created) at runtime on the object.
      What's even cooler? You can combine the column names with the "find_by" method. So you can call this method (again, without having to write the method in the class file): Person.find_by_first_name_and_last_name('MICHAEL', 'SICA'). Active Record then goes and looks for a record in the People table that match the criteria and then returns to you a fully populated Person object!

    Active Record is saving me a TON of time. Not having to think about fetching the data and populating the objects is a huge time saver.

  3. Extremely simple form binding. I'm not going to go into the details, but it's just as powerful as what Spring MVC offers, but it's about 1/3 less complicated. That, coupled with the rest of the Rails framework (especially Active Record) adds up to a HUGE time-saver.
  4. Built-in Ajax view magic. Again, I'm not going to go into the details. But the "link_to_remote" function rules! :)
I'm really glad I decided to go with Ruby on Rails over Java. This gained productivity is just ridiculous.

Well, this blog post turned into a much longer post than I though it would! Thanks for reading it!

0 Comments:

Post a Comment

<< Home