Have you ever tried to subclass CartesianChart to draw a rectangle right
on the chart? 
The property dataRegion is declared as protected, but I need to be able
to instantiate and use this property from a class or MXML that is not a
descendent of CartesianChart. Of course, there is a workaround, you can
create a subclass and add a public method there that will return you
the dataRegion. But my question is more generic: why use protected
variables at all?  If you want to hide a variable, make it private. If
you want to give an access to a variable, still make it private but
provide a public accessor.

I made a post at JavaLobby, a popular forum on the subject over here:
http://www.javalobby.org/java/forums/t77911.html

I provided a simple example in Java just to prove my point, but the same
considerations are valid to all Flex components including the ones
developed by Adobe, sorry guys, no offence.

More than five thousand Java developers have read this post, and so far
no one gave me a good reason to use protected variables. Read the
discussion of this JavaLobby thread.  To summarize, people think this
way: "As a designer of my component, I ask myself, should people use
this property from anywhere but a subclass of my component? If the
answer is no, I make it protected".   IMHO, designers of components
should not even ask themselves such a question.  

If you give me your component, do not stop me from using composition,
please...Besides, I know a workaround described in my Java post. 

Regards,
Yakov Fain
Farata Systems
www.faratasystems.com





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcomponents/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to