incubator-jspwiki-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: API changes in InsertPage plugin
Date Fri, 04 Jul 2008 19:17:53 GMT

On Jul 4, 2008, at 1:37 AM, Murray Altheim wrote:

> Janne Jalkanen wrote:
>> The reason why those were made private was because the API should  
>> depend on the actual value of the strings, not the declared  
>> constants.  It was a mistake to declare them public in the first  
>> place,.
> I don't follow the logic of that at all. If I've got code that
> interacts with those constants (and they are constants), the
> "actual value of the strings" is the constant value, which I
> need access to programmatically.

To me, the reason to have a private String is to declare an  
implementation detail. The reason to have a public String is to  
declare a common artifact that is part of the contract of the component.

 From this discussion it appears that the value of the String is part  
of the interface definition that is shared among multiple classes, and  
as such, should be public.

One nice side effect is code completion in code that depends on the  
value. You can start to type InsertPage. PARAM_PAGENAME and the IDE  
will suggest completions for it.

>> It also ends up with duplicate documentation, which is always a bad  
>> thing (because if those two ever get out of sync...)
> If the values are constants, declared final, then that can never
> happen. You've lot me here.
>> Besides, I figured nobody used them.  Looks like was wrong...
> Yes, I have declared PARAM_* values as constants on all my plugins
> as many, many, many of them are subclasses of subclasses, so I need
> to be able to programmatically grab the values. Declaring them
> private keeps that from happening.
> Murray
> ...........................................................................
> Murray Altheim <murray07 at>                            
> ===  = =
>                                     =  
> =  ===
> SGML Grease Monkey, Banjo Player, Wantanabe Zen Monk               =  
> =  = =
>      Boundless wind and moon - the eye within eyes,
>      Inexhaustible heaven and earth - the light beyond light,
>      The willow dark, the flower bright - ten thousand houses,
>      Knock at any door - there's one who will respond.
>                                      -- The Blue Cliff Record

Craig L Russell
Architect, Sun Java Enterprise System
408 276-5638
P.S. A good JDO? O, Gasp!

View raw message