<?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: Who needs protected variables?</title>
	<atom:link href="http://flexblog.faratasystems.com/2006/08/25/who-needs-protected-variables/feed" rel="self" type="application/rss+xml" />
	<link>http://flexblog.faratasystems.com/2006/08/25/who-needs-protected-variables</link>
	<description>A blog about our experience with Adobe Flex</description>
	<lastBuildDate>Thu, 18 Mar 2010 13:56: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: George Birbilis</title>
		<link>http://flexblog.faratasystems.com/2006/08/25/who-needs-protected-variables/comment-page-1#comment-2446</link>
		<dc:creator>George Birbilis</dc:creator>
		<pubDate>Tue, 30 Jan 2007 15:41:12 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=78#comment-2446</guid>
		<description>BTW, Delphi also doesn&#039;t behave totally purely regarding protected fields, classes defined inside the same unit can treat them as public field. With recent Delphi versions introducting packages concept, maybe they also extend it this protected-fields access to packages scope, but I think not. They must have added a &quot;Protected Friend&quot; concept like in VB.net for that case</description>
		<content:encoded><![CDATA[<p>BTW, Delphi also doesn&#8217;t behave totally purely regarding protected fields, classes defined inside the same unit can treat them as public field. With recent Delphi versions introducting packages concept, maybe they also extend it this protected-fields access to packages scope, but I think not. They must have added a &#8220;Protected Friend&#8221; concept like in VB.net for that case</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George Birbilis</title>
		<link>http://flexblog.faratasystems.com/2006/08/25/who-needs-protected-variables/comment-page-1#comment-2445</link>
		<dc:creator>George Birbilis</dc:creator>
		<pubDate>Tue, 30 Jan 2007 15:39:25 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=78#comment-2445</guid>
		<description>Java allows protection even against the scenario you describe, using a concept called &quot;sealed packages&quot;. Else it would be totally insecure to you protected variables cause third party runtime code could mess up with your code (exploit). I&#039;m speaking of running code protection, cause at the disk level, before you run the JVM / classloader, you can open up the JAR files (they are of .zip format) and mess up with the third party classes (unseal the package [at the manifest.mf file], decompile its code etc.). Even if that package is signed you can do various tricks (load the classes via your classloader, store them again to another .zip and mess up with them there, then load that unsigned package or resign it yourself)</description>
		<content:encoded><![CDATA[<p>Java allows protection even against the scenario you describe, using a concept called &#8220;sealed packages&#8221;. Else it would be totally insecure to you protected variables cause third party runtime code could mess up with your code (exploit). I&#8217;m speaking of running code protection, cause at the disk level, before you run the JVM / classloader, you can open up the JAR files (they are of .zip format) and mess up with the third party classes (unseal the package [at the manifest.mf file], decompile its code etc.). Even if that package is signed you can do various tricks (load the classes via your classloader, store them again to another .zip and mess up with them there, then load that unsigned package or resign it yourself)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Tynjala</title>
		<link>http://flexblog.faratasystems.com/2006/08/25/who-needs-protected-variables/comment-page-1#comment-30</link>
		<dc:creator>Josh Tynjala</dc:creator>
		<pubDate>Mon, 02 Oct 2006 23:16:03 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=78#comment-30</guid>
		<description>In the switch to the new version of ECMAScript, the private keyword from AS2 received a new meaning in AS3. Now, with private, you can no longer access a variable in subclasses. The protected keyword works like the old private.

Certainly, if you want to let anyone use a property, you should make it public. There are situations where you want subclasses to access your variables, but not everyone. For example, I often make subcomponents protected so that they can be manipulated by subclasses. Most of the time, a component user doesn&#039;t need to access those subcomponents. If they do, they should probably be subclassing anyway.</description>
		<content:encoded><![CDATA[<p>In the switch to the new version of ECMAScript, the private keyword from AS2 received a new meaning in AS3. Now, with private, you can no longer access a variable in subclasses. The protected keyword works like the old private.</p>
<p>Certainly, if you want to let anyone use a property, you should make it public. There are situations where you want subclasses to access your variables, but not everyone. For example, I often make subcomponents protected so that they can be manipulated by subclasses. Most of the time, a component user doesn&#8217;t need to access those subcomponents. If they do, they should probably be subclassing anyway.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barney</title>
		<link>http://flexblog.faratasystems.com/2006/08/25/who-needs-protected-variables/comment-page-1#comment-26</link>
		<dc:creator>Barney</dc:creator>
		<pubDate>Mon, 02 Oct 2006 19:58:53 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=78#comment-26</guid>
		<description>Protected is a very important distinction.  It&#039;s not so much about the protection of the variable as it is protection of the API.  Typically you see this to describe the access levels:

public : anyone
protected: pacakge and subclasses
private: this class (and it&#039;s inner/nested classes)

However, better to think like this:

public: public API
protected: implementation API
private: private implementation API

Recast the terms like this, and it becomes quite obvious why the different levels.  A protected member is tied to the implementation of a class that subclasses (i.e. classes that share part of it&#039;s implementation) need to be aware of, but which classes that don&#039;t share implementation shouldn&#039;t care about (because it&#039;s not part of their interface).  A public member should be totally detached from implementation. 

Of course, it&#039;s easy to botch up your access levels and make something protected that should be public (or the converse), but that&#039;s not an argument for not having the different levels, it&#039;s an argument for ensuring you understand the tools you&#039;re using before you use them.

NB: each language has specifics that may differ (e.g. Java&#039;s &quot;default&quot; scope).  I wasn&#039;t aiming for completeness.</description>
		<content:encoded><![CDATA[<p>Protected is a very important distinction.  It&#8217;s not so much about the protection of the variable as it is protection of the API.  Typically you see this to describe the access levels:</p>
<p>public : anyone<br />
protected: pacakge and subclasses<br />
private: this class (and it&#8217;s inner/nested classes)</p>
<p>However, better to think like this:</p>
<p>public: public API<br />
protected: implementation API<br />
private: private implementation API</p>
<p>Recast the terms like this, and it becomes quite obvious why the different levels.  A protected member is tied to the implementation of a class that subclasses (i.e. classes that share part of it&#8217;s implementation) need to be aware of, but which classes that don&#8217;t share implementation shouldn&#8217;t care about (because it&#8217;s not part of their interface).  A public member should be totally detached from implementation. </p>
<p>Of course, it&#8217;s easy to botch up your access levels and make something protected that should be public (or the converse), but that&#8217;s not an argument for not having the different levels, it&#8217;s an argument for ensuring you understand the tools you&#8217;re using before you use them.</p>
<p>NB: each language has specifics that may differ (e.g. Java&#8217;s &#8220;default&#8221; scope).  I wasn&#8217;t aiming for completeness.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
