TransPsy has released MetaCoder 1.0, the first open standards code generation IDE using XML and XSLT. MetaCoder enables development, testing and final deployment of code templates (MetaCode) into any of the leading IDE's. Much of the repetitious code common to J2EE projects can be written once and applied project wide using MetaCoder.
- Posted by: Tayo Olowu
- Posted on: July 23 2002 08:56 EDT
An MetaCode implementation of the Data Access Command Bean pattern from the book EJB Design Patterns is also included as a demonstration.
Packaging the MetaCode as a Wizard allows it to be invoked from within the IDE of choice. Metacoder gives developers complete control over the structure and content of the generated code enabling the rapid development of custom code generators that meet their specific architectural requirements.
Most developers experience dissatisfaction with the "donkey work" portion of the software development process, where at least 50% of the time spent coding is expended implementing code that conforms to a standard pattern. Although most development environments now have code generation wizards that alleviate some of this tedium, there is still very little control over the structure and content of the generated code and customization invariably entails the use of a proprietary scripting language.
With the advent of XML and XSLT, code templates can now be captured using W3C standard technology. This affords the widest possible choice of development platforms, skill availability and security in that MetaCode developed using these technologies allows a system to maintain vendor independence.
MetaCoder is a fully integrated MetaCode (XML/XSLT) development environment built using Eclipse technology. It enables the rapid development, testing and final deployment of code templates (MetaCode) into JBuilder, WebSphere Development Studio and Eclipse.
The MetaCoder Development Environment
o A Choice of Template Languages XSLT, Java / W3C interface, Java / JDom
o Syntax Highlighting Editors for XSL, XML
o Context Sensitive Code Assist in both the XML and XSLT Editors
o Line Directed Error Checking
o Code Generated directly into a test environment for final validation
o Direct Database Meta Data to XML import via user defined transform
The Test Environment
o Execute Transforms to Console, Errors shown in Task List
o Generate multiple output files
o Compiling generated Java checking for compile time errors, Errors shown in Task List
o Packaging the MetaCode as a Wizard that can be invoked from within your IDE of choice.
Available for Download
MetaCoder Release 1 full install
MetaCoder plug in for eclipse release 2
To demonstrate the power and flexibility that the generative approach offers, sample MetaCode ranging from J2EE patterns to vb.NET web forms is also provided.
- MetaCoder 1.0, an IDE for XML/XSLT Code Generators Released by Web Master on July 23 2002 22:58 EDT
- Copy & paste? by Tomas Dolezal on July 24 2002 05:47 EDT
- Copy & paste? by Charles Snell on July 24 2002 10:59 EDT
- Copy & paste? by Tayo Olowu on July 24 2002 13:16 EDT
- MetaCoder 1.0, an IDE for XML/XSLT Code Generators Released by David Churchville on July 25 2002 20:24 EDT
- MetaCoder 1.0, an IDE for XML/XSLT Code Generators Released by Ignat Skoryh on July 26 2002 10:01 EDT
- MetaCoder 1.0, an IDE for XML/XSLT Code Generators Released by Stephen Howe on July 29 2002 15:45 EDT
- MetaCoder 1.0, an IDE for XML/XSLT Code Generators Released by Jan Casteels on July 31 2002 09:54 EDT
- MetaCoder 1.0, an IDE for XML/XSLT Code Generators Released by Stephen Howe on July 29 2002 15:45 EDT
Cool - has anyone created a code generation tool to build code generation tools?
Isn't it just a tool for copy & paste style of programming? :-)
I think that there should not be similar or same parts of code in the application.
(It's a joke, but not only a joke - the tool could be misused this way :-) We have some experience with copy & paste experts).
I wouldn't say that the tool is a cut and paste tool exactly. Maybe a cut, paste, and edit pasted tool. Example. Let's say I have a base class that does some basic database functionality (read, create, etc...). I have other classes that extend this base class. These classes want to use the functionality already in the base class, but they each want to do it on a different table in the database. They would each call the same methods on the base class (using the same code, so here's the cut and paste), but they would all pass different parameters to the base class to indicate which table they would want to do the operation on (here's the edit pasted part). You could write all of that common code yourself or use a tool that does it for you. Probably quicker to have it automated using a tool.
I think it´s definately quicker. The sheer amount of JNDI lookups of homes and creation of remotes in large EJB apps is horrible.
Would be nice to have a UML modeling tool that creates the templates for you. Something along the line of TogetherCC where you can user pattern segments (cut&paste) in sequence diagrams to help generate the code.
We are looking into incorporating a UML front end in the next phase of development. Giving credit where credit is due the Data Access Command Bean pattern that the meta code implements is straight out of the EJB Design Patterns book. See top of page for link
Please visit the following URLs, regarding limitation of
DOMAIN-SPECIFIC MODELLING: 10 TIMES FASTER THAN UML
Magazine article in Embedded Systems Engineering (2002)
In my project, I used domain specific model expressed in
XML and then generated EJB/SQL/XML code by using XSLT. We
did not use expensive case tools. Out of approximately 2480
files in the project, 1520 are generated ==> 61% code
The sheer amount of JNDI lookups of homes and creation of
> remotes in large EJB apps is horrible.
What about putting lookups of homes and creation of remotes to some general method whose parameter is a name of the bean? This could be a method of a special class that could also cache the interfaces, etc.
However, I do not say the tool is bad, I just said it can be easily misused. Personally, because of our experience with some "programming consultants", I'm maybe too much sensitive to copy & paste.
I think considering Metacoder in the copy and paste scenario is like thinking of a car as a place to put the shopping - yes it works, but it kinda misses the point! If all you need to do is a single pass of fill in the blanks then you might as well forget Metacoder and program TextPad with a keyboard macro.
In the last major project for which I was responsible, I achieved just under 90% generated code (basically everything except the back end business logic). The transforms - of necessity - were quite complex (certainly NOT just fill in the blanks!) and after taking due time to engineer them properly were pretty clean.
So, is the point that it was quicker to do it this way, than coding them by hand?
The point was that when management changed their minds on me (I lost count of how many times) it cost me minutes not days, because all it required was a model update and a re-run of the transforms.
The question of whether UML is appropriate or not is valid - but not in this thread. UML is like so many things in our industry - not bad, but we could all do a better job if we put our minds to it (at least we like to think so). If someone invents a new modelling system called BINGLESQUIRT, then I'm just as interested to know how I can generate my code directly from BINGLESQUIRT output. But right now, UML is flavour of the month, UML is what my manager sings about, UML is what fills the pages of jobserve so UML is the conversation we're having today. Next month? Perhaps BINGLESQUIRT will make it's debut and we'll be talking about that instead.
So the question for this thread is not "Is UML better than the alternatives?" but "How can we take advantage of a design tool model (whatever it is)?".
As a developer - who has to listen to managers who ask for "little changes" on a regular basis, that of course turn the whole world on it's head - the question I DO want to ask is: "How can I shorten the journey from some analysts design tool to my delivered product?" ...and the answer is (in the case of UML), I can export his ideas as XMI, transform that into my model definition, and transform that into the product.
What if an analyst changes his mind and rearranges all his diagrams? I want to be in a world where I just say "so what?" hit a button and watch the whole thing regenerate in a reliable verifiable form from beginning to end. For the first time in my career I'm beginning to see just that.
My biggest hate in sofware has always been doing the same thing twice. Look through the hype: the reality of application code re-use got about as far as the C runtime library and pretty much stalled after that. The more people talk about it, the less they do it. Now I'm FINALLY seeing a way to solve a problem once, and once only.
The next step is for me to write an absolutely killer generic transform that can model all my output and then I can retire altogether! 8-)
Reviewing the EJB Design Patterns MetaCode downloadable at http://metacoder.info might help clarify things. The zip file contains html documentation, an XML Model, XSL transforms and generated java source files. Having considered the sample I feel confident it will help dispel concepts of cut and paste programming
In our project of J2EE based Network Management System(NMS)
I applied XML based model driven programming paradigm with
code generation support by XSLT. Please note the fact that
due to highly customized nature of XSLT based program
generator, we achieved 61% code generation.
The article link is as follows:
I started a thread previously on the good, bad and ugly of meta-data based code generation in the Patterns section on TSS:
My personal opinion is that especially for J2EE apps, a good code generator is worth its weight in gold.
Metacoder seems to be a generic toolkit/IDE for creating code generators using XML as the metadata, as opposed to dictating any particular *framework*. So anyone who likes to complain about the code produced by a code generator would have only themselves to blame. Scary, isn't it?
I think its a pretty good idea, but I suspect that without providing the frameworks themselves (ie. an "add-on" package for Struts/EJB/Data Access for Oracle, etc), this will be a tough sell. Programmers (and I speak for myself here as well), are just lazy enough to avoid "tools" that require too much thinking to make them useful.
I don't understand how this tool differes from command-line xslt transformer? I believe that the most difficult part of the code generation tools is the friendly user interface that allows editing of xml data.
Whether creation of templates repository considered?
Currently I work with CodeCharge Studio to generate Java Web Sites. Although all xslt templates are encripted and I'm unable to change them, templates provide a lot of usefull functionality, and able to solve almost all common problems of Web development.
Having started out my code generation experience using a command-line xslt transformer I can tell you the advantages that I found using MetaCoder so far.
There are a number of features in the editor that I have found useful such as. The obvious colour highlighting of the model and transform but also xsl code completion type in "<xsl:" and your give a list of xsl functions. Automatic end tag completion type "</" and the appropriate end tag is indicated.
But for me there are 2 features that made the switch from command line worthwhile.
1 Because Metacoder is also Java IDE when you transform out your Java classes they are compiled automatically. Compile errors are highlighted and can be navigated to and fixed in your transform quickly.
2. You can turn your transforms into wizards that can be plugged into your IDE I've done this with JBuilder5 & 7. So bringing the world of code generation to other developers in the organisation is a simple process. Copy the Jar that Metacoder creates into the IDE and the wizard is then available in the new class pallet. Developers don't have to understand XSL or have a command line tool to run your transforms. They use the IDE that they are used to and you provide the wizards to create the patterns,templates etc.
There ANT integration is a missing feature to make it accepted by a large number of developers.
This is necessary in case people do not use an ide for the build but ant.