

Ask HN: RubyOnRails or Django/Pylons? - orlandop

First of all, I know this has been asked to death here, but after searching a lot, the most recent post is more than a year old, and a lot has changed in these frameworks lately.<p>I'm a fairly experienced developer (Java, C#, Objective-C) and I want to try my luck with some webapps. I've used python for small things, but nothing that you wouldn't learn in a week, so basically, I'm new to python or ruby.<p>So, assuming I'm already a programmer and want to learn web programming with any of the above, which one would you recommend based on their functionalities and ease of learning?
======
gte910h
Python will be more useful _if you decide to do something with the language
other than ruby on rails_. People do all sorts of very powerful math with it
as well (SPSS, SciPy, NumPy and various other things).

ROR is NOT for those who are willing to just get it done. You have to be the
type who's willing to find the right way, or risk things blowing all to hell
on you (Off the rails, as they call it).

I'd also say, the devs you hire between the two schools seem different. Can't
explain it. Django seems to win it for me, both on a scalability ease and
learning curve.

(I work with both as backends pretty daily, iOS developer).

Ruby feels cooler, but IMO, python lets you go home and see your kids faster.

~~~
tptacek
I don't object to the "find the _right_ way" comment, with one clarification:
he's talking about _the web framework_.

Ruby is just fine for "just wanting to get it done"; we've used it to write an
assembler that models opcodes as Ruby objects, a binary format description
language, 3 different debuggers, a web proxy, a hex editor, a whole slew of
crypto, a testing framework for the FIX trading protocol, Cocoa UIs, and god-
knows-what-else. If you looked at any two of those packages, they might not
appear to be written in the same _language_ , let alone the same team.

Rails does not care what crazy Ruby stuff you have built for your specific
problem domain. If you are doing graph-theoretic modeling with a custom Ruby
library, Rails does not care and it will work fine.

But. If you have even the slightest difference of opinion with Rails as to how
to handle a request or represent the URL parameters you're getting from
browsers, you're in for a world of hurt. The things Rails has opinions about,
it has _strong_ opinions about. And it's a total passive-aggressive asshole
about those opinions. It doesn't say no. It slowly punishes you instead. In
particular, even though Rails 3 advertises that it has swappable ORMs, you'd
be crazy to consider anything but ActiveRecord.

The nice thing about losing degrees of freedom is that you don't have to make
decisions about them, so I tend to reject the idea that Python gets you home
to your kids faster.

~~~
gte910h
>Ruby is just fine for "just wanting to get it done"

Yeah, I explicitly said ROR there because its the web framework which is
annoying when you want to ship. I think the language is pretty neat actually,
'cept doesn't have as many libs.

>But. If you have even the slightest difference of opinion with Rails as to
how to handle a request or represent the URL parameters you're getting from
browsers, you're in for a world of hurt.

Yeah, sometimes that "way rails thinks you should" is considerably more
complicated than what you'd have to do on a PHP or Djagno project to just get
that last mile in. I'm currently finishing up a iOS SDK/library that talks to
both a rails and django backend, and while the ROR dev is more available, he
often has to figure out the right ways to change things that the Django guy
just splats out if he has to(and cleans up after we're integrated). The ROR
solutions are often frustratingly complicated (want to add a field to this
view? Naw you can't, we have to instead change the datamodel of that object
and sorry we can't name this that thing you already put in the client, etc).
We don't care about long term whatever this week. We just want a certain URL
scheme and certain output to happen NOW so we can integrate the last couple
chunks in before our announced press event hits us, then backfill with quality
code at that URL later. It might just be I know the ruby dev better, but he
seems he's probably the better programmer of the two as well (but I don't know
the Django guy well).

Sure the rails methodology might be better if you are the type of the person
who doesn't do things the right way when you're not forced to , but if you are
the type who does things correctly, the Django is no more correct or less
correct and canonical, except for those instances when where you just have to
finish. So if we're adults, we can write good code most of the time and good
enough code when we have to and get away with it on Django. On rails, yeah
right. There was a Plone developer who said something once like "Python
believes we're all consenting adults". I feel python web frameworks do, and
ROR doesn't. (link to the AWESOME
talk:[http://www.archive.org/details/SeanKellyRecoveryfromAddictio...](http://www.archive.org/details/SeanKellyRecoveryfromAddiction))

If I wanted bureaucracy, I'd go do a java serverlet. Rails feels more like
religious doctrine enforced in code than bureaucracy, but it has that stink of
java's "thou shalt use the X to do the Y or DEATH AND INFAMY will result".
It's not an overwhelming stick mind you, but a slight odor.

Ruby on Rails DOES work. It just is frustrating in that it does not allow
shortcuts, ever. Therefore, I feel it keeps you away from your kids before a
commitment, where Django doesn't. I'm not saying "don't ever use it", and I
dont' think people who KNOW rails will get enough out of swapping to do the
swap, but if you know neither now, I'd go python/django.

Then again, if you're new to programming, the copious beware/here be dragons
of ROR might be a better path to get used to not slacking.

~~~
tptacek
I thought the same thing after living with Rails in a shipping product for 2
years or so. We embraced Sinatra, which does away with _all_ of your Rails
concerns. Sinatra is still very popular; probably the most popular framework
after Rails.

However, for my last several projects, I've been back in Rails and happy to be
there. Once you understand _why_ things work the way they do in Rails and stop
trying to bend it to your own design, it turns out that they mostly got it
right. It is, for instance, _so_ much easier to code up preauth/postauth pages
in Rails, or to implement permissioning.

~~~
patio11
I looked into Sinatra, entirely at Thomas' suggestion. My experience after
coding up a toy web application was that, if I wanted to build a non-toy
application, I'd end up building a half-complete, undocumented, poorly tested
version of Rails 1.0 prior to actually being able to work on the stuff people
pay me money for.

It is a wonderful microframework if you want to either a) build a web
framework because you want experience doing it or b) have some huge honking
system which you just want to drizzle a bit of glue code onto and expose
pretty much unmodified to HTTP.

~~~
danieldon
Have you looked at Padrino? I recently experimented with it and was surprised
that it was an extremely awesome middle ground, to the point where I'll
probably use it for my next project. It's very fast, close to Rack and easy to
use with Rack middleware, has Rails-style view helpers, has sinatra-style
controllers, very simple and elegant mountable apps, a focus on DB
agnosticism, among many other things

~~~
gte910h
Question: Have you experience with it on heroku? Does it work well there? Any
difference between its behavior and the "normal case" of RoR as far as what
heroku is designed for to your knowledge?

(Like I've said, got nothing about ruby, just don't feel rails is a good fit
for the stuff I do; something lighter weight like this could be a good
substitue on heroku).

~~~
danieldon
I haven't, but I know it works fine. Heroku is more of a Rack host than a
Rails host, so any Rack-based framework (AFAIK, all Ruby frameworks at this
point) run seamlessly on it.

------
jph
Rails 3 is such a major improvement that I recommend it highly. The new
modularity is enabling all kinds of interesting developments, like nesting
apps within apps, authentications among multiple frameworks, and speed
improvements.

Ruby 1.9.2 is also a major improvement in speed, and JRuby is icing on the
cake especially for large scale projects, integration with legacy code, and
detailed debugging.

------
tptacek
You have a week of Python. Spend 2 days with Ruby. If you fall in love with
Ruby, go with Rails. Otherwise, stick to Python. It's that simple. They're
basically the same thing.

~~~
gte910h
The differences between python and ruby aren't the important thing in this
question. The languages are different (ruby: better syntax, python: better
libraries). The important thing is "Are you the type of person who will excel
with very strong strictures on your work" (Do rails) or "Are you a person who
sometimes disregards the rules to do work more expeditiously" (Do python)

~~~
danieldon
You have that completely backwards. If you are coding your Python like that,
you are doing it wrong and almost certainly drawing the ire of the people you
work with.

~~~
gte910h
I mean, they get really pissed off when we hack a view 2 days before a
deadline instead of just not delivering it. I mean people LOVE when you don't
deliver.

Hacks are not good. Hacks should not be done all the time. But sometimes,
shipping is more important than beauty and elegance. Hacks you put up while
you get the real, good code in place is next to _godliness_ when working in
multicomponent systems under tight deadlines. Rails just isn't as good when
you need to do that sort of thing. It doesn't have that flexibility, by
design!

When I write the hacked up glue code first so they can do their stuff while I
write mine, they f-ing love that. It lets them do their job!

I do things "the right way" 99% of the time. That buys me incredible
flexibility to use utter crap code that's otherwise functional that other 1%
of the time when required by the job.

~~~
danieldon
I don't presume to know your work environment, but personally I work on my own
projects and do contract work and, in my experience, taking on debt is usually
a sign that there's a problem with the requirements and estimates, so I
usually change those before making the code less maintainable (which, IMO, is
usually a case of treating the symptom).

Regardless, I'm weary of claims that controller-level (django view level) code
is a major pain point in Rails. In some ways it's actually easier since you
can make fewer decisions by making them resource centric, but even deviating
from that is as simple as _map "/path", :to = > "controller#action"_.

Rails/Django controllers/view and routing/urls aren't as elegant as micro-
frameworks like Flask and Sinatra or not-so-micro-frameworks like Padrino, but
they aren't anything close to serious stumbling blocks (though maybe routing
to a very small degree in resource-centric Rails 2). Every blocking issue I've
had with either framework has been on a deeper level. In Rails pre-3, it was
usually configuration-related when trying to do something too unconventional.
In Django, it's when trying to deviate from the overall Django philosophy and
use something other than the included batteries.

~~~
gte910h
I'm not arguing for systemic mortgages worth of debt. I'm arguing for using
your credit card occasionally cause its easier than constantly going to the
cash machine.

Use case:

iPhone dev "can you do this"

Ruby dev "Sure, takes a sec to rejigger things to allow that"

A few minutes/hours later "Done, and its perfect"

Alternative

iPhone dev "can you do this slightly differently"

Django dev "Like that?" [Just mocked up the entire thing in pure text, django
happily returns it]

iPhone dev "thanks"

Django dev "I'll go make that work right now now that you can integrate your
code

I have a real problem with the inability to provide a good enough version now
when its more valuable than a very good version later, especially when there
is room in the schedule to deliver both.

I work in an integration based environment, where the _turnaround_ on the
backend development is the maximum schedule issue, not the overall development
scheme. I don't want my software development effort to look like the execution
of a python program in a GIL bound multiprocessor environment. I want the
thing done asap, if that means I'm paying the backend guy to redo his code 3
times cause the prototype is valuable and speeds up final time, I want the
flexibility to do that.

I'm _Excited_ that rails 3 promises to help part of this (as you correctly
surmised, it is mostly rails 2 code and coders and turnaround issues I've
dealt with), but I haven't yet seen it very much yet at all.

Schedules, requirements and all that are great, but if you can put a little
hustle in at the end when there is something big on the line _and get paid for
that_ , you have very happy customers and very fat wallets. Non software
people like delivery and there is a modicum of debt that sometimes requires.

------
patrickaljord
You won't get a non-biased answer here. Both of them are good and similar. If
you are looking for something different, give node.js+express.js a try, it's
good too though a bit less mature.

------
clyfe
(Opinion warning, as in "this works for me", not an absolute truth)

I like Rails better because:

* I like Ruby more than Python (no "self" in methods, Ruby's list.map(func) vs Python's map(list, func), usable as a template language (ERB), open classes -> easy hacking)

* Rails `Books#has_one :publisher` vs Django `models.ForeignKey(Publisher)`

* Rails migrations + db reflection vs Django attr declarations `models.CharField(max_length=300)` (Yes I know about south, you still declare the attrs tough)

* Rails has Bundler <http://gembundler.com/> , dunno about Py ...

* Django router <http://docs.djangoproject.com/en/1.2/topics/http/urls/> vs Rails router <http://guides.rubyonrails.org/routing.html> (ie. declarative regexps vs executable well tought semantics)

* rails erb (haml etc) views vs django's-template-language because python can't do templates because of the indenting

* the list goes on but I'm bored

Ruby is beter at web stuff than Python.

Python has more science stuff (NumPy etc).

So I vote Ruby on Rails

------
danieldon

        the most recent post is more than a year old
    

It gets asked every month or so, the last time I remember was just last month:
<http://news.ycombinator.com/item?id=1830063>

And I'm going to refer to my comment from that discussion:
<http://news.ycombinator.com/item?id=1830895>

~~~
orlandop
Sorry for that, seems my GoogleFu is in need of some work.

------
pdelgallego
Write this applications in both languages:

\- a url shortener.

\- a easy blog system.

\- a naive twitter.

Pick whatever feels more natural to you. If you wet stuck in any of this
applications, you can drop me a line, I will try to help you.

~~~
orlandop
Thanks for the great suggestion, and unbiased answer. I think that is the path
I'm going to take.

------
maheshs
Python vs Ruby - Both are great. I tried ruby first for a week or so and then
move to python; I love python simplicity. According to my learning experience
you can learn python faster then any other language (I am a ASP.NET/C#
developer in my day job.)

Django vs Rails - I don't have any experience with Rails because you must know
ruby first. Django is a natural choice for me because of python. Till now it
seems good to me (around a month experience). It is seem not so cool in
comparison to Rails but its good (I also know little bit of ASP.NET MVC).

Note: I am not an expert in both language/framework, so you can ignore my
suggestions.

------
ianp
The best way to pick a framework is the same as the best way to pick
anything-- make a simple app like a blog or a forum with both frameworks and
decide from there which one you like better.

------
idontlikebacon
I chose Django because I love working with Python, and it still can provide a
lot of value without the framework. Django is also less cumbersome when you
first build a project (a handful of files vs multiple directories and files
form rails.) Django also provides a lot of useful stuff out of the box -- like
an admin interface.

Besides that, everything I've seen built in RoR can be built with Django, and
vice-versa. The frameworks and the languages are pretty similar, so it's
mostly a matter of taste.

~~~
meric
Seconded. It really comes down to whether you like Ruby or Python best.

~~~
gte910h
>I chose Django because I love working with Python, and it still can provide a
lot of value without the framework.

Ruby on Rails folks hate when you say that though, cause it makes the language
half of their equation look less good. It feels like a "Oh No You're going off
topic no fair". They should just say "Yup, python is better for that other
stuff" not "But we're talking about webdev!". To me, it agains feels like a
community thing. Rails community does stuff like that, Django people seem to
care less if you like what they do too.

The fact my rails apps can't as easily control hardware, do math, or call C++
or Objective C code with minimal glue actually _is_ a problem for some
solutions I do. So I like python (my actual preferred solution right now is
GAE, not Django, but that's more economics/scaling based than technical. To be
honest my latest rails dalliance is because of the characteristics of heroku,
not rails itself

------
cies
(opinion warning)

ruby is more nice to the programmer. python has more corporate backing. django
is a pain-in-the-ass compared to rails, pylons is better but still not the
collection of power tools that is rails. i feel the python community is tail
chasing the ruby community now-a-days. catching up will be hard as the python
language misses the "principle of least supprise" that is a guiding principle
for ruby. python (like c++) managed to supprise me after year of coding with
it.

~~~
barnaby
:-) More people should use the opinion warning

(Opinion warning) They're basically the same level of overall goodness. Django
may be better at some things, Rails on others. The whole penis-size-measuring
contest between both camps is kind of annoying actually. Having said that, I
_REALLY_ enjoy Django, a lot, and recommend it to everyone when they ask which
of the two they should chose.

~~~
gte910h
>(Opinion warning) They're basically the same level of overall goodness.
Django may be better at some things, Rails on others.

You try to state that opinion around here, even clearly stating the stuff
Rails is better at, but you get railed on when you say the stuff it ain't
better at is why you prefer the other. See what happens.

------
jtchang
I like the python community better than the ruby one. So I ended up going with
python.

That said, I really like Pylons. I wish I could find more people who use it.
It is one of those frameworks that gets more powerful and makes things easier
as your webapp gets more and more complex. This is opposed to rails or django
where if you didn't design it at the get go and try to bolt it on you tend to
be fighting the framework.

------
nwmcsween
I use rails, I can only comment on pylons and turbogears from around 2006 when
I gave up on it. I gave up on both turbogears and pylons due to 1. no
community and 2. nearly no updates. Rails has a huge community, lots of
plugins, etc as does Ruby. As for Ruby itself the language just meshes with my
way of thinking if Python does that for you then go for Django

------
lukeinth
I'm happy using Ruby and Python and have built sites with Rails and Django in
the past. These days I mostly use Flask (sorta like Sinatra in Python) as its
lightweight and has templates that don't drive me insane (sorry Django). For a
large app with lots of models and mixed developers I would likely choose
Rails.

------
zachinglis
I would personally say Ruby. But then again; given a longer answer I would say
the same thing I say about camera brands. Pick both up, which feels 'right' to
you?

Ruby and Python are both great languages. I prefer Ruby as I see it as the
current front runner.

