Open Source Java Code Generator Released

Discussion in 'NZ Computing' started by Cheetah, Oct 10, 2004.

  1. Cheetah

    Cheetah Guest

    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.
    Cheetah, Oct 10, 2004
    #1
    1. Advertising

  2. Cheetah

    Harry Guest

    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.
    Harry, Oct 10, 2004
    #2
    1. Advertising

  3. Cheetah

    Dany P. Wu Guest

    "Cheetah" <> wrote in message
    news:Cl0ad.7325$...
    > 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.
    Dany P. Wu, Oct 10, 2004
    #3
  4. Cheetah

    Cheetah Guest

    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.
    Cheetah, Oct 10, 2004
    #4
  5. Cheetah

    Dany P. Wu Guest

    "Cheetah" <> wrote in message
    news:mS4ad.7356$...
    > 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.
    Dany P. Wu, Oct 10, 2004
    #5
  6. Cheetah

    Ron McNulty Guest

    Hi Cheetah

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

    Regards

    Ron
    Ron McNulty, Oct 10, 2004
    #6
  7. Cheetah

    Cheetah Guest

    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.
    Cheetah, Oct 10, 2004
    #7
  8. Cheetah

    Cheetah Guest

    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.
    Cheetah, Oct 10, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Author Tarun Tyagi
    Replies:
    0
    Views:
    688
    Author Tarun Tyagi
    Dec 29, 2004
  2. Replies:
    3
    Views:
    499
    Don_Luciano
    Mar 19, 2006
  3. Lawrence D'Oliveiro

    Open-Source Good, Closed-Source Bad

    Lawrence D'Oliveiro, Oct 16, 2005, in forum: NZ Computing
    Replies:
    1
    Views:
    450
    Gordon
    Oct 16, 2005
  4. Lawrence D'Oliveiro

    Closed-Source vs Open-Source Drivers

    Lawrence D'Oliveiro, May 4, 2009, in forum: NZ Computing
    Replies:
    2
    Views:
    494
    Lawrence D'Oliveiro
    May 5, 2009
  5. Guest
    Replies:
    0
    Views:
    442
    Guest
    Aug 13, 2009
Loading...

Share This Page