
From Python to Ruby: Mind Blown by Rails, the Framework - josephmosby
https://gist.github.com/4264437
======
tptacek
Scaffolds are a dead end. Learn to work without them as quickly as possible.
Idiomatic modern Rails code is simple and lightweight and doesn't require
boilerplate.

~~~
nanijoe
So does idiomatic modern rails not use generators? I believe the way to begin
a new rails project is with the command "rails new {insert project name} ",
which umm....generates a ton of boilerplate code.

~~~
nwienert
He didn't say anything about generators, just boilerplate, which is what
scaffolding does. Most other generators are quick, easy and don't generate
boilerplate.

------
michaelfeathers
It took me a little while to realize that he meant something vey different
when he said "Rails is fast. Mind-blowingly fast."

~~~
cheald
Well, development speed has always been its primary selling point. The reason
folks like it is because "Here is common task that you expect to take two
hours, and in Rails it's 2 lines of code and you're done."

It's pretty damn awesome to spend all day writing business code rather than
support code.

~~~
josephmosby
> It's pretty damn awesome to spend all day writing business code rather than
> support code.

One-thousand times this. I've had some headaches with gems (chronicled
earlier), but if you're building an app with minimal add-on gems then
development speed is incredibly fast compared to other frameworks.

~~~
cheald
You're still in the "not-yet-over-the-hump" phase, but my experience with
Rails has been that you'll hit this point where it all just clicks, and
suddenly you're off to the races.

It's fun to see you chronicle your journeys from the perspective of someone
totally new to the language and framework. Please keep it up.

------
Niten
I am by no means a Microsoft fan or Windows developer, but if auto-generated
code is that big of a deal to the author then he really needs to spend some
time playing with Visual Studio...

~~~
nahname
Rails generators create the code you would write anyways. The MS generators
created technical debt. Highly duplicated, ridiculous inclusions, questionable
formatting and regions by default. It literally generates a code sample of
what not to do if you want to write good code in C# (presumably VB as well).

~~~
bdcravens
ASP.NET MVC is really lights years ahead of other ways of building .NET apps,
and is conceptually close to Rails in many ways. (Alas, its backstory is very
OSS and un-Microsoft)

~~~
nahname
Some of the generators for MVC are getting closer to rails. They are still
pretty painful. T4 templates (commonly used in some of the nicer generators
from nuget pacakges) requires EntityFramework. Furthermore, the templates
themselves are very temperamental to create (tabs are not adhered to, nor
spaces).

The real reason rails generators work so nicely is that most of the components
are known. MS pushes entity framework hard, but it isn't included by default.
If you don't know what IOC is being used you cannot generate a controller. If
you don't know the ORM, you cannot generate a model. Don't even get me started
on the fact that most of the community doesn't even use either of those two.

------
tangue
How could someone start Python programming with webapp2 ? This is weird. Of
course Rails felt like an improvement for him.

~~~
josephmosby
Actually, I started with Django, then got pissed off because trying to twist
Django around to do something non-traditional gets messy fast. webapp2 is
spartan by comparison and makes you do more extra work, but at least you know
what you're getting into because you have to write a lot of it yourself.

~~~
dguaraglia
First of: I'm trying to be helpful, not a fanboy.

Where did you get stumped with Django?

I use Django to do all kinds of "non-traditional" stuff (key-based API
authentication, automatic object-level caching, custom form fields, using
Postgres features such as UUID fields and fulltext search) and none of it took
me that much work. But then, I've been using Django for a few years now and
know the ins and outs quite well.

I can see how you'd be enticed by a simpler framework such as webapp2 or Flask
as a starting point. But I've found that Django is as flexible if you just
consider that most of the built-in features that Django provides (even the
awesome ORM) are optional if you know what apps and middleware to disable.

~~~
josephmosby
> if you know what apps and middleware to disable.

And when I was learning Django, I didn't know this. I moved to webapp2 because
I could put only what I wanted in an application. I'm sure that if I sat down
and re-dedicated myself to learning Django like I'm doing with Rails, I might
have a better time at it the second go-around.

~~~
dguaraglia
Yes, I know. It took me a long time to understand Django the way I do today. A
great starting point was James Bennett's 'How Django processes a request'
blogpost [1]. From there you'll see how Django is just a tiny wrapper calling
a bunch of increasingly complex applications that build on top of each other.

There should probably be a chapter on the tutorial with a simplified version
of that. It'd help newcomers understand where everything fits.

In any case, I'm glad you found a tool that does what you need _as long as it
isn't written in PHP_ :P

[1] [http://www.b-list.org/weblog/2006/jun/13/how-django-
processe...](http://www.b-list.org/weblog/2006/jun/13/how-django-processes-
request/)

------
keeptbluesideup
interestingly enough, this is how i felt when going from rails to
python/django.

i felt like i had much more control and the admin section really sold me.

rails always felt a bit "too magical" for me. I could get anything done, but I
didn't know why or how. I didn't feel like I was getting much better as a
programmer. With Python, I felt like I was getting better after the first day.

------
tbatterii
so the author discovered ROR scaffolds, and was able to craft a potentially
controversial headline. Congrats getting to the front page of HN. :)

------
pimeys
I started to love Rails because of this and I still do. I get my bread and
butter with Rails and I love my work because of it (and of course for the
challenges). Four years and counting...

One of my biggest annoyances though is the really REALLY hard upgrades between
different Rails versions. 2.x to 3.x was several days project including
testing etc. 3.0 to 3.1 or 3.2 adds the nice assets pipeline, which of course
might brake some javascript if you have lots of legacy there.

A minor change in ActiveRecord (and minor Rails upgrade) changed the behaviour
to use SHOW INDEX instead of describe before loading data. The result was
hazardous. So when you start to have lots of traffic, be very careful when
upgrading Rails itself. And read the changelogs and the diffs.

~~~
hayksaakian
I would honestly rather have this than the situation with python and django.
While its awesome they're supporting python3 in 1.5 that took longer than I'm
comfortable with.

What I've learned with rails is that the minor version you start a project
with should stay the same for the sake of your sanity, until after project
completion. Concerning yourself with incremental improvements should be
avoided until you are between major versions of your own codebase.

------
aren55555
When I first started Rails I too was impressed by the scaffold generator. Now,
as a more advanced Rails developer, I find myself only really generating
Models, Migrations and Resources. View and Controllers are almost entirely
written from scratch. As per the point about the speed of development - I
found that I continued to get faster and faster as I started to understand the
configuration magic of Rails and how to harness the power of gems as part of
my workflow.

I must admit that Ruby on Rails was the first web framework I learned. Since
then, I have dabbled with Python's Django, PHP's CakePHP and even Express on
Node.js. What I tend to find is that other MVC web frameworks seem to be
imitating Rails - so rather than use a follower I just stuck with the leader,
Ruby on Rails. Until there is a much better alternative (looking at you
Meteor/Node.js frameworks) I will be a happy Rails dev.

------
pbreit
That was the thing that really bothered me about rails: why do I need so much
boilerplate/scaffolding code that I need a CLI to generate such?

Web2py has its faults but in terms of "speed" as defined by op, it is
considerably "faster" and with almost no boilerplate/scaffolding.

------
hayksaakian
Scaffolds show you the conventions, and its up to you to expand from there.

You quickly end up having to push the boundaries of what scaffolds can do for
you as you work on the finer details of a project.

I'd also like to give credit to bundler for making my life simple and saving
me from dependency hell. It was a life altering experience coming from .jar
file management to meet the magic of bundler.

------
Shorel
I once wrote a C++ scaffolder in Lisp.

It's amazing to have one of these. But it's even more amazing to code one
yourself. Everyone should do it.

Right now I want a Lua Rails like framework (I'm always interested in raw
machine performance).

It seems Orbit (<http://keplerproject.github.com/orbit/>) is what I am looking
for.

------
Trufa
Django too seems to make things specially hard for beginners, I'm not sure why
that is. I don't mean the getting started part, the doing something useful by
yourself part after the tutorial.

~~~
josephmosby
IMO, Django's great if you want to make something regularly published (i.e.,
blog, news site, etc.). But you have to get creative quickly if you want to do
something else.

I eventually jumped to doing more webapp2, and I know there's a devout Flask
community as a Django alternative. Haven't played with enough Flask to say
anything yea or nay for beginners, though.

~~~
clicks
> and I know there's a devout Flask community as a Django alternative

Really? Tell me where the Flask community is.

I actually regretted my decision of choosing Flask over Django after 2 months
of working with it precisely for that very reason.

You can find tons and tons of tutorials, docs, writings about best practices
from others, crowded IRC discussions, etc. for Django -- not so for Flask. But
maybe I'm mistaken? I'd love it if you clue me in as to where all the Flask
people are hiding.

~~~
dvanduzer
I'm not sure what you're looking for in a crowded IRC discussion. The
signal/noise ratio in #pocoo is quite good. Stop by sometime.

------
YuriNiyazov
josephmosby: In my comments to your previous article I said that my efficiency
in Rails smokes my efficiency in everything else.

Now you know why. A lot of people zeroed in on your admiration of scaffolds -
I really liked scaffolds when I first started out too, but I don't use them
very much anymore. The other features of Rails that you will eventually
discover are equally fantastic, and much less controversial

