Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Code Generation - Opinions Please?

 
Levent Gurses
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't tried this myself but there's xdoclipse at sourceforge...
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lomboz uses XDoclet to build the deployment descriptors.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18019
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
norman richards
Author
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic