Andrej Koelewijn

7/29/2003

TPL - OptimalJ’s templating language

Filed under: — andrejk @ 9:56 pm

As i mentioned yesterday, one of the issues people have with MDA is, how easy it is to modify generated code, and if these changes are maintained when regenerating code from the models.

The code editor in OptimalJ clearly shows you which parts you can modify (white background) and which parts you can’t touch as showed in this screenshot.
optimalj_code_free_block.png Whenever you regenerate the code, the added parts in the free blocks will be untouched.

Optimalj has it’s own templating language TPL. Within the template you can specify which parts are guarded, i.e., generated from the models, and which parts are free code, and should be restored after a regeneration. Free parts have an id so they can be identified when regenerating the code. The resulting code looks like this:

    /**
     * Converts IssueUpdateObject into a IssueDataObject.
     */
    public IssueDataObject(IssueUpdateObject updateObject) { 
        this.setId(updateObject.getId());
        this.setSummary(updateObject.getSummary());
        this.setPriority(updateObject.getPriority());
        this.setIssueType(updateObject.getIssueType());
        this.setDateCreated(updateObject.getDateCreated());
        this.setDescription(updateObject.getDescription());
//GEN-FREE-GEN:toDataObject$$DATAOBJECT$pidf6aef9ffd57bc7d // your code here

//GEN-GUARD:1$$DATAOBJECT$pidf6aef9ffd57bc7d

}

4 Responses to “TPL - OptimalJ’s templating language”

  1. Mickel Says:

    I am interested in how OptimalJ is to work with compared to say Eclipse, JDeveloper and IDEA. Is it slower? Does it respond nicely to your wishes? My main concern with OptimalJ was that it is based on Netbeans, which to me equals something (much) slower than IDEA, and a bit of a memory hog. It’s quite possible things have changed since I last used Netbeans though….

    The MDA part above sounds neat, and it is great that you are giving us screenshots on how it all looks… Thanks!

  2. Andrej Says:

    Optimalj is pretty slow, but i’m running it on a laptop with 384Mb, and the minumum requirements stated by compuware are 512Mb, so i can’t really complain. But Eclipse is a lot faster on this machine. But I think that if OptimalJ turns out to be good enough to use on a project, i would just upgrade to 1Gb, and that would solve most problems.

    My main concern sofar is that it’s very complex, all the models consist of many parts, and every part has a lot of properties. Maybe by using OptimalJ you can create j2ee applications without having a deep understanding of java and j2ee, but it doesn’t mean that everybody can now produce j2ee applications. You still need a lot of knowledge, but this time about the tool.

  3. Lee Says:

    With regards to speed, OJ is built on top of the NetBeans IDE, so it’s very similar in performance.

    Lee

  4. andrej Says:

    There’s more to OptimalJ than just the netbeans part. For example, in netbeans there’s no functionality to transform one model into another.

Leave a Reply

Powered by WordPress