4 ms·
> What's the benefit over a well architected library? Especially in a language like Ruby where it's so easy to write DSLs, I don't see where you'd ever want a s
by adriand 15y ago
> What's the benefit over a well architected library? Especially in a language like Ruby where it's so easy to write DSLs, I don't see where you'd ever want a scaffold.
The benefit, I think, is that scaffolds:
* generate a pile of code that you feel free to hack away at, removing and adjusting as you see fit. I don't think scaffolded code is a good candidate for patches, really. It's a shortcut that writes code for you, not a library.
* generate code that is customized to your precise needs. For example, when you scaffold something using Rails' default scaffold generator, it creates a database migration and builds the appropriate form fields based on the columns you're using in the model.
* are great for generating the kind of code you tend to write over and over. For example, we do lots of custom website development, and a common requirement is the forms for CRUD related to the entities people are managing on these websites. The problem is, the entities are always changing. For an auto dealer, the entities are vehicles, makes, models; for a real estate brokerage they are brokers and properties; etc. We would previously cut and paste code and then modify it, but then we wrote a scaffold generator that builds all the forms for us with all of the appropriate structure and CSS classes and IDs to make them look beautifully integrated.
- erikpukinskis 15y agoI see. So, sort of like a sculptural "chip away everything that's not an elephant" kind of approach. That makes some sense. I think the "custom generated code to mee your precise needs" category is exactly where I think scaffold writers are just lazy library writers. If there's a way to parameterize the scaffold experience, there's a way to create a parameterized library that "scaffolds" your code without generating a bunch of boilerplate. On the last point: I think that makes a lot of sense, especially if you're working for clients. They want to end up with a complete, hackable site that doesn't have some weird dependency on a meta library. (like a library with meta-forms, meta-models, etc) I guess I'm biased because I work on one big piece of software, so that kind of duplication would be heresy. That said, if you tried to write a unified framework that let you build sites like that without a bunch of generated scaffold... you might end up building the next Rails! Isn't that where Rails came from?