Hi --
For every tutorial that uses scaffolding, there's an article that says
you shouldn't use it in real websites. Supposedly it just serves to
"sketch things out quickly", "test database connectivity" and other
stuff. Some say you're not even supposed to use it and then edit it
later. I don't get why.
What is it about scaffolding that makes it virtually useless? It
generates some code; surely I could just expand on it or "fix" what's
wrong with it later, right? Apparently not. How is it different from me
making my own CRUD base files and copypasting it into every project?
I just don't get it.
Here are a few problems I've seen, and continue to see, with the
scaffolding.
It leads people to think that Rails is going to be dead easy, and then
they get frustrated or disappointed when it turns out that developing
a Rails app is real development and real programming.
Although it pertains usually to the beginning stages of an
application, it does not play well with the beginning stages of
learning Rails. It presents way, way too much code to be useful to
beginners. The controller files can be a useful "cheat-sheet" for REST
idioms, but only once the basic techniques and principles are
understood.
As you point out, the scaffolding makes you tweak things and remove
wrong things, instead of developing what you actually need. It turns
development into sculpture (remove everything that isn't your
application!), and introduces anxieties about whether you're doing
something wrong because you're changing something fundamental about
the scaffold code, etc.
It presents a very rigid and specific context for the idea of a
"resource" (in the REST sense), which then impedes people from gaining
a broader understanding of what a resource can be. For more on this
problem, see:
http://dablog.rubypal.com/2008/3/23/splitting-hairs-over-resource
http://dablog.rubypal.com/2008/4/24/splitting-hairs-over-resource-part-2
I agree with the point that others have made that if you know exactly
what the scaffolding provides, and you've got a situation where that's
exactly what you need, there's no harm in using it. If those
particular boilerplate files happen to coincide with what you want,
that's great. Otherwise, I'd avoid it. There's no reason to give it
first refusal of your development space, just because it's there.
David