Comment: Role of Scaffolding Going Forward

A public service announcement: Since the release of 2.0, there have
been numerous questions on the list regarding scaffolding. I attribute
this to two factors:

  1. Almost every tutorial uses scaffolding for up-and-running kind of
    instant gratification
  2. There are some cases where scaffolded CRUD is adequate and devs can
    focus on more important issues

As of 2.0.x, scaffolding is extracted to a plugin. Moreover, “classic
pagination,” on which scaffolding depends has also been extracted. So,
to get any measure of the 1.x dynamic scaffolding behavior, you have
to install the two plugins.

It may seem like you’re just hunky-dory with scaffolding if you do a:

script/generate scaffold person

but that’s not quite what you might expect. Yeah, it works, but your
people index action produces a list that is not paginated. That’s a
behavior shift from the 1.x scaffold that utilized pagination.

Ok, to the point of this post. Rails Core has driven a stake in the
ground by extracting scaffolding. My interpretation is that they don’t
expect to enhance scaffolding, but would prefer to leave it to people
who like/use scaffolding.

I don’t use scaffolds at all, but have sympathy for anyone getting
into Rails who runs square into a brick wall right at the start of
their “introduction to Rails” tutorial. Thus, I have these
recommendations:

  • Use Rails 1.x to work through the tutorials if that’s an option. If
    you don’t none of the automatically generated code will look remotely
    similar to the 2.x stuff. -or-
  • Read the tutorials about the scaffolding but don’t type in any of
    the code because it’s likely not to work in 2.x, then take the
    concepts you learn from your quiet-time reading and apply them to a
    2.x project. -or-
  • Repeat the previous step and then look into something like the
    ActiveScaffold plugin (http://activescaffold.com/). Again, the code
    will not look like what’s in your tutorials, but at least
    ActiveScaffold hasn’t been pushed off into the weeds. -or-
  • (Not recommended) Use Rails 2.x, and install the scaffolding plugin
    (script/plugin
    installhttp://dev.rubyonrails.org/browser/plugins/scaffolding)
    and the classic pagination plugin (script/plugin install svn://
    errtheblog.com/svn/plugins/classic_pagination).

So many choices, so little time. What to do? I suggest reading
quietly, then blundering around with 2.x until you feel comfortable
that you’ve gotten a “hello, world” working without the safety net of
scaffolding.

I hope this helps.

On 1/11/08, s.ross [email protected] wrote:

I suggest reading quietly, then
blundering around with 2.x until you feel comfortable that you’ve gotten a
“hello, world” working without the safety net of scaffolding.

I agree. Skip it. Waste of time to learn it or use it.


Greg D.
http://destiney.com/

Hi Greg,

Greg D. wrote:

Waste of time to learn it or use it.

I disagree. One of Rails’ fundamental differentiators is ‘convention
over
configuration.’ Until 2.0, scaffolding has, IMHO, played a key role as
a
concrete example of that differentiator. Not only has it given newbies
a
‘leg up’ in terms of productivity, it served a role in familiarizing
them
with Rails’ naming / coding conventions. I personally am very sorry to
see
it relegated to a lesser role.

Best regards,
Bill

On Jan 13, 2008, at 10:09 AM, Bill W. wrote:

them
with Rails’ naming / coding conventions. I personally am very sorry
to see
it relegated to a lesser role.

Best regards,
Bill

I agree that convention over configuration is a key to finding your
way in Rails. I’m not so sure I buy the notion that scaffolding, and
particularly dynamic scaffolding, help infuse people with that
convention_fu. Given the fact that static (script/generate scaffold)
is still around, anyone who wants to see the new an even keener way of
scaffolding hello world can do:

$ rails hello_world
$ script/generate scaffold hellos

In terms of productivity, my experience is that scaffolding can be a
two-edged sword. On one hand, you can show something that works right
away. Clients think you walk on water. The crowd cheers. Then everyone
waits while you really learn Rails and hammer out the details. And
they wonder why it’s taking so long – after all, you were so
promising your first day on the job. And the crowd goes quiet.

There are, as I said in my original post, several scaffolding plugins
that really get the job done. I don’t use scaffolding but if I needed
it, I would turn to ActiveScaffold or something like that before than
I would turn to the Rails plugin. Similarly, I would look to
will_paginate (svn://errtheblog.com/svn/plugins/will_paginate) or
paginating_find (Welcome cardboardrocket.com - BlueHost.com).

One alternative that I should have stressed in my initial post is the
extraction of certain repetitive code patterns as embodied in the
make_resourceful or resource_controller plugins. They do build
convention_fu, while at the same time allowing you to get your job
done in less time.

This is all, again, just my $.02.

–steve

I believe there needs to be more tutorials about 2.0 to drown out all
the
ones that use older versions.

On Jan 14, 2008 3:22 PM, s.ross [email protected] wrote:

concrete example of that differentiator. Not only has it given
I agree that convention over configuration is a key to finding your
two-edged sword. On one hand, you can show something that works right
paginating_find (Welcome cardboardrocket.com - BlueHost.com).


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.