Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > NZ Computing > Open Source Java Code Generator Released

Reply
Thread Tools

Open Source Java Code Generator Released

 
 
Cheetah
Guest
Posts: n/a
 
      10-10-2004
This week Nothing But Net released version 0.5 of Sysmod, a open source Java
code generator. The purpose of Sysmod is to make writing the data
persistance and business logic of Java web applications easier. Sysmod uses
the Apache Jakarta project Velocity as a code template system, and uses the
lightweight IDXML parser for working with XML. It has been used by Nothing
But Net for about two years, providing a solid basis on which to write Java
web applications.

Sysmod was conceived about two years ago by Mark Derricutt and Peter
Harrison. The issue at the time was writing the data persistance code in
Java to deal with databases. Without code generation there was too much
work in maintaining the data access code and too many coding errors. Sysmod
was written to fill address these issues.

There are essentially two kinds of Object Persistance available today. There
are native object databases which do not use relational databases at all.
These systems are pure in a OO sense, but they suffer from a lack of
compatible tools such as reporting engines that work against SQL. There are
also no standard query systems to query the object database. Then there are
object relational mappers, which try to map a OO structure to a relational
structure. The object relational mappers tend to be complex as they need to
be able to be flexible enough to handle any OO structure in a relational
context. Relational tables may be able to support objects in theory, but
often this approach increases the complexity of the database.

Sysmod is neither a true object database or a true object relational mapper.
We have accepted certain limitations to our object model in order to
achieve an easy to use system. The most important benefit of the system is
that our objects maintain a simple one to one relationship between database
tables and data objects. This is not so say you cannot relate tables from
one to another just like a relational database. What it does mean is that
you do not have the flexibility of object relational mappers.

This is in effect a trade off. We have traded the flexibility of true object
strucutres for the ease of intergration with a relational database. There
is no need to manually map between data and objects, as this is all handled
automatically. There is no need to code data persistance, and there is no
need to manually create a database. Sysmod makes use of a single model file
which is XML based. From this model all the Java code and the database
schema is derrived.
 
Reply With Quote
 
 
 
 
Harry
Guest
Posts: n/a
 
      10-10-2004
Cheetah wrote:

> This week Nothing But Net released version 0.5 of Sysmod, a open source
> Java code generator. The purpose of Sysmod is to make writing the data
> persistance and business logic of Java web applications easier. Sysmod
> uses the Apache Jakarta project Velocity as a code template system, and
> uses the lightweight IDXML parser for working with XML. It has been used
> by Nothing But Net for about two years, providing a solid basis on which
> to write Java web applications.
>
> Sysmod was conceived about two years ago by Mark Derricutt and Peter
> Harrison. The issue at the time was writing the data persistance code in
> Java to deal with databases. Without code generation there was too much
> work in maintaining the data access code and too many coding errors.
> Sysmod was written to fill address these issues.
>
> There are essentially two kinds of Object Persistance available today.
> There are native object databases which do not use relational databases at
> all. These systems are pure in a OO sense, but they suffer from a lack of
> compatible tools such as reporting engines that work against SQL. There
> are also no standard query systems to query the object database. Then
> there are object relational mappers, which try to map a OO structure to a
> relational structure. The object relational mappers tend to be complex as
> they need to be able to be flexible enough to handle any OO structure in a
> relational context. Relational tables may be able to support objects in
> theory, but often this approach increases the complexity of the database.
>
> Sysmod is neither a true object database or a true object relational
> mapper. We have accepted certain limitations to our object model in order
> to achieve an easy to use system. The most important benefit of the system
> is that our objects maintain a simple one to one relationship between
> database tables and data objects. This is not so say you cannot relate
> tables from one to another just like a relational database. What it does
> mean is that you do not have the flexibility of object relational mappers.
>
> This is in effect a trade off. We have traded the flexibility of true
> object strucutres for the ease of intergration with a relational database.
> There is no need to manually map between data and objects, as this is all
> handled automatically. There is no need to code data persistance, and
> there is no need to manually create a database. Sysmod makes use of a
> single model file which is XML based. From this model all the Java code
> and the database schema is derrived.


persistance, derrived, intergration, strucutures, ...
Must be time to write a Java spelling checker.


 
Reply With Quote
 
 
 
 
Dany P. Wu
Guest
Posts: n/a
 
      10-10-2004
"Cheetah" <(E-Mail Removed)> wrote in message
news:Cl0ad.7325$(E-Mail Removed)...
> This week Nothing But Net released version 0.5 of Sysmod, a open source
> Java code generator. The purpose of Sysmod is to make writing the data
> persistance and business logic of Java web applications easier. Sysmod
> uses the Apache Jakarta project Velocity as a code template system, and
> uses the lightweight IDXML parser for working with XML. It has been used
> by Nothing But Net for about two years, providing a solid basis on which
> to write Java web applications.
> <SNIP>


Alright, it all sounds very interesting but I can't seem to find the website
concerning this marvelous-sounding software. I Googled for it with not much
luck. Quite a few articles seemed to mention it but no actual link to the
software/developers.

Perhaps I "misgoogled"?

D.




 
Reply With Quote
 
Cheetah
Guest
Posts: n/a
 
      10-10-2004
Dany P. Wu wrote:

> Perhaps I "misgoogled"?


http://sysmod.sf.net

I suggest downloading the entire tgz initially, as there is a demo model and
unit tests which will show you how to use it. I'm afraid I'm guilty of not
documenting it nearly well enough, although I have made a start to
rectifying that.
 
Reply With Quote
 
Dany P. Wu
Guest
Posts: n/a
 
      10-10-2004
"Cheetah" <(E-Mail Removed)> wrote in message
news:mS4ad.7356$(E-Mail Removed)...
> Dany P. Wu wrote:
>> Perhaps I "misgoogled"?

> http://sysmod.sf.net
> I suggest downloading the entire tgz initially, as there is a demo model
> and unit tests which will show you how to use it. I'm afraid I'm guilty
> of not documenting it nearly well enough, although I have made a start to
> rectifying that.


Documentation - yich!! I know I know! It's all very important and
everything, in case someone feels like pointing that out to me again.
However, it doesn't stop it being somewhat of a dreaded task for developers.

Thanks for the link.

D.


 
Reply With Quote
 
Ron McNulty
Guest
Posts: n/a
 
      10-10-2004
Hi Cheetah

What advantages and disadvantages does this have compared to Hibernate and
Middlegen?

Regards

Ron


 
Reply With Quote
 
Cheetah
Guest
Posts: n/a
 
      10-10-2004
Dany P. Wu wrote:

> Documentation - yich!! I know I know! It's all very important and
> everything, in case someone feels like pointing that out to me again.
> However, it doesn't stop it being somewhat of a dreaded task for
> developers.


Just a little more background:

We have actually been using Sysmod for two years. There is actually a love
hate thing going on here - it is certainly not without its warts. What it
does do however is make the whole Java data mapping issue go away. No need
to map database to objects - its all handled automatically from the
definition of the model. The Data object factories are also able to handle
many common queries.

There is however a longish list of new features we want to add to Sysmod -
including the ability to define views. Often you need to create a specific
query or view for a report. The current support for views in Sysmod is a
rather ugly hack, so we will be looking at replacing this as soon as
possible.

One of the recent features implemented was the intergration of the Velocity
Template engine. This enables us to have templated code rather than
manually coding it into Java Classes with out.println. This actually
started some time ago, but we had to fix a fork between the open source
version and out internal tree. Thats fixed and there is only the
sourceforge tree now.

It is similar to Cayenne and Hibernate in functionality, and while it lacks
features like a GUI model builder, it also has a superior framework in
terms of being able to create and query objects. One cool feature is the
ability to write your own queries, have a result set returned, and have
objects load themselves from the result set.


 
Reply With Quote
 
Cheetah
Guest
Posts: n/a
 
      10-10-2004
Ron McNulty wrote:

> Hi Cheetah
>
> What advantages and disadvantages does this have compared to Hibernate and
> Middlegen?


Advantages:

The hidden advantage right now is that it forms a base to our web
application development framework which we will be releasing over the next
few weeks. This incorporates struts, velocity etc into a system which can
generate PDF, OpenOffice Documents, and of course HTML and XML. There is a
system similar to "tiles", and security is also taken care of.

I suppose the big advantage of sysmod is its simplicity. For example, I'll
list one of our struts actions in our accounting system that uses Sysmod:

public class AccountList extends ValidatedAction
{
public ActionForward secureExecute( ActionMapping mapping,
HttpServletRequest request,
HttpServletResponse response,
HttpSession session,
User user)
throws Exception
{
request.setAttribute( "allAccounts" , AccountFactory.findAll() );
return mapping.findForward("success");
}
}

In this example we see out AccountFactory object is called with findAll(),
which returns a list of all the Account objects from the database. The
action here by the way is part of our web framework which extends struts.
You see that the user is provided, and that Exception is thrown. This
simplifies error capture.

Saving is just about as easy:

public class AccountSave extends ValidatedAction
{
public ActionForward secureExecute( ActionMapping mapping,
HttpServletRequest request,
HttpServletResponse response,
HttpSession session,
User user)
throws Exception
{
Account acc = null;

String accIDString = request.getParameter( "acc_id" );
if ( null != accIDString && !"".equals( accIDString ) )
{
int accID = Integer.parseInt( accIDString );
acc = AccountFactory.findByID( accID );
}

if ( null == acc )
{
acc = AccountFactory.getInstance();
}

acc.fillFromHttpRequest( "account", request );
acc.saveChanges();

return mapping.findForward("success");
}
}

In this example we see how we first check to see if we have an account id.
If we do it means we are editing an existing account. If it is an existing
account we get the account from the database by calling
AccountFactory.getByID(). Otherwise its a new account so we create a new
one with AccountFactory.getInstance().

Data from the request is loaded into the account by fillFromHttpRequest. The
prefix of "account" means that multiple objects of the same time can be
included on the same form, and that by using the prefix they can
differentiate. The objects themselves implement the business lofic -
including validation, so there is no need for separate validation such as
ActionForms. Finally the saveChanges() method does what it says.

Anyways, I'll give a more in depth description a little later - and perhaps
run a few performance comparisions just for my own interest.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Source Conference in Japan: Open Source Realize Forum 2005 pat eyler Ruby 1 03-05-2005 03:50 AM
can't use View, Source menu to open the source code. Jenny Javascript 3 12-17-2004 07:01 AM
FSM (Finite State Machine) Generator - Open Source Roberto Nunnari C Programming 10 02-09-2004 03:57 PM
FSM (Finite State Machine) Generator - Open Source Roberto Nunnari Java 2 02-04-2004 07:16 AM
FSM (Finite State Machine) Generator - Open Source Roberto Nunnari C++ 1 02-03-2004 11:08 PM



Advertisments