|
I don't write much in the way of business application code any more, but if I
did, I would use code generators like crazy. Think about it, whenever you write database-driven
applications, one common denominator is that every database driven project has the database design completed before you start coding.
And then, once you start coding, I'll bet 80% of the code is related to what I
call CRUD ("create, read, update, delete") functionality. And you know
what -- all of this code can be generated, either statically, or more powerfully, dynamically.
What kind of code am I talking about? Simple, all the boilerplate stuff, like these components:
- Java Beans
- Data Access Objects (i.e., the select, update, and delete SQL-based code)
That's where I first started. But then, as I learned more about the approach I realized there were many other components that could also be generated, including:
- Controllers
- User interface components, like:
- JSP's, including "list", "edit", and
"delete" components
- Tables, like JTables and HTML tables
- All forms of configuration files, based on a simple template approach
(including Hibernate configuration files)
In short, what I'm saying is that, if you're smart, and you hate writing the same code over and over again, you can generate all this code from the database design itself, including model, view, and controller elements. Whether you use Struts, Spring, JSP's, servlets, JFC/Swing, Hibernate, or anything else, you can create all the CRUD code you need by generating it from the database.
|