Feedback on Java Code Generator

"Tim Jowers" <[email protected]>
Newsgroups gmane.org.user-groups.trijug.juglist
Message-ID <[email protected]>
Anyone have input into a Java code generator for quickly putting a database
on the web?  The design mantra is vanilla Java code and KISS. Right now I am
using JDBC metadata to produce a Data Access Object, Value Object (aka Data
Transfer Object), Business Object, and Session Bean (inherits from BO). My
goal is not to reinvent the wheel in O-R mapping but to make something very
simple. KISS. I guess the industry trends are toward frameworks like
AquaLogic or Rails/Grails but this generator simply creates vanilla Java
code so it may be edited by a skilled programmer.

What are the main issues with code generators? Feedback desired.
1. Generated code is unmaintainable. Yes. Seen that many times! Generated
code cannot be customized. So, for now, I'm created quite simply Java code
with no special techniques. Even 1.4 compliant (no 1.5 language enhancements
are being used).
2. Does not fit our framework. E.g. one client is using WebLogic 8.1 which
has source-annotated-comments which pre-dates Java annotations. For them I
might customize the code to be able to generate webservices and EJB's with
the old BEA WebLogic way of doing things. They are considering moving to WLS
10 or maybe JBoss 4.2. The code is vanilla Java code so the programmer can
edit the generated code as needed.
3. Round-tripping. How to generate the code a second time. The present
design I'm advocating is to extend the base class (BO) and edit the new
class. This way the generated code does not conflict with manually changed
code. Any other ideas?


What are the main issues with O-R mapping/mappers? Feedback desired.
1. No support for complex relationships. E.g XMLBeans had no capability to
manage two tables/two object types. I'm using FK and PK metadata to
generated the VO's. I have methods for "shallow" (just the table to object)
and "deep" (all related tables  to a hierarchy of objects).
2. No support for n-to-m relationships. I saw in the Grails presentation
they can create tables based on relational keywords in the script class.
Conversely, I think the n-to-m relationships can be separated into three
categories such as a lookup table (picklist), an n-to-several, and a true
n-to-many. I'm working on defining these further as the real interest is how
they are rendered graphically. I have some db investigation code to make
estimates on these.
3. Does not create a good GUI. I think this is really the main part. A smart
user could edit a database directly, but a dumb user needs calendar and
other controls plus a workflow to make them productive. I presently am
rendering in JSP/HTML and in Flex. I'm  also thinking about how to make a
workflow builder as the workflow objects seems apparent from the
relationships.
4. No support for ad hoc queries. I'm supporting ad-hoc queries by the
creation of a new BO. Internally the VO's which correspond to the tables
used int he query are used.

A few other problems I've run into are:
1. Corporate databases are often not normalized. Lots of examples.
2. Database constraints are sometimes not defined so not available in
metadata.

So far the result is I've been able to make JSP/HTML websites very quickly.
My personal style is I tend to hijack the JSP code and use it in custom
ways. E.g. http://www.gouno.com/ really is very custom HTML/DHTML/JavaScript
but uses the basic Java generated code on the back end.

My other consideration is what GUI framework to support next. I've added
support for REST, JSP/HTML, and some for Flex. I'm wondering what is the
most popular AJAX framework? DOJO? And also for some reason would like to do
a GTK interface since it it a native framework and runs on the major OS's.
Thoughts?

Thanks for your feedback,
Tim Jowers

_______________________________________________
Juglist mailing list
[email protected]
http://trijug.org/mailman/listinfo/juglist_trijug.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.