This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Code Generation - Opinions Please? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Code Generation - Opinions Please?" Watch "Code Generation - Opinions Please?" New topic
Author

Code Generation - Opinions Please?

Levent Gurses
Greenhorn

Joined: Apr 08, 2002
Posts: 25
Hi,
I am slowly starting to like the idea of putting deployment descriptors alongside the Java code. I was lately looking at XDoclet and it's amazing how much time can be saved by writing relevant deployment information inside Java source files. For example one can put deployment descriptor tags(XDoclet tags) inside the EJB source code and have the tool generate the remote interface, the home interface and deployment descriptor files. In a way it's the ultimate non-repeating coding technique.
But on the other hand, it looks like the code is being littered with pieces of non-Java constructs. These are not traceble and clutter the interface.
One more thing is that the XDoclet tags need to be defined, so another layer of indirection -> learning curve.
Eclipse is doing a terrific job in Java tracing and refactoring. I wish it had a feature to enable/disable viewing XDoclet code, or mark them as blocks that can be expanded(VisualStudio style). It can also be improved as to add tracebility bu linking XDoclet tags just as it does search classes. Or add "Find references..." type search capability...
These are just couple of ideas that need to be collaborated...
One of the example projects written with XDoclet is XPetstore
I'd like to hear what you think of the idea of mixing DDs with Java code, and if you know of any good plugins for Eclipse(I tried JBoss IDE, but seems it's not supporting Eclipse 3.0 M1)
Levent Gurses
Consultant


Levent Gurses<br />Jacoozi - New Generation E-Solutions for >> Thinking Companies<br /><a href="http://www.jacoozi.com" target="_blank" rel="nofollow">http://www.jacoozi.com</a>
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I haven't tried this myself but there's xdoclipse at sourceforge...


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
Lomboz uses XDoclet to build the deployment descriptors.


Matthew Phillips
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

I've seen hints that an XDoclet-style approach may make its way into the basic Sun JSK. Some of the things that routinely have to be done in Java are pretty mindless (like defining propery accessors), so might as well cut the grunt work.


Customer surveys are for companies who didn't pay proper attention to begin with.
norman richards
Author
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
Originally posted by Levent Gurses:

But on the other hand, it looks like the code is being littered with pieces of non-Java constructs. These are not traceble and clutter the interface.
One more thing is that the XDoclet tags need to be defined, so another layer of indirection -> learning curve.

Let me suggest an alternate perspective. Instead of thinking of XDoclet as cluttering your code with unrelated constructs, I think of it as keeping related pieces of information in one place. It's an issue of locality and eliminating redundancy. Do you want to work with 5 Java classes and a deployment descriptor or work with one class that captures all of that information. Do you want to make 1 update or 5 updates to effect one change?
I don't see your point about traceablity. Changes can be tracked in your revision control system easily. The really amazing thing is that all the changes to a class can be viewed together. You don't have to look at diffs on 5 separate files to track a change, you can look at one file. You don't have to correlate changes in the deployment descriptor to changes in the class. It's all local.
Levent Gurses
Greenhorn

Joined: Apr 08, 2002
Posts: 25
Here are couple of XDoclet-related things I would like to see in Eclipse:
1. Code layers - a Photoshop-like layers where portions of code can be placed on different layers. When put on a layer the XDoclet code can be formatted and made invisible. The layers can even support images to support UML diagrams in the code[on a different layer].
2. XDoclets to be made tracable - this means that one can Ctrl+Click or F3 a given tag and Eclipse would show the DTD or Schema associated with that tag. It's the same as showing the source of a Java method. That would reduce the learning curve and provide instant helkp on the usage of the tag.
3. Code completion for XDoclet tags
Thanks for the responses.
norman richards
Author
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
I am not an eclipse user, but we did docuement using XDoclet in eclipse for the XDoclet book. JBoss IDE (a plugin for Eclipse) has nice XDoclet support, including XDoclet completion. There are some other plugins with XDoclet support, but the JBoss one seemed to be the best of the ones I tried.
Levent Gurses
Greenhorn

Joined: Apr 08, 2002
Posts: 25
Just found out that JBoss IDE has a code completion feature. That helps a lot. I saw your book on amazon.com but it was still not available. Thanks for the insights. Levent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Code Generation - Opinions Please?
 
Similar Threads
XDoclet 1.2 vs XDoclet 2
To authors
Developing your own templates and subtask with XDoclet
XDoclet and metadata JSR's
XDoclet and JSR 175 Java MetaData