Re: Question on jpatterns annotations

2 views
Skip to first unread message

Dr Heinz M. Kabutz

unread,
Aug 16, 2010, 11:48:02 AM8/16/10
to Marco Tedone, jpat...@googlegroups.com
Hi Marco,

let's take the Contact example. The "participants" array allows us to
specify which other classes are related to this one in the pattern. So
we could have:

@CompositePattern.Component(participants = {Person.class,
DistributionList.class})
public class Contact { ... }

By looking at the Contact class, we can easily see not just what pattern
is being used, but also what other classes are involved in building this
particular pattern.

Regards

Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
http://www.javaspecialists.eu
Tel: +30 69 72 850 460
Skype: kabutz

On 8/15/10 12:20 PM, Marco Tedone wrote:
> Hi Heinz,
>
> I don't think the participants array is well placed within annotations.
> >From my understanding, given a pattern, the participants are all those
> "pieces" which make the pattern. Let's take the Composite as example.
> The participants are:
>
> - Component
> - Leaf
> - Composite
>
> I do like the idea of @CompositePattern.Component,
> @CompositePattern.Leaft and @CompositePattern.Composite as annotations
> which go on the various participants. But because we have already define
> at a fine grained level the participants by using the above annotations,
> I think it's redundant to include also the Class[] participants
> attribute in each annotation. Or maybe I'm missing the point here. Is
> the Class[] participants attribute meant to contain all classes involved
> in this pattern? In this case, still I wouldn't see the utility of this,
> since the number of classes could potentially be huge. It would be
> better to let tools extract the list of participants by simply
> inspecting the annotations.
>
> Cheers,
>
> Marco
>
>
>

Dr Heinz M. Kabutz

unread,
Aug 16, 2010, 12:04:43 PM8/16/10
to jpat...@googlegroups.com
Initially a consistent documentation approach for patterns in our code.
Mostly a human readable form than a complete annotation set for tools.

Currently we have ad-hoc documentation of patterns at best. Programmers
might write a Javadoc comment (if we are lucky) or they might name their
class according to the pattern. Often they do not do either and we are
just left guessing when seeing a large body of code.

Regards

Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
http://www.javaspecialists.eu
Tel: +30 69 72 850 460
Skype: kabutz

On 8/16/10 7:01 PM, Marco Tedone wrote:
> What's the purpose of these annotations then? Provide a documentation tool or a hint about possible patterns? If you want to use jpatterns for future tools then all participants in the pattern should be annotated. If you provided just few class names in the top level component I'm not sure which message you'd like to convey. I still think we should take it off.
> ------Original Message------
> From: Heinz Kabutz
> To: marco....@googlemail.com
> Subject: Re: Question on jpatterns annotations
> Sent: 16 Aug 2010 16:55
>
> 200 participants in one pattern? I would write one or two of them as
> examples.
>
> Regards
>
> Heinz
>

Riaan Cornelius

unread,
Aug 17, 2010, 1:25:59 PM8/17/10
to jpat...@googlegroups.com
And half the time, they get it wrong and name the wrong pattern... Not that this will necessarily help for that though. 

I agree that this is more useful as human readable documentation. The automated tools that it might enable is a bonus.
Reply all
Reply to author
Forward
0 new messages