
How two Pythonistas accidentally fell in love with Rails - snprbob86
http://blog.brandonbloom.name/2010/09/how-two-pythonistas-accidentally-fell.html
======
jnoller
And based on the author's previous Django and ORM posts, I look forward to the
next post in a few months when the black magic stops working and they begin to
hate on Rails as a framework.

~~~
snprbob86
I'm the author.

Yeah, there is a non-zero chance of that happening. However, I keep
discovering more and more Rails design choices that either match or closely
align with my preferences.

The three biggies comparing to Django are:

1) Powerful templates (including the convenience of "Helpers")

2) Non-declarative schema ORM with full migration support

3) Form validation and generation with Rails doesn't suck

Lastly, Rails feels battle tested and production ready. Everything from the
Rake tasks, to the framework surface area, to the plugins available seems
tuned for real applications. Python stacks I have tried often require _a lot_
of hackery to handle server configurations, deployment, content builds,
template helpers, ... the list goes on and on.

~~~
jnoller
I think you and I both know - once you've run with something long enough, you
hit a wall. Everything - every language, framework or tool hits a wall. You
hit yours with Django because you fundamentally disagreed with some of the
design decisions. I personally have not hit my wall (with django) but I see
plenty of room for improvement.

It's awesome you built something so quickly with Rails - I have a similar
experience with Django (a tiny amount of time to build a really deep
application).

I personally found it amusing/bothersome that you were lauding a fairly
magical and opinionated framework when you had old posts deriding Django (and
it's ORM) in the past.

~~~
snprbob86
I like opinionated software. Especially when it matches my opinions. And if it
doesn't match my opinions, it is easy to dismiss it.

It isn't the magic about Django (and it's ORM) that I didn't like. It was the
design decisions that didn't match how I think (and approach of declaring the
DB schema in code).

~~~
jnoller
We (mostly) agree then. The non-opinionated stuff makes me 1000x more angry
then something silly like lack of class-based views, or the inclusion of GIS
in contrib (for Django).

I was probably overly sarcastic in my original comment, so for that I'm sorry.

------
andybak
Wow. Very disappointing comments on this post. I was looking forward to a
healthy debate with some interesting arguments. but with a couple of
exceptions this is silly bickering.

~~~
Raphael_Amiard
This may be because nearly everything that has to be said about Django VS
Rails, or Rails VS any framework has already been said twice. Not to say there
isn't room for new/interesting discussion, but it's certainly a tougher
subject than others.

~~~
andybak
Having checked back after a night's sleep things seem to have improved.

Phew. I thought this had turned into Reddit.

------
alinajaf
After having worked with rails for coming on two years now, it's been a love-
hate relationship. The short version: your first few apps will be pretty
horrible but the more you know about the framework, the better they get.
Admittedly, the same could be said about any framework.

Also, don't be afraid of the black magic, read the source, its just plain old
ruby down there.

~~~
swombat
Agreed. "Magic" is just another word for "I don't understand how they did
this". Whenever you meet "magic", you should dig into the code until you do
understand "how they did this".

~~~
xiongchiamiov
I think James Bennett's post on magic is interesting:
<http://www.b-list.org/weblog/2009/jul/23/magic/>

In particular, there is a comment[0] that I think is particularly worth
reading:

There are two different definitions of magic in play here.

    
    
       1. The use of advanced language features in a manner that might be confusing to a novice programmer.
       2. The use of ANY language feature to automate some process that a programmer would not expect to be automated.
    

I am of the belief that the second is the proper definition, which is
something that is not usually solved by reading sourcecode, as the question is
"Why?", rather than "What?" or "How?".

[0]: <http://www.b-list.org/weblog/2009/jul/23/magic/#c118751>

~~~
Periodic
It's like the reason I advocate comments though I know a few people who
believe the code's behavior should be self-evident.

The real question for any interesting application is not the how or the what,
but the why. You can't answer the why just by reading the code. You need to
understand the problem and the trade-offs, and for that you need comments and
documentation.

------
okaramian
I go back and forth with rails.

Sometimes the black magic is great, especially if you're trying to rig a
prototype together. Also the configuration is almost always really easy so
it's not difficult to start burning through a project.

Other times it's like "too much framework". I've never really been a fan of
the all the javascript hocus pocus that occurs and prefer just writing it out
on my own.

I also started to get frustrated with the active record query interface and
started writing my own queries out because it was faster (for me).

~~~
snprbob86
The Javascript hocus pocus is the one key thing I haven't really figured out
yet. Rails 3 seems to have made a move to unobtrusive Javascript, but it
appears half-baked compared to the RJS stuff I keep stumbling across on the
web. If you ignore the `:remote => true` business, it is as if there was no
special support for js at all. As a solid jQuery developer, that's probably a
good thing.

~~~
cageface
I stopped using the Rails js stuff a long time ago. It's really not that hard
to just use jquery and it's more obvious what's going on.

------
10ren
ORMS: [http://blog.brandonbloom.name/2009/10/orms-and-
declarative-s...](http://blog.brandonbloom.name/2009/10/orms-and-declarative-
schemas.html)

Visual object-relational mappers allow you to integrate different DB schema
and classes/objects, instead of deriving one from the other. What do people
think of them? They aren't appealing to me, because they aren't very code-
like... however, some relationships between disparate type-systems are _much_
easier to express graphically than in code.

URL parameters: [http://rails.nuvvo.com/lesson/6371-action-controller-
paramet...](http://rails.nuvvo.com/lesson/6371-action-controller-parameters)

I really prefer Sinatra's way of doing this; and it's probably even more
appropriate for prototyping (but not for big projects, where separate
directories help handle complexity.) It's just amazingly simple and intuitive:
<http://www.sinatrarb.com/intro.html>

    
    
          get '/hello/:name' do
            # matches "GET /hello/foo" and "GET /hello/bar"
            # params[:name] is 'foo' or 'bar'
            "Hello #{params[:name]}!"
          end

~~~
jdminhbg
That matcher syntax is available in Rails 2, and better and more concise in
Rails 3 ([http://www.engineyard.com/blog/2010/the-lowdown-on-routes-
in...](http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/))

match '/hello/:name', :to => 'hello#index'

------
bradleyjoyce
this is pretty much similar to how I fell in love with Rails... I came from a
strictly front-end html/css background.. not too much real programming
experience. Ruby just felt so natural and Rails made the hard parts easier and
the community was so helpful.

------
simplegeek
Well, I respect your choice. I've been playing with Django for some time.
There are things that I don't like and there are things that I like. However,
I'm little surprised as to why didn't you try anything beyond Django in Python
world, please enlighten me--I'm curious?

~~~
snprbob86
I have gone beyond Django in the Python world. I tried Pylons, web.py,
TurboGears, and a few others. I've built apps on Google App Engine and Paste
with my custom "framework" as well as prototyped some stuff with Tornado.

My favorites in the Python world are Google App Engine and Tornado (both with
my bag of helpers). I like both of them because they are both very practical
and embody best practices that I can understand and agree with. Of interesting
note, both of them are fairly minimalistic relative to Rails. I thought it was
the minimalism that I enjoyed (and to some extent, it is), but in reality it's
just that they fit my mental model.

Rails fits my mental model _and_ provides loads of convenience. I'm not saying
that it is a panacea. I'm saying that I was pleasantly surprised by how much,
and in what ways, it differentiated from the Python world.

~~~
mkramlich
If you want a Python-based web framework that's super minimalistic and gives
you maximum freedom I recommend (re) trying web.py. Just use it for that
topmost routing, for example, and the dev web server. You don't necessarily
have to use any other aspect of it. I love Django but whenever I have
something that I think may cause me non-conformity grief with Django (or any
other "big" framework), or, if I just don't have a really solid vision for how
the web app will ultimately look feature-wise, I always start with web.py.
Then sculpt and pivot to taste, only as needed. It's much easier switching
frameworks than languages, in my experience. And being strong in Python buys
you leverage in several other areas that Ruby and the Ruby ecosystem is just
not as strong in (native lib integration, graphical games, scientific
computing, CGI rendering, etc.).

IIRC GAE's Python SDK is web.py-inspired. (And Django.)

------
points
Why is this upvoted to #1? There is very little content here.

~~~
swombat
Controversy, I suppose, judging by the comments.

------
VladRussian
"Pythonistas"? It sounds like female, plural. In case of 2 males shouldn't it
be "Pythonistos"? (anybody with Spanish around?)

I mean, i clicked on the link intrigued by promise of [rare] occurrence of
female programmers expressing their views on Python vs. Ruby, and read the
article somewhat surprised and confused by its tone, style and thought flow -
as it was dude's thinking, not gal's :) It is a misleading and deceptive
advertising practice :)

~~~
mikeklaas
Words that end in -a can refer to both genders, even in latin languages.

For instance, 'barista' applies to both men and women in Italy.

~~~
pdelgallego
AFAIK, you can not apply that in Spanish, You should use the masculine plural
gender to refer to both genders, or when the gender of the people is unknown.

There are exceptions to the rule, like the one above (Zapatistas) or some
professions like "doctores" or "jueces", but they are exception not the rule.
There are also many words that dont have a feminine plural, i.e "las
soldados", "las jueces", etc

~~~
nanairo
Actually you can say "las juesas". :)

In Italian it is true that the last letter is not a perfect indication of
gender... even for people's names (e.g. Andrea should be a male name). But it
works pretty well. Not sure if Spanish is similar (i.e. there are exceptions)
or not.

------
araneae
But I've been resisting it for so long! I can't give in now...

~~~
calloc
Don't. Give them a month or so to start hating Rails. As soon as you attempt
to step outside of what Rails is built for or need some new piece of
functionality it starts falling apart, not only that but Rails is painful to
scale.

~~~
throwawaypyguy
yup i agree, look at twitter and then youtube then twitter and then again back
at youtube.

who scales?

Its no wonder when DHH and 37 signal espouse no features philosophy, since
implementing them is hard and ruby + rails dont help.

You would rarely find any other engineer worth his salt saying that inability
to implement a highly requested feature is a virtue and not a failure.

~~~
kingkilr
You know youtube is a Python shop right?

~~~
njharman
They are contrasting the two.

------
zeemonkee
Really, in startup-land it doesn't make much difference in the greater scheme
of things. If you have the right idea at the right time, and can execute well,
the framework (or lack thereof) is irrelevant. Use what makes you productive -
even if it's just PHP. At the end of the day it comes down to experience and
personal preference, unless the project has very specific requirements (needs
libary x for example).

The only legitimate beef we have as developers is when the choice of tools is
not our own. If that bugs you, go and do your own thing.

------
rohitarondekar
At the end of the of the day everybody has their own style and a framework to
go with it. Some people leave Rails to do Django and vice versa. One of them
just feels natural as compared to the other. Enjoy your preference!

<for-everybody-commenting-here> Internals of Rails 3 are much much more
simpler and well organized compared to Rails 2.x -- I would seriously
recommend getting rid of your fears of "black magic" by diving into the
source. :) </for-everybody-commenting-here>

------
mark_l_watson
Great developers can get good results with any language and any framework -
some tools are just more effective than others for specific tasks. Rails (and
specifically Rails 3) is a great DSL/framework for writing web apps and is
actually not too difficult to follow if you want to browse the source code.

------
code_duck
Ruby is great, but I don't expect to find myself falling in love with Rails
say... hmm, 'ever' sounds good. It's about as likely as getting a Windows 7
tattoo on my forehead.

------
throwawaypyguy
Hmmm, I am some how scared of things that dont reveal their inner working and
still let you build on top.

Infact a major reason i feel people seem to love NoSQL is not because they
have application specific needs which nosql solutions can cater well, but
rather they are too bored to actually learn a useful language/system.

They just want all the "just works" stuff.

This is another reason why ruby seems to be popular with HTML/CSS crowd.

