Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
What can't rails do? When is it the right language?
4 points by noelchurchill on March 26, 2008 | hide | past | favorite | 13 comments
I can hack together some php, but I'm no pro. I'd like to advance my skills and dive into a new learning project, but the question I can't answer is what language should I devote some time to? RoR has a lot of hype and Django sounds like a possible contender for the new hip framework. Or I could just continue to work with php. I've read a lot of debate over why one language is better and the most diplomatic answer is that all languages have there strengths and weaknesses and it just depends on what you are trying to do.

So here is my next question. What does that really mean to me? What is rails intended to do better than anything else? What is really difficult to do? What can't it do?

I understand the ideological explanation that it forces you to write good code, but that's not unique to rails anyways. I'm trying to figure out the real practical benefit ... the bottom line.

BTW .. sorry if I couldn't find the thread that already covered this because I'm sure it's out there.



Rails isn't fun to use when you have to integrate with legacy systems and database schemas that doesn't fit with active record's way of organizing databases. Far more work than necessary. When your database has simple things like checks, restrictions, foreign keys, pl/sql routines & weak entity tables built into the schema, active record completely ignores it and craps out when the db gives errors about it breaking your restrictions (it doesn't handle them as it does it's other types of errors). Even doing a db schema dump into migrations doesn't fit 100% and you have to recreate the entire schema in rails-pseudo-sql for it to work properly. Totally against the DRY principle.

When your starting from a clean slate although, it's a different story. Then you can use rails conventions & restrictions and everything runs a lot more smoother. But if you got previous systems to build on, it's a bit more extra work. Rails is an opinionated asshole (like steve jobs), and when your not willing to back down, you got a lot of extra work to go through.

Also sometimes rails is just too complicated or inflexible for the job and whipping up something quick & dirty in 500 lines of php would do you far far better.


Well, Ruby is just a lot more fun to program in than, say, PHP or Java (http://judofyr.net/posts/haiku.rb.html - Ruby haikus, anyone?).

Rails is a very neat framework, which means it comes with all the pros and cons of a framework. The pros are that it can get you up and running very quickly, and it's really good at hiding the tedious details you would normally have to deal with. I think it's actually helped me write better PHP code, to be honest. The cons, of course, are that you have to learn it, like any framework it can sometimes get in the way, and it might be more than you need for certain projects. Rails is great for anything that resembles a CRUD app, and it forces you to stick to the MVC model; if you're doing something very different, it might not be the right tool.

One thing to consider is that PHP works on pretty much every *nix server out there out of the box, while Rails might take a bit of fiddling to set up and administer.


If you're trying to decide whether to learn Rails, don't spend a lot of time debating - just do it. You won't regret it. If you're a novice at PHP, you'll probably learn a lot of stuff in Rails that will be applicable to any platform you work on.

I find Rails programming to be really fun. However, I'm approaching it from the opposite end - the J2EE side, where everything takes a long time to configure.

Django seems cool - if you were to learn that rather than Rails, I don't think it would hurt too much, if at all. I expect that once you learn one, you'd be able to pick the other up pretty quickly. Despite the impression internet posts may give, Python and Ruby are pretty similar languages, and both worthwhile and enjoyable, if you ask me.

One thing Rails has going for it is that it's pretty widely used (compared to Django, AFAIK), so there's a lot of documentation out there. Although, beware of some stuff that may be out of date with Rails 2. Definitely pick up The Rails Way if you do learn Rails. You may want to get the pickaxe book as well. Those two should have you pretty much set as far as books go.

The downside you may face is the shared hosting situation. I understand Dreamhost supports Mongrel (the web server commonly used to serve up Rails) now, but haven't used it. My experience is that VPS is the way to go, rather than start on a shared hose and move to VPS.

Despite some impression certain internet writings may give, plenty (most?) of us in the Rails community are friendly and more than glad to help someone get going with Rails. If you do decide to learn it, feel free to contact me if you need any help getting things running.


You could look at some php frameworks, i don't use 'em but some of them out before the rails way of thinking codeigniter, smarty templating, but then there is cakephp which takes a rails approach.

You should learn rails, but it will require learning ruby.

That said learn rails, start with a small project. Something that helped me learn how some of the rails magic works was to install plugins, then hack/mod them and read the source code. You'll pickup all sorts of neat tricks and tips.

Remember if you having trouble doing something or even wrapping your head around it, google around as chances are someone blogged about it or explains it.

To answer your question, the only thing that rails doesn't do well is multiple uploading thing, but you can always farm out uploading work to merb.


There are many nice things about Rails. If I had to pick, the secret sauce is ActiveRecord. ActiveRecord avoids 90% of the SQL that is usually required when writing an app. ActiveRecord avoids this in such a way, using metaprogramming and conventions, that the time saved writing SQL is really time saved, not merely exchanged for time writing an extensive ORM mapping layer. The boost this gives can be amazing when compared to some other frameworks. I can't speak for Django, though.


One of the main strengths of Rails is that it allows you to get up and running quickly while still guiding you towards modular, reasonably maintainable code. You can very quickly spike (prototype) new approaches and modules and focus on your business logic rather than all of the scaffolding attendant to it.

I've personally found it invaluable and I'd highly recommend the framework to anyone looking to learn a new tool for building web applications.


If you aren't clear on what the failings of PHP are, you may want to stick with the language. Keep flexing your SQL skills, build great UIs, and figure out how to modularize your code to keep repetition down. Take a look at Rails a year down the road -- start by browsing the official Rails book at your local Barnes.


What is new in Rails 2.0? There are a lot of books and resources available for 1.x. Are there any good resources available for the latest version?

I understand there were some significant changes. Does that mean if I'm learning this from scratch that I should avoid the 1.x way of doing things?


There's a great book for Rails 2.0. It's "The Rails Way", by Obie Fernandez.

http://www.amazon.com/dp/0321445619/

By and large, most of the 1.x stuff will still work, but it won't necessarily be the most efficient use of your time; lots of the 2.0 changes make things easier.


Was the 2.0 stuff thrown in at the last minute or was it well done?


They used edge rails so they could write about it before it was officially released. Here's an excerpt from the book:

"However, edge Rails still comes in handy sometimes. For example, it allowed us to extensively cover Rails 2.0 features in this book prior to the actual, official 2.0 release"


It's well done. It's a great book. If you know Ruby, it's the only Rails book you'll ever need.


Just give it a go, it'll never hurt to learn something new.

Coming from PHP, you'll probably see some benefits right away.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: