Re: TaskList API proposal
Tor Norbye <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.tasklist.devel |
|---|---|
| Message-ID | <1035832091.17069.366.camel@proto> |
On Mon, 2002-10-28 at 11:04, Trond Norbye wrote:
>
> Tim Lebedkov said:
> > Users of this API must write something like
> > (int) (0.33 * (Suggestion.PRIORITY_MAX - Suggestion.PRIORITY_MIN) +
> > Suggestion.PRIORITY_MIN)
> > and recompile their files to be compatible with future changes to these
> > values.
> > Nobody will do this. That's why I think we should write the values of
> > constants to JavaDoc or create some more levels (5??, 10???).
>
> I must say I agree with Tor on this issue... It is in my eyes _bad_
> programming style to use the internal repesentation of another class.
But then I think we have to blame javac :) It's the one who's
copying the VALUE of my public-static-finals into the .class files
of the -clients- of the class when compiling it.
To get around this, I will
(1) Define more levels; instead of numeric values I'll use
prio-high, prio-normal, prio-low
prio-normalhi, prio-normallow
(2) Remove the "final" modifier, so that the values aren't considered
constants.(Hm, perhaps that's not enough; I will go and check.)
This is one of the reasons Effective Java encourages the
use of a typesafe enum, NOT public static finals. I should
consider using that instead. In fact, I may go and do just that.
-- Tor
> Imagine how difficult it would be to maintain the source if you use the
> constants directly... When the source stops working one will have no idea
> what's wrong and one might need to check out the differences in the API
> lib to find out the new values....
>
>
> Regards,
>
> Trond Norbye
>
> --
> Software Developer [email protected]
>
> THALES
> Information Management Systems Phone: +47 98 22 98 13
> Strindveien 1 Fax: +47 73 93 87 11
> N-7030 Trondheim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>