Friday, June 20, 2008

Web development: Ruby on Rails versus ASP.NET , Flex, PHP and other Java stuff

I've got some feedback from my earlier post on ASP.NET versus Others . In that particular post I claimed ASP.NET WebForms works best for me and I presented my own reasons why I think that way. I might be a little biased may be so I'd like to share my opinions for the other side of the equation, namely Rails versus Others:



There is an old saying that, "Teacher will appear , when the student is ready". The fundemantal reason rails emerged was because there was a need for it, mainly from java developers. Java web frameworks generally have excellent architectures. They are clean and they follow good design practices. However following good design practices made them a bit more academic rather than practical. First the EJB 1 and 2 nightmares frustrated java developers then they settled to some ground with Spring and Hibernate. Although this solution was acceptable, the development overhead was rather large. The idea beyond rails is to compact this entire J2ee thingy to an acceptable size and replace a verbose language like java with an elegant language called ruby and we got rails.

When I first dived into rails I really thought that was the answer I was looking for. So I loved it too much. (Then I went back to asp.net. But I wouldn't do that if there were no mono. I am biased against MS)

Ruby had two main philosophies. "Convention over configuration" and "Don't repeat yourself". We will discuss about them. Also rails was the main push behind the RESTFUL Webservices.

Let's get to Pros and Cons of Rails:

Pros of Ruby On Rails:
*
Open Source and Community Driven
* Cross platform, works every where
* Ruby is an elegant language
* Extremely Scalable (a front end proxy balancer will do it)
* Built in unit testing and ajax support
* Clean seperation of layers
* Zero configuration (convention over configuration)
* Extremely flexible
* Main stream, good community and lot's of books

Well this are the good things come into my mind. Looks promising right ? Let's see the other side of the equation.


Cons of Ruby On Rails:
* Single threaded!!! Wow this is quite intersting for a web framework. Fortunately this doesn't prevent us to build scalable applications
* No unicode yet. You can over come this with JRuby on Rails and IronRuby on Rails
* Green threads. It doesn't use real os threads. Look above.
* The down side of the MVC pattern. You have to type a lot of html
* Database abstraction is too thin. This is something I don't like. The columns in your db implictly becomes properties of your classes. Even if there is no code !!!
* Most software shops don't know about it. So it is unlikely that you can use it at work.


Well that's all in my mind. Let's get into one by one comparison

Ruby on Rails versus Java frameworks:


Now they say a picture is worth a thousand words. That's a true comparison of java frameworks and rails. It basicly eliminates boring stuff like xml configuration of spring and hibernate. Sure Java frameworks is far more powerful than rails. But if you say who needs an 800 pounds of gorilla. Then rails is the right way to go. Note that Java also have JRuby on Rails and Groovy on Rails. This comparison excludes them but points the traditional approach of java web frameworks. I know this isn't enough for technical comparison but that's all I am gonna say about it now.

Ruby on Rails versus PHP:

Yes I am a php basher. Compared to plain PHP rails is superior Period. Plain php is too old. It's like COBOL imho. And the irony is Facebook uses PHP. Well... But PHP has a lot of grown frameworks. Even Rails like ones like Cake or Symfony. A quick google will tell you more. But my suggestion would be to stay away from PHP unless you are dealing with legacy stuff.

Ruby on Rails versus ASP.NET:

I already made a detailed comparsion ASP.NET versus Others. Telling why I found ASP.NET superior. But unlike my php comparison , I find this is a matter of personal taste. Rails is an excellent framework offers valid solutions. If you like more componentize approach with .NET/mono power then ASP.NET is the way to go. Otherwise rails may suit you better.
One technical thing rails is better is that it can emulate true bidirectional associations. For instance:
my_school.students << my_student
implicitly does a my_student.School = my_school

The same situation is extremely difficult to achive with static languages like C#.In general you do explicitly

mySchool.Students.Add(myStudent);
myStudent.School = mySchool;



Ruby on Rails versus Flex:

Now this can't be a comparison because Flex is for pure front end. And you can perfectly use Flex with Rails. Even there is a book for it. Flexible Rails. Some people call Flex+ Rails as the RIA Nirvana. I told you I like a componentized approach. Flex is perfect for that. And rails is very good at serializing the domain data back and forth to Flex. If you can tolarate a flash thingie running inside your application (which I can't!) this is a perfect way to go.

Others:
Wheather rails is a hype or not, it is a really milestone in web application programming. It inspired other web framework developers a lot. Python got Django and TurboGears, PHP got Cake and Symfony, ASP.NET got MonoRail and ASP.NET MVC. Unfortunately I am not involved with them so I can't really compare them.


Conclusion:
If you tried others and still not satisfied try rails. I am sure that you won't regret. And where do you start ? I personally start with the Agile book available on rails' web site. But there is a huge documentation & screen casts on web too. Good luck !

9 comments:

Anonymous said...

maybe you should take a look at that:
The latest Ruby vs. Javascript

Anonymous said...

oups sorry i meant java of course =(

Onur Gümüş said...

nice one !!

Web Development Services said...

It's fabulous! Since I'm officially taking over a library position this year,
This is all quite exciting and it is great to see the connection between instructional technologist and librarians.

Web Development India said...

Hi,
Thanks for nice post
People at times think that there are assured returns when it comes to developing your own websites.

Offshore Software Development Company said...

I was seeking for ruby application development and set down up on your mail and i should state thanks for distributing such helpful information.

Guy Aguirre said...

I appreciate the work-flow, the toolset, the group and especially the possibilities I’ve been provided that allow me to discuss my encounter and tutor others.

Andolasoft said...
This comment has been removed by the author.
Lisa Ladraw said...

Thanks for your marvelous posting! I actually enjoyed reading it, you will be a great author. I will be sure to bookmark your blog and may come back later in life. I want to encourage continue your great writing, have a nice evening!