Hi Marijan,
it might depend on what your constants are. For example imagine you had an
interface Shape, with a method setLineType. You could have setLineType
(type:String) (eg "dashed"), or setLineType (type:Number) (eg 0, 2 ,5). With
public constants you could have the Shape interface declare vars as public
static var DASHED:Number = 0; and you could call setLineType (Shape.DASHED
);.
Out of the 3 alternatives i would prefer the last, and I do not think this
exposes inner details a lot.

As said I can imagine that when you declare an interface like:
interface MyGeneralInterface {
public static var mySpecificVar:MyVerySpecificClass;
}
that it is plain wrong, but otherwise in the linetype example? I don't know,
I'd like to hear your thoughts on it.

greetz
Hans


On 7/3/06, Marijan Milicevic <[EMAIL PROTECTED]> wrote:

Hi Hans,
while I cannot say it's bad, it's difficult t say there's nothin nad about
it.
to quote an javaworld article:

"It turns out that using an interface to declare constants may not be the
best practice after all. In fact, using interfaces in this way may be
downright nasty. Why? Interfaces should only be used to define types; any
other use is an abuse. Using an interface causes internal details -- such as
constants -- to leak into the class' public API. Once something becomes part
of the public API, you can never get rid of it."
so, in above case it could be wrong..

-m






-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Hans Wichman
Sent: Mon 7/3/2006 7:04 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] AS3 - why no properties in interfaces?

Although there is -nothing- bad about using interfaces as a container of
constants.



On 7/3/06, Marijan Milicevic <[EMAIL PROTECTED]> wrote:
>
> Hi Sascha,
>
> >But it's still beyond me why property support wasn't added. It
> >can be such a complex thing but would make OO life a good
> >amount easier.
>
> You are refering to Java but defined fields in java are implicitly
> static finals and need to be initilized within interface,
> so, you are not missing that much in AS3 anyway.
>
> Also, bad habit of java programmers is to use interfaces as container of
> constants,
> which, saves them some typing (although with static imports in 1.5version
> it doesn't make any difference).
>
> -m
>
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to