<?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: Secrets of Object Orientated Encapsulation</title>
	<atom:link href="http://blog.alanklement.com/2009/07/28/secrets-of-object-orientated-encapsulation/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.alanklement.com/2009/07/28/secrets-of-object-orientated-encapsulation/</link>
	<description>Software Development</description>
	<lastBuildDate>Mon, 16 Jan 2012 04:16:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Alan</title>
		<link>http://blog.alanklement.com/2009/07/28/secrets-of-object-orientated-encapsulation/#comment-26</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Wed, 29 Jul 2009 22:13:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.alanklement.com/?p=15#comment-26</guid>
		<description>@ Jorg
Thanks for the mentioning the typos.

@chris
I agree. When I first started OOP, I was using inheritance a ton. Now I hardly do it. In fact, I think I might even do a blog post about composition vs aggregation....

@Kevan
RE: Encapsulation - That may be the more proper definition, but I think it is incomplete and misleading. Many people think of encapsulation only in the way you described and end up not really using OOP.

Wikipedia has a good entry about encapsulation and this part stands out to me:

&quot;The reason for encapsulation is to prevent clients of an interface from depending on those parts of the implementation that are likely to change in the future, thereby allowing those changes to be made more easily&quot;

Yes encapsulation is the technique of hiding implementation from the public interface - but the reason, which I consider more important, is to allow change.  A designer might be using the techniques of encapsulation but at the same time destroying the reason for encapsulation.  In which case, your basically just doing procedural programming.

You&#039;re right about the Abstract Factory and Builder classes.  That is how I would get around that nasty conditional.

Also, thanks for the link.</description>
		<content:encoded><![CDATA[<p>@ Jorg<br />
Thanks for the mentioning the typos.</p>
<p>@chris<br />
I agree. When I first started OOP, I was using inheritance a ton. Now I hardly do it. In fact, I think I might even do a blog post about composition vs aggregation&#8230;.</p>
<p>@Kevan<br />
RE: Encapsulation &#8211; That may be the more proper definition, but I think it is incomplete and misleading. Many people think of encapsulation only in the way you described and end up not really using OOP.</p>
<p>Wikipedia has a good entry about encapsulation and this part stands out to me:</p>
<p>&#8220;The reason for encapsulation is to prevent clients of an interface from depending on those parts of the implementation that are likely to change in the future, thereby allowing those changes to be made more easily&#8221;</p>
<p>Yes encapsulation is the technique of hiding implementation from the public interface &#8211; but the reason, which I consider more important, is to allow change.  A designer might be using the techniques of encapsulation but at the same time destroying the reason for encapsulation.  In which case, your basically just doing procedural programming.</p>
<p>You&#8217;re right about the Abstract Factory and Builder classes.  That is how I would get around that nasty conditional.</p>
<p>Also, thanks for the link.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.alanklement.com/2009/07/28/secrets-of-object-orientated-encapsulation/#comment-25</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Wed, 29 Jul 2009 09:33:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.alanklement.com/?p=15#comment-25</guid>
		<description>Hi Alan, it is always good to see ideas being thought through like this, however some of your concepts perhaps need a little reviewing.

Encapsulation is really about hiding the the implementation of your object&#039;s internals behind it&#039;s public interface. This allows you to change how something is implemented without necessarily changing your interface.

What you have touched on here are a couple of design patterns. You are heading in the direction of an &quot;Abstract Factory&quot; (allows you to have &quot;creators&quot; of different kinds of things such as a FrenchHouseFactory and a LogHouseFactory) and a &quot;Builder&quot; (allows you to hide how a complex thing is built).

Check out the example code over at http://se.cs.depaul.edu/Java/chap10.html

It&#039;s in Java but is similar to the ideas you are getting at.

Thanks for sharing.</description>
		<content:encoded><![CDATA[<p>Hi Alan, it is always good to see ideas being thought through like this, however some of your concepts perhaps need a little reviewing.</p>
<p>Encapsulation is really about hiding the the implementation of your object&#8217;s internals behind it&#8217;s public interface. This allows you to change how something is implemented without necessarily changing your interface.</p>
<p>What you have touched on here are a couple of design patterns. You are heading in the direction of an &#8220;Abstract Factory&#8221; (allows you to have &#8220;creators&#8221; of different kinds of things such as a FrenchHouseFactory and a LogHouseFactory) and a &#8220;Builder&#8221; (allows you to hide how a complex thing is built).</p>
<p>Check out the example code over at <a href="http://se.cs.depaul.edu/Java/chap10.html" rel="nofollow">http://se.cs.depaul.edu/Java/chap10.html</a></p>
<p>It&#8217;s in Java but is similar to the ideas you are getting at.</p>
<p>Thanks for sharing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chris</title>
		<link>http://blog.alanklement.com/2009/07/28/secrets-of-object-orientated-encapsulation/#comment-24</link>
		<dc:creator>chris</dc:creator>
		<pubDate>Wed, 29 Jul 2009 08:40:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.alanklement.com/?p=15#comment-24</guid>
		<description>You are of course absolutely right - Personally I much prefer agreegation/composition - to inheritance any day. Obviously it has it uses, but in most cases it just adds too many layers..</description>
		<content:encoded><![CDATA[<p>You are of course absolutely right &#8211; Personally I much prefer agreegation/composition &#8211; to inheritance any day. Obviously it has it uses, but in most cases it just adds too many layers..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jörg</title>
		<link>http://blog.alanklement.com/2009/07/28/secrets-of-object-orientated-encapsulation/#comment-23</link>
		<dc:creator>Jörg</dc:creator>
		<pubDate>Wed, 29 Jul 2009 06:48:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.alanklement.com/?p=15#comment-23</guid>
		<description>Hey Alan,

nice one. You&#039;re right, many programmers (including me) may have misunderstood the concepts and benefits of encapsulation. 

You unfortunately made two typos in the &quot;correct&quot; code example.. Constructor names of both Room and Door classes are mixed up.. this might be misleading..

But besides that, really good article.
So thanks a lot.</description>
		<content:encoded><![CDATA[<p>Hey Alan,</p>
<p>nice one. You&#8217;re right, many programmers (including me) may have misunderstood the concepts and benefits of encapsulation. </p>
<p>You unfortunately made two typos in the &#8220;correct&#8221; code example.. Constructor names of both Room and Door classes are mixed up.. this might be misleading..</p>
<p>But besides that, really good article.<br />
So thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy</title>
		<link>http://blog.alanklement.com/2009/07/28/secrets-of-object-orientated-encapsulation/#comment-22</link>
		<dc:creator>Jimmy</dc:creator>
		<pubDate>Wed, 29 Jul 2009 00:09:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.alanklement.com/?p=15#comment-22</guid>
		<description>Never thought I&#039;d see Voltron and/or Robotech used in a programming blog...but hey :)</description>
		<content:encoded><![CDATA[<p>Never thought I&#8217;d see Voltron and/or Robotech used in a programming blog&#8230;but hey <img src='http://blog.alanklement.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

