incubator-isis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Haywood <>
Subject Re: Problem with non-support of Collections as arguments.
Date Fri, 15 Jul 2011 16:29:36 GMT
Just catching up on this thread, interesting stuff you guys have been 
talking about.

In general I'm not a fan of code generation, and indeed wrote a paper a 
long while back [1] criticising its latest incarnation at the time, 
namely MDA.  The problem of allowing the generated code to be extended 
to add in imperative behaviour remains difficult, especially on the Java 
platform.  Using the template/hook pattern and subclassing is probably 
the best option; but it's still horrid.  I guess you could look at 
Lombok project too, though, and hook into the compile pipeline [2].  
That'd be academically interesting.

For what it's worth, I reckon that .NET is a much better platform for 
code gen, because it supports partial classes.  And, if it was me 
writing your paper, I'd look at writing a DSL in Boo, and target it at 
Isis' twin, Naked Objects MVC [3].


[3] <>

On 15/07/2011 10:36, Kevin Meyer - KMZ wrote:
> Hi Iain,
> On 15 Jul 2011 at 1:37, Iain Flynn wrote:
>> On 14 Jul 2011, at 11:23, Kevin Meyer - KMZ wrote:
>>> Look at dishevelled:
>> Done some experimenting and I'm quite impressed! I've done some
>> tinkering with one of the Mutable templates and I've managed to
>> remove constructors from generated classes (I prefer using
>> repositories, and it likes to throw Collections in as parameters)
>> and have Collections be eagerly initialised, preventing the
>> possibility of null pointers.
> Sure - the template based mechanism seems to imply that it'll be
> highly configurable.
>> I do have a couple of concerns (can't see a way to declare a class
>> as abstract, no support for adding your own methods without them
>> getting overwritten upon re-generation) but I'm liking this so far
>> and will definitely bring it up with my supervisor when we meet
>> early next week.
> For abstract support, I presume you should easily be able to either
> extend dishevelled's source to support "abstract" as a class type
> modifier, or just edit the class templates, or both.
> For losing changes with regeneration, one of the code-generators that
> I was readin about yesterday supported the concept of "user comment
> blocks" that bracketed user-code. If a user comment block was
> present, it'd preserve code between the open and close markers when
> it regenerated the code.
> Otherwise, you just add your user code to an extended (sub?)class of
> the generated code:
> Class UserExtensions extends GeneratedBase {
>    public boolean hideCustomer(){
>     ...
>    }
> }
> where GeneratedBase is the generated code and has the Customer
> property (with getters/setters, etc).
>> As for advantages, I think adding in referential integrity to
>> associates (using the mutual registration pattern) and implementing
>> a way to add validate methods to operations could be useful for
>> generating classes for Isis, and I believe both should be doable.
> This reminds me: I have an open JIRA ticket for modifying the Isis
> Eclipse templates regarding the mutual registration pattern [1].
> If you're planning on actually implementing a full parent/child mutual
> registration pattern, please let me know how you do so. The current
> Isis Eclipse code templates are, AFAIAC, broken (see [1]) - but I've not
> proposed a fix as I have not used a child collection that retains a copy
> of the parent, or deferred to the parent for addition/deletion.
> I'll patch the templates as required for your purposes.
>> Thank you so much for introducing me to this!
> You're welcome.
> For what it's worth, I did find a few other tools that supported code
> generation from UML (e.g. ArgoUML [with Eclipse plugin], etc), but I
> assumed you wanted to keep to a text-based solution.
> Regards,
> Kevin
> [1]

  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message