Rails developers: would any of you find this useful?
scaffoldhub.org
scaffoldhub.org
Given that, I'd love to see the code for these scaffolds directly on the site, with an explanation about what it's doing and why it's doing it that way, as well as the ability to comment on a particular implementation. I would think that type of community-driven peer-reviewed best practices for common feature implementations would be very valuable indeed.
For instance, you want to implement authentication. Right now the best thing you can do is head to railscasts, see what the latest screencast is for authenticaiton. Ah, november 2010. Might as well be ancient history! Perhaps there's a newer, easier, more-accepted authentication gem out there. Or maybe not! You just don't know. So what's next, maybe check some blogs, github, do some date-specific searches on google, etc.
If you or someone else had a site that basically said, "here's the current accepted practice for implementing authentication, and here's why", then that saves so much time!
All I can hope for is that with some community involvement, ScaffoldHub might become something useful in the middle: not in depth tutorials, not a code repository, but a series of helpful working examples.
I certainly can’t do it alone!
My reaction could go from "neat but I have no idea where to start or how to filter what is good here" to "Finally a place where I can learn how good rails people do various things and why they're done that way."
Only time scaffolding comes up in the irc channel, forums, etc, is when beginners ask how they can make scaffolding do X, and the answer is always that you don't, scaffolding is a temporary crutch, just like the name implies. And, experienced Rails devs don't use it, not even temporarily.
So it's probably a completely useless website for experienced Rails devs, while potentially being quite helpful to beginners. An important step towards becoming well versed in Rails is to drop that crutch, though. IMHO, focusing on scaffolding basically keeps you from really immersing yourself in Rails.
Although, this is probably useful to those with not much Ruby/Rails experience.
I think I have attended a session 4 years back (when I was nuby) when one guy taken user requirements and generated rails app in few hours through scaffolds (and I must tell you it was very inspiring). Though it was just a skeleton and not at all production ready, but at least gives sponsors a feel of application what they envision and in turn they provide quick feedback.
So, I think scaffolds are still useful to provide you bunch of useful files, which otherwise you write by hand.
I'm getting the feeling that Rails is bloated.
Lack of boilerplate is one of the things that attracts people to Rails and it is one of the things that keep people there. Scaffolding isn't what provides that benefit. Scaffolding is. boilerplate. What eliminates boilerplate is the "Convention Over Configuration" mentality behind Rails, which is in full force today.
Rails in 2011 is if anything less bloated than Rails was in 2007; post-Merb, it's been made modular and had much of its magic goop factored out.
I'm getting the feeling that you don't do much Rails dev.
The people you speak of maybe didn't stay with it because Rails doesn't really live up to those expectations.
i can write scaffolding from scratch, but i appreciate it as a useful boilerplate for when i'm fleshing out an initial iteration. i can't tell if "i never scaffold" is just vogue or if there really are no use-cases for it if you want to claim proficiency.
the code it generates seems pretty basic, trivial, and even idiomatic. (not a fan of the view code, though)
I still use scaffolds to this day as my first step when building a greenfield app. Of course, I always revisit the code before I consider it production-ready, but it saves me time when taking the first step.
I think we should be careful not to confuse the scaffolds that come with Rails with the more general idea of code generators. Code generators are not bad; it's how you use them. If you use them to generate code that you never intend to review or understand, then yes, they are a crutch. Otherwise, they are a time-saving head-start or a great learning tool.
On top of that, when the scaffold changes, there's no easy way to patch you code. I think in theory what you should do is maintain a log of all of the scaffolding you did, and which commit you did them in, and that way you can just check out that commit, re-run the scaffold, and then merge that back into your tree. But I never remember to do that.
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.
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?
Overall though it does seem like it has the potential to be quite useful.
I don't think I'd ever use a scaffold in a production app though. For that, I'd ether find an appropriate gem or write the code myself.
But you have to take the time to learn from the example, or I agree you'll get nothing out of it.
However, a site such as this, where popular scaffolds could be voted up to the top of a pile might produce some worthy projects.
I can imagine myself using scaffolding when using a gem for the first time, one of the more involved gems like carrierwave, uploadify, or devise. These gems can take a while to get working - you may be targeting a different version of rails than the blog post you find, or you're deploying to heroku and need some custom tweaks - the details can slow you down and make you reconsider whether to use the gem, especially if you're billing by the hour.
If, on scaffoldhub, I could find a scaffold for something quite specific ('rails 3.1 and compass on heroku' or 'devise, haml, coffeescript, simple_form') that would be really, really helpful.
I'd quickly get something working on my dev machine, which saves me frustration and gives the first charge of coding pleasure, an important component to our work. It would enable me to more liberally experiment with new libraries and coding practices.
Perhaps, also, a rake task to generate a scaffold from a working rails app. That way, a scaffold, once working, can be extended. For example, first I install the uploadify scaffold, verify that it's working both locally and in production, then I add compass and devise. I run rake scaffoldhub:snapshot rails_3.0_uploadify_compass_devise_heroku, then scaffoldhub:publish to upload my work.
I hope you continue with the project.
I really appreciate your feedback and encouragement. I definitely will continue working on scaffoldhub; probably my next step will be to open source the web site code (gem is already open) so others can help out on this. I really see this as a community resource - not a private project.
Some sort of voting mechanism, or other indication of popularity/quality would be very helpful. Allowing the best practices to bubble to the top would be very helpful to rails developers in my view.
As others have said, great for beginners or to developers implementing some feature for the first time.
This is what both rails scaffolding and django admin means to me.