Hacker News new | ask | show | jobs
by Tichy 6149 days ago
While it works well enough for Rails and maybe now also Ubuntu, in general I am wary of generators. Seems to me if there is a need for a generator, it could be a sign that the framework is unnecessarily complex. Since the required configurations and whatnot can apparently be generated automatically, why expose them to the user at all?
2 comments

I don't know about Quickly or Glade, but Rails doesn't really use generators in the way you're thinking of. What Rails calls generators are more like the new project wizards or new class wizards,etc. most IDE's like Eclipse, etc. They create a couple of files with the skeletal outline of the required structure, etc.

It's not like some of the "enterprise" java tools that generate thousands of lines of incomprehensible code.

I admit my anti-generator attitude came from experiences with Java. But even with Rails I have problems to remember all the parameters for the generators. (OK, an IDE could help - but if I need an IDE to be able to cope, I am treading close to Java territory).

As I said, it seems to work well enough for Rails, but I am also not 100% in love with it. It worked especially well for the initial "write a web app in 5 minutes with Rails" hype, but seems less useful in practice.

In practice people don't use scaffolding. It's good generating an initial skeleton but you're generally recommended to only use that as a starting point for implementing your own interface.

No, what makes Rails so great is not the scaffolding or the generators. It's the philosophy of Don't Repeat Yourself and having a smooth learning curve, and how everything in it reflects that philosophy.

If it generates a lot of code, then yes. But it may also just generate 2-3 lines of boilerplate code that's very annoying to keep typing over and over.
If you need to type the same thing over and over, something's usually wrong with what you're doing...
Yeah, you're not using a framework.
When defining a class you need to: - Create a new file for the class. - Type the class keyword - Type the class name. - Type the parent class name. - Type the constructor definition. - Type a call to the parent class's constructor.

This is all boilerplate and can easily take half a minute. How am I doing things wrong? Are you saying there's an easier way?

Or I can just type something like "./script/generate class Foo Bar" and be done with it and save like 15 seconds.

Yeah, that's actually a pretty odd way of doing things. In perl with moose (or just perl6) you just type 'class Foo Bar' in your file and you're good to go.