<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: These annoying protected variables in Flex framework</title>
	<atom:link href="http://flexblog.faratasystems.com/2007/10/25/these-annoying-protected-variables-in-flex-framework/feed" rel="self" type="application/rss+xml" />
	<link>http://flexblog.faratasystems.com/2007/10/25/these-annoying-protected-variables-in-flex-framework</link>
	<description>A blog about our experience with Adobe Flex</description>
	<lastBuildDate>Tue, 31 Jan 2012 19:52:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: judah</title>
		<link>http://flexblog.faratasystems.com/2007/10/25/these-annoying-protected-variables-in-flex-framework/comment-page-1#comment-31986</link>
		<dc:creator>judah</dc:creator>
		<pubDate>Fri, 16 Nov 2007 00:36:01 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=263#comment-31986</guid>
		<description>I wrote a similar post about private variables (http://www.judahfrangipane.com/blog/?p=77). Chuck made a good point that if some variables were made protected or public the result could lead to buggy behavior. 

I asked some of the Flex engineers why and they said that unless it was deemed necessary, they would use private variables instead of public because of optimizations made by the compiler on private variables. I&#039;m not sure if those same optimizations are available to protected variables but I don&#039;t use protected variables. The reason I sometimes use private variables is because I don&#039;t want an application developer or user of my components to see every single property on my class. It would be way too much and too many &quot;similarly&quot; named variables where the only one I want them to use is the one I mark public. But I really think protected variables have been misapplied. I think they should be in the same class as mx internal. If they were still accessable but with an implied warning that may they not be safe to use and not show up in MXML code hinting then I think we might solve the reasons behind why protected variables were created. IMHO</description>
		<content:encoded><![CDATA[<p>I wrote a similar post about private variables (<a href="http://www.judahfrangipane.com/blog/?p=77" rel="nofollow">http://www.judahfrangipane.com/blog/?p=77</a>). Chuck made a good point that if some variables were made protected or public the result could lead to buggy behavior. </p>
<p>I asked some of the Flex engineers why and they said that unless it was deemed necessary, they would use private variables instead of public because of optimizations made by the compiler on private variables. I&#8217;m not sure if those same optimizations are available to protected variables but I don&#8217;t use protected variables. The reason I sometimes use private variables is because I don&#8217;t want an application developer or user of my components to see every single property on my class. It would be way too much and too many &#8220;similarly&#8221; named variables where the only one I want them to use is the one I mark public. But I really think protected variables have been misapplied. I think they should be in the same class as mx internal. If they were still accessable but with an implied warning that may they not be safe to use and not show up in MXML code hinting then I think we might solve the reasons behind why protected variables were created. IMHO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dejager</title>
		<link>http://flexblog.faratasystems.com/2007/10/25/these-annoying-protected-variables-in-flex-framework/comment-page-1#comment-30680</link>
		<dc:creator>dejager</dc:creator>
		<pubDate>Fri, 26 Oct 2007 16:20:43 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=263#comment-30680</guid>
		<description>The original question I addressed was, &#039;why do we need protected variables?&#039; Not &#039;why Framework Developer put the protected modifier in the first place?&#039;  If you wanted a definitive answer to your second question I&#039;m sure you can get one from any number of the engineers working on the Flex framework.  From my experience I&#039;ve found them to be quite transparent.</description>
		<content:encoded><![CDATA[<p>The original question I addressed was, &#8216;why do we need protected variables?&#8217; Not &#8216;why Framework Developer put the protected modifier in the first place?&#8217;  If you wanted a definitive answer to your second question I&#8217;m sure you can get one from any number of the engineers working on the Flex framework.  From my experience I&#8217;ve found them to be quite transparent.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yakov Fain</title>
		<link>http://flexblog.faratasystems.com/2007/10/25/these-annoying-protected-variables-in-flex-framework/comment-page-1#comment-30675</link>
		<dc:creator>Yakov Fain</dc:creator>
		<pubDate>Fri, 26 Oct 2007 15:51:37 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=263#comment-30675</guid>
		<description>You can\&#039;t override a function increasing its accessibility.
But neither you nor dejager are answering my question: why Framework Developer put the protected modifier in the first place? Because he was under impression that the only way to use it is by forcing Component developer create a subclass? Why does this Framework developer forces me to use inheritance and not composition?

What you call a \&quot;friendly hint\&quot; can be better called \&quot;Framework Developer is not sure how this particular property is used  by other components of the framework, so he decided to declare it protected just in case\&quot;.

Your arguments are not convincing.</description>
		<content:encoded><![CDATA[<p>You can\&#8217;t override a function increasing its accessibility.<br />
But neither you nor dejager are answering my question: why Framework Developer put the protected modifier in the first place? Because he was under impression that the only way to use it is by forcing Component developer create a subclass? Why does this Framework developer forces me to use inheritance and not composition?</p>
<p>What you call a \&#8221;friendly hint\&#8221; can be better called \&#8221;Framework Developer is not sure how this particular property is used  by other components of the framework, so he decided to declare it protected just in case\&#8221;.</p>
<p>Your arguments are not convincing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vsilaev</title>
		<link>http://flexblog.faratasystems.com/2007/10/25/these-annoying-protected-variables-in-flex-framework/comment-page-1#comment-30674</link>
		<dc:creator>vsilaev</dc:creator>
		<pubDate>Fri, 26 Oct 2007 14:38:38 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=263#comment-30674</guid>
		<description>Yakov,

Very strange way to override a property to make it public. Should be something like this:

package {
  import mx.containers.VBox;
  public class VBoxScalable extends VBox {

    override public function get unscaledWidth():Number { return super.unscaledWidth; }
    override public function get unscaledHeight():Number { return super.unscaledHeight; }

  }
}

Anyway, let me disagree with you regarding protected variables. There are 3 roles involved here:
-- Framework Developer (developer who puts &quot;protected&quot; visibility modifier)
-- Custom library / component developer (who may use framework class as base and use all protected properties and even expose them to public)
-- Application developer (who assembles application from components provided by [1] and [2])

In fact, you have to play both roles [2] and [3] during development, but I can&#039;t say this is limitation. So when your cursor is placed somewhere between mx:Application tags you definitely may find certain design decisions of [1] boring, but if you quickly change your role from [3] to [2] you can easily fix this :)

&quot;Private&quot; is real limitation -- just use some functionality &quot;as is&quot;, or reproduce it completely. &quot;Protected&quot; is just a friendly hint -- this code may have side effects that are better controlled inside component code rather then from outside. 

Anyway, [2] may always decide: ok, there is nothing wrong for these properties/methods to be public, at least for known set of applications (typically developed within same company). [1] has no such freedom for similar decisions.

VS</description>
		<content:encoded><![CDATA[<p>Yakov,</p>
<p>Very strange way to override a property to make it public. Should be something like this:</p>
<p>package {<br />
  import mx.containers.VBox;<br />
  public class VBoxScalable extends VBox {</p>
<p>    override public function get unscaledWidth():Number { return super.unscaledWidth; }<br />
    override public function get unscaledHeight():Number { return super.unscaledHeight; }</p>
<p>  }<br />
}</p>
<p>Anyway, let me disagree with you regarding protected variables. There are 3 roles involved here:<br />
&#8211; Framework Developer (developer who puts &#8220;protected&#8221; visibility modifier)<br />
&#8211; Custom library / component developer (who may use framework class as base and use all protected properties and even expose them to public)<br />
&#8211; Application developer (who assembles application from components provided by [1] and [2])</p>
<p>In fact, you have to play both roles [2] and [3] during development, but I can&#8217;t say this is limitation. So when your cursor is placed somewhere between mx:Application tags you definitely may find certain design decisions of [1] boring, but if you quickly change your role from [3] to [2] you can easily fix this <img src='http://flexblog.faratasystems.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#8220;Private&#8221; is real limitation &#8212; just use some functionality &#8220;as is&#8221;, or reproduce it completely. &#8220;Protected&#8221; is just a friendly hint &#8212; this code may have side effects that are better controlled inside component code rather then from outside. </p>
<p>Anyway, [2] may always decide: ok, there is nothing wrong for these properties/methods to be public, at least for known set of applications (typically developed within same company). [1] has no such freedom for similar decisions.</p>
<p>VS</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dejager</title>
		<link>http://flexblog.faratasystems.com/2007/10/25/these-annoying-protected-variables-in-flex-framework/comment-page-1#comment-30591</link>
		<dc:creator>dejager</dc:creator>
		<pubDate>Thu, 25 Oct 2007 22:56:06 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=263#comment-30591</guid>
		<description>The short answer is, we need protected variables and we don&#039;t need protected variables.  If anything, the protected keyword communicates a designer&#039;s original intention for a property.  Whether you use it or not in your own code should be a decision that is left entirely up to you.  This being said we should be respectful of the fact that other designers may have logical reasons for wanting to limit the accessibility of a property, even if these reasons aren&#039;t apparent to us at first glance.  Some people choose to lock their front door and only give themselves and their children access to the things found in their house, while others live without doors have no qualms about exposing all of their possessions to the world.  Both examples are based on personal preference, neither of which is right or wrong.  However, while the person without doors may not mind you wandering through their house using their possessions, a person who chooses to live with their doors locked may require of you certain requirements (some type of relationship, a request to use one of their possessions, etc),  even if you personally would never ask those things of someone else.  These requirements, though not stopping you (you could always crawl through an open window, getting around a locked door), do set up guidelines for how the designer (owner) of the properties (possessions) expects others to interact with her/his objects.  We should respect these guidelines and try to work within them whenever possible, even if the requirements for doing so seem a bit wacky from our point of view.</description>
		<content:encoded><![CDATA[<p>The short answer is, we need protected variables and we don&#8217;t need protected variables.  If anything, the protected keyword communicates a designer&#8217;s original intention for a property.  Whether you use it or not in your own code should be a decision that is left entirely up to you.  This being said we should be respectful of the fact that other designers may have logical reasons for wanting to limit the accessibility of a property, even if these reasons aren&#8217;t apparent to us at first glance.  Some people choose to lock their front door and only give themselves and their children access to the things found in their house, while others live without doors have no qualms about exposing all of their possessions to the world.  Both examples are based on personal preference, neither of which is right or wrong.  However, while the person without doors may not mind you wandering through their house using their possessions, a person who chooses to live with their doors locked may require of you certain requirements (some type of relationship, a request to use one of their possessions, etc),  even if you personally would never ask those things of someone else.  These requirements, though not stopping you (you could always crawl through an open window, getting around a locked door), do set up guidelines for how the designer (owner) of the properties (possessions) expects others to interact with her/his objects.  We should respect these guidelines and try to work within them whenever possible, even if the requirements for doing so seem a bit wacky from our point of view.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tearaway_Tea</title>
		<link>http://flexblog.faratasystems.com/2007/10/25/these-annoying-protected-variables-in-flex-framework/comment-page-1#comment-30590</link>
		<dc:creator>tearaway_Tea</dc:creator>
		<pubDate>Thu, 25 Oct 2007 21:53:12 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=263#comment-30590</guid>
		<description>Yeah, I totaly agree with you. There is no sens of using protected properties and fields only methods.</description>
		<content:encoded><![CDATA[<p>Yeah, I totaly agree with you. There is no sens of using protected properties and fields only methods.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

