Wonder Machine Enterprise Edition
CONTENT
INTRODUCING THE WMEE
WHY USE A CODE GENERATION TOOL
GENERATING YOUR J2EE™ APPLICATIONS
CONCLUSIONS
SUPPORTED TOOLS
INTRODUCING THE WMEE
The Wonder Machine Enterprise Edition is a Java™ code generation tool that generates rock-solid J2EE™
applications from UML™ domain models and existing database schemas. It supports the leading application
servers and databases and permits you to develop your internet applications using significant standards
such as UML™, EJB™, XML, JSP™, Struts, ... more easily, more stable and faster with a much shorter
time-to-market.
The application generated by the WMEE can be compiled and deployed with your favorite EJB™ application
server, using the generated ANT files, after which it is ready to be executed. It is very important
to notice that the generated application is fully executable with the possbility to create, update and
remove the persistent objects drawn in your UML™ model. The WMEE does not just generate empty method
declarations like many other software tools but a complete J2EE™ application including all the files
needed to run it. Developers will have to care less about the difficulties of the J2EE™ applications
they write and be able to concentrate on implementing the business logic. This without decreasing the
flexibility of writing code manually thanks to the unique merging algorithm of the WMEE.
WHY USE A CODE GENERATION TOOL
Developing J2EE™ Software Applications
When developing a software system the same steps are always performed. First the problem is
analyzed which results in a UML™ domain model and some architectural choices are made. After this
a design is created and the implementation can start. This means developers will manually write
code for the backend, a GUI, build files, connectors ...
When writing J2EE™ applications other problems occur like e.g. getting an EJB™ Application Server to
work for the first time. The effort needed for this shouldn't be underestimated because of the
vendor specific parts in the implementation of the Application Server.
It doesn't really matter which methodology is followed when creating a software application, the
greatest effort goes into the manual writing of code. Therefore it is obvious that using a tool
like the WMEE, which drastically decreases the amount of code that has to be written by hand, will
reduce the effort and the cost needed to finalize the application.
The benefits of the J2EE™ architecture, an industry standard with implementations by many different
vendors, are numerous. It delivers a very scalable solution for internet applications, several
services like transaction and security control and so on.
Unfortunately there are some drawbacks to producing J2EE™ applications. The architecture is quite
complex which makes the learning curve rather long. A lot of code needs to be written for the EJB™
classes and interfaces, connectors, value objects, ... but a great deal of this code can be
generated for you by the WMEE.
Using the WMEE
The Wonder Machine generates rock-solid J2EE™ applications from UML™ domain models and existing
Database schemas, supporting the most important Application Servers and Databases.
It accelerates your EJB™ development by generating a full executable EJB™/RDBMS architecture out of
UML domain models supporting iterative construction with an intelligent code merging algorithm.
Furthermore it delivers automatic JSP™ (XML & XSLT) GUI generation without writing a single line of
code. The WMEE supports ANT build management and generates EJB™ deployment descriptors.
Each software application, following the same architecture such as J2EE™, contains an amount of core
code that is identical for all applications.
Another part of the code that has to be written can be found in returning code patterns. These are
very similar but will have to be rewritten for every application. Of course each application has
its own application-specific code containing the business logic. Before a software engineer can
start writing this real business logic a lot of effort goes into the core code and returning code
patterns.
When using the WMEE the core code is delivered in a separate, open-source library, and the returning
code patterns are generated. This means developers can concentrate on the application-specific code
and on writing real business-logic from start to finish. The intelligent merging system will manage
the multiple development-analysis iterations.
Analysts will draw a UML™ model in their favourite case tool and use this tool to create an XML
application descriptor. The WMEE generator uses this descriptor to generate the returning code
patterns and the developers can add the business logic to the generated application.
As the development process continues the model will be updated and expanded and the application
regenerated. The merger will see to it that, if needed, the generated code is also updated and that
the business logic, written by the developers, remains unchanged.
The classical EJB™ development process starts with making an analysis leading to a UML™ domain model
identifying the different objects in the application. This domain model is refined into the
different classes and interfaces needed during the design in which also several architectural
choices are made.
After the first analysis and design phase the implementation of the created models can start.
Developers will manually write Java code, XML deployment descriptors, SQL database scripts and so on.
When a first version of the implementation is ready it can be deployed in the EJB™ server which is
done automatically by the application server.
When using the WMEE the "analysis and design" phase can be limited to analyzing the problem and
creating a UML™ domain model. This model is used as input for the generator which automatically
creates the correct interfaces and classes, without the need to design them, using the right
architecture.
Developers should add the business logic code to the generated application while other files like
XML deployment descriptors and SQL database scripts are also generated.
It is obvious that using the WMEE for your J2EE™ internet applications automates a great deal of the
work that should be done delivering a better time-to-market and drastically reducing your production
costs.
GENERATING YOUR J2EE™ APPLICATIONS
UML™ Domain Model
When generating a J2EE™ application using the WMEE, the first step is drawing a UML™ domain model in
your favorite UML™ case tool.
The WMEE comes with plug-ins for several case tools. This means it is possible to keep working with
the tool you are used to and don't have to switch to some graphical tool delivered by Sygel.
The UML™ model augmented with stereotypes and tagged values, added by the WMEE plug-ins, contains
sufficient information to generate a J2EE™ Architecture. The case tool will export the domain model
to an XMI™ (XML Model Interchange) file which is a standard way to represent a UML™ model in XML. This
format can be used as input for the code generator.
What is generated ?
The WMEE will generate a fully executable internet application following the J2EE™ architecture.
The application can be made accessible over the internet via a standard web browser. The user
interface follows the Model View Controller (MVC) pattern which is provided by the Struts
framework from the Apache Software Foundation. In the MVC design pattern, application flow is
mediated by a central servlet controller. The controller delegates browser requests to an
appropriate handler. The handlers are tied to a model, and each handler acts as an adapter
between the request and the model. The model represents the application's business logic. The
control is usually forwarded back through the controller to the appropriate JSP™ view. This
provides loose coupling between the view and model, which can make an application significantly
easier to create and maintain.
To transform the data (retrieved from the model) into the correct presentation format a custom
JSP™ Taglib is used which uses XSL-T to convert the XML from the model into HTML or any other
layout.
In the EJB™ layer facade session beans reside which will be accessed by the controller from the
GUI MVC pattern. These session beans encapsulate the entity beans and return value objects.
Value objects are used by the clients for performance reasons and they can return their data in
XML format.
The database layer consists out of a relational database using foreign keys for the relationships
between the different business objects.
The WMEE will generate all interfaces and classes for the Java™ EJB™ pattern. For every object in
your domain model you can specify if it's an entity bean, a dependent object or a dependent value of
an entity bean or a session bean controlling access to one or multiple entity beans. Home and
remote or local interfaces, bean implementation classes, connectors, value holders, ... are all generated by
the WMEE.
Each business component, drawn in the UML™ domain model, has a XML representation via its value
interface. A JSP™ can display this component via a XML & XSLT custom taglib. Actions will
be delivered to the EJB™ back-end via the Struts framework.
The generated front-end can be used to immediately execute and test your generated application.
The standardized XML EJB™ deployment descriptors are also generated out of the domain models. Each
application server has its own proprietary deployment descriptors and therefore the WMEE supports
the most used application servers and generates these deployment descriptors as well making it
possible to compile and deploy the generated application immediately.
An overview of the supported application servers can be found here.
Furthermore the WMEE will generate an SQL script to initialize the relational database used to store
your persistent information.
An overview of the supported relational databases can be found here.
XML Ant build files are generated, not only to compile the Java™ code but also to
deploy the application with the application server, execute the SQL script to initialize the
database and so on. These files can, just as well as any other generated files, be changed and
merged so e.g. hand-written Java files can be easily added to them.
Adding Business Logic
To add a business method to the generated J2EE™ application the method should first be assigned to
the correct object in the UML™ domain model. The WMEE will generate a signature of this method in
the interfaces where needed and an empty method in the bean implementation class. This is achieved
without breaking the possibility to compile your application after generation.
Each generated line of code starts with a unique ID which identifies the line. This ID is used by
the intelligent and unique WMEE merging system. User code can appear anywhere between the generated
lines of code and is not limited to predefined blocks identified by start and end comments.
It is possible that every now and then a developer would like to see that a generated line of code
would be implemented slightly different and this is also possible since every generated line can be
commented and replaced by a user-written version.
This system assures that developers can use the WMEE without losing the flexibility of writing
complete applications themselves.
This principle is not only applicable for generated Java™ files but also for any other generated
files like XML deployment descriptors and Ant build files, XSLT style sheets and so on.
Reverse Engineering
The WMEE offers the possibility to convert an existing database schema into an XMI™ file, using the
WMEE console, which can be read by a UML™ case tool. All an analyst has to do is augment the UML™
model with the WMEE stereotypes and tagged values in order to generate a J2EE™ application.
This means a fully executable J2EE™ architecture can be generated from a database schema without
writing a single line of code.
CONCLUSIONS
For the E-Shop example, of which the UML™ domain model was shown before, a developer has to write
approximately 100 files containing about 10000 lines of code and will need several months to do
this. Naturally numerous errors will slip into such an amount of code and many of them will not
be detected at compile time.
The WMEE can generate most of the code out of the domain model in only a few seconds assuring that
the generated code is stable, free of errors and contains the best practices and patterns for J2EE™
applications.
Modifying the analysis model during the construction of the J2EE™ application will result in a lot of
code changes. Adding a simple property to an entity bean can result in 16 different file changes
in the remote or local interface, bean implementation class, controller session bean, value holder class,
deployment descriptors, SQL script and so on. Again errors will slip into the code and many of them
will not be detected at compile time.
The code generator directly generates and merges the changes in all the files starting from the
modified UML™ domain model
The WMEE allows analysts to draw a UML™ domain model with standard UML™ tools permitting them to
produce a stable baseline J2EE™ architecture out of the created diagrams. Elaborating a J2EE™
application is reduced to analysing the application and designing its domain model using the most
common UML™ tools.
Developers can write their code in a 100% stable and executable baseline architecture where they
can concentrate on implementing the real Business Logic and merge business code with generated code,
seamlessly.
The generated application contains all files needed to compile and execute it using the generated
GUI for immediate testing.
SUPPORTED TOOLS
A complete overview of the supported UML™ case-tools, J2EE™ Application Servers and Relational
Databases can be found here.
Useful Links:
A PDF version of this document.
|