Live data from Hacker News

Ask HN: Ruby on Rails why the hype?

news.ycombinator.com

1–10 of 29 posts

Ask HN: Ruby on Rails why the hype?

#1
Most of my recent coding has been done in asp.net and asp.net mvc of late. I was looking into Ruby on Rails to figure out what all the hype is about. What I can't figure out is where is the business tier? All of the code samples in the "models" that I've seen seem to be straight to database type code. I’ve seen lots of pretty and fast sites using RoR but they don’t seem to do anything computationally interesting (in process). So what I’m I not understanding here?

Re: Ask HN: Ruby on Rails why the hype?

#3
The "computationally interesting" stuff shouldn't be handled by your web framework. That's not its job. What Rails does well is let you get a baseline-nice web application with many common features up and running without much fuss.

Re: Ask HN: Ruby on Rails why the hype?

#4
Business Tier?

Why ROR? Speedy development, fun programming language, easy to build, test, iterate, repeat etc. Easy to migrate DB's, lots of scaffolding to reduce amount of code you need to write. Tons of great plugins written for the stack, very active community, some incredibly talented developers work on the stack.

ROR is perfectly suited for building out a great web app, quickly. And yes, it does scale ;)

Re: Ask HN: Ruby on Rails why the hype?

#5
Rails MVC blurs the distinction between a "pure" business tier and a db access layer.

The intention behind the design of ActiveRecord is that the db access logic is done automagically and you can make AR models your domain model.

The recent trend of adding various finders, etc. to AR models blurs the conceptual clarity a bit. Some plugins also blur this clarity.

Generally you should be able to use AR models as business objects, just be aware that there might be a few other behaviors added on that aren't strictly part of the business rules. This might irritate some people.

You are certainly free to write your business logic as separate classes as you see fit. Rails doesn't tell you not to. It just offers a convention that is often very reasonable for most peoples' needs.

Re: Ask HN: Ruby on Rails why the hype?

#6
It's the magic. The fact that rails extends data types and adds implied functions to your models without you having to tell it to. The fact that lines like:

cookies[:remember_token] = { :value => user.id, :expires => 20.years.from_now.utc }

Do exactly what you think they will, without having to define everything. That's the "magic" behind rails. It let's you focus on the application rather than the framework.

Re: Ask HN: Ruby on Rails why the hype?

#7
MVC and the N-Tier systems some similarities, but differ in their implementation. I came from a 3-Tier background where everything was simply divided, DB, Business, Output. Most of the time, the 3-Tier acts like MVC because you're accessing DB From the Business Layer then Showing it on the View.

Where they differ, and this is from my experience (feel free to correct me) is that in MVC, the Views have an attachment to the Controllers. Basically a view can only have one controller. Views can have multiple partial views, but ultimately belong to one controller. In the n-tier system, the view can be abstracted to the point where it does not care what is going to be shown.

Once you wrap your head around MVC, it is hard to go back, especially for Web products.

ROR also takes care of a lot of your db schema and logic, so you can focus on programming, not writing CRUD statements.

Re: Ask HN: Ruby on Rails why the hype?

#9
All of the code samples in the "models" that I've seen seem to be straight to database type code

I think the problem is that you're looking at "code samples", which tend to be the simplest possible examples. One of the nice things about RoR is that a model class can be as short as two lines:

    class MyModel 
and everything else happens by "magic". Our system has a few classes like that. OTOH, we also have model classes with thousands of lines of complicated business logic. But, showing those to someone trying to learn RoR would just overwhelm them.

Re: Ask HN: Ruby on Rails why the hype?

#10
The hype is that it was finally a framework that does not build on leaky abstractions like "business layers". The downside is that it sometimes adds a few others...

By the way: the Rails hype was 3 years ago. Now, its just one implementation of the same concept like all others.

Post reply on HN