<?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: OOP: What does an object&#8217;s responsibility entail?</title>
	<atom:link href="http://www.markhneedham.com/blog/2009/02/09/oop-what-does-an-objects-responsibility-entail/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2009/02/09/oop-what-does-an-objects-responsibility-entail/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: ezo</title>
		<link>http://www.markhneedham.com/blog/2009/02/09/oop-what-does-an-objects-responsibility-entail/comment-page-1/#comment-123179</link>
		<dc:creator>ezo</dc:creator>
		<pubDate>Wed, 11 May 2011 02:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=914#comment-123179</guid>
		<description>What is object responsibilty????? </description>
		<content:encoded><![CDATA[<p>What is object responsibilty?????</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Links, news, Resources: Object Oriented Programming (1) &#171; Angel &#8220;Java&#8221; Lopez on Blog</title>
		<link>http://www.markhneedham.com/blog/2009/02/09/oop-what-does-an-objects-responsibility-entail/comment-page-1/#comment-98487</link>
		<dc:creator>Links, news, Resources: Object Oriented Programming (1) &#171; Angel &#8220;Java&#8221; Lopez on Blog</dc:creator>
		<pubDate>Sat, 19 Feb 2011 10:38:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=914#comment-98487</guid>
		<description>[...] OOP: What does an object&#8217;s responsibility entail? at Mark Needham I believe that an object should be responsible for deciding how its data is used rather than having another object reach into it, retrieve its data and then decide what to do with it. [...]</description>
		<content:encoded><![CDATA[<p>[...] OOP: What does an object&#8217;s responsibility entail? at Mark Needham I believe that an object should be responsible for deciding how its data is used rather than having another object reach into it, retrieve its data and then decide what to do with it. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karsten</title>
		<link>http://www.markhneedham.com/blog/2009/02/09/oop-what-does-an-objects-responsibility-entail/comment-page-1/#comment-8689</link>
		<dc:creator>Karsten</dc:creator>
		<pubDate>Thu, 12 Feb 2009 12:50:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=914#comment-8689</guid>
		<description>Perhaps this would be useful?
http://www.codeplex.com/AutoMapper</description>
		<content:encoded><![CDATA[<p>Perhaps this would be useful?<br />
<a href="http://www.codeplex.com/AutoMapper" rel="nofollow">http://www.codeplex.com/AutoMapper</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karsten</title>
		<link>http://www.markhneedham.com/blog/2009/02/09/oop-what-does-an-objects-responsibility-entail/comment-page-1/#comment-8525</link>
		<dc:creator>Karsten</dc:creator>
		<pubDate>Wed, 11 Feb 2009 14:03:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=914#comment-8525</guid>
		<description>@Nick Drew

To use this strategy, you will still have to change the encapsulation and make bar public.</description>
		<content:encoded><![CDATA[<p>@Nick Drew</p>
<p>To use this strategy, you will still have to change the encapsulation and make bar public.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris Kemper</title>
		<link>http://www.markhneedham.com/blog/2009/02/09/oop-what-does-an-objects-responsibility-entail/comment-page-1/#comment-8389</link>
		<dc:creator>Kris Kemper</dc:creator>
		<pubDate>Mon, 09 Feb 2009 17:48:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=914#comment-8389</guid>
		<description>I personally think that the SRP is a poor principle for object orientation in general. Part of the problem is that it&#039;s too vague. There are certainly objects that represent 2 distinctly different concepts and should be split, but take strictly, I think SRP leads to objects that are overly simplistic and break encapsulation (you&#039;ll often notice this when you see object&#039;s who&#039;s name ends in a verb or agent noun).

That being said, if having an object create representations of itself gets too complicate, either messages or for the UI, then I would try to split it out in some way (like using presenters for views).

In general, I dislike using reflection in java. The reason we suffer it&#039;s verbosity is for it&#039;s static analysis and typing, and if we take that away, we end up with some half crippled bloat language that doesn&#039;t do either static or dynamic well.</description>
		<content:encoded><![CDATA[<p>I personally think that the SRP is a poor principle for object orientation in general. Part of the problem is that it&#8217;s too vague. There are certainly objects that represent 2 distinctly different concepts and should be split, but take strictly, I think SRP leads to objects that are overly simplistic and break encapsulation (you&#8217;ll often notice this when you see object&#8217;s who&#8217;s name ends in a verb or agent noun).</p>
<p>That being said, if having an object create representations of itself gets too complicate, either messages or for the UI, then I would try to split it out in some way (like using presenters for views).</p>
<p>In general, I dislike using reflection in java. The reason we suffer it&#8217;s verbosity is for it&#8217;s static analysis and typing, and if we take that away, we end up with some half crippled bloat language that doesn&#8217;t do either static or dynamic well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dew Drop - February 9, 2009 &#124; Alvin Ashcraft's Morning Dew</title>
		<link>http://www.markhneedham.com/blog/2009/02/09/oop-what-does-an-objects-responsibility-entail/comment-page-1/#comment-8384</link>
		<dc:creator>Dew Drop - February 9, 2009 &#124; Alvin Ashcraft's Morning Dew</dc:creator>
		<pubDate>Mon, 09 Feb 2009 14:20:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=914#comment-8384</guid>
		<description>[...] Is What I Work For&#160;and&#160;OOP: What Does an Object&#8217;s Responsibility Entail? and&#160;Agile: What Is It? (Mark [...]</description>
		<content:encoded><![CDATA[<p>[...] Is What I Work For&#160;and&#160;OOP: What Does an Object&#8217;s Responsibility Entail? and&#160;Agile: What Is It? (Mark [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Drew</title>
		<link>http://www.markhneedham.com/blog/2009/02/09/oop-what-does-an-objects-responsibility-entail/comment-page-1/#comment-8379</link>
		<dc:creator>Nick Drew</dc:creator>
		<pubDate>Mon, 09 Feb 2009 12:45:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=914#comment-8379</guid>
		<description>Hee hee - good old object orientation.  Clearly you should trade and trade and trade.  Then go with the supportive one.

In practice, I 
  
  a) rarely rely on one pattern to guide a design (no, really Mark), or 
  b) consider design to be a static thing.

So if you can evolve comfortably from literal message creation to domain model, then you&#039;re going in the right direction.  Whatever path you took to go there will be reflected in your design.  Each path is valid.  

My main concern is that you focus on one design pattern. I think that having parallel class hierarchies is a smell.  If I find myself creating class A and class AMapperForSystemX, and AMapperForSystemY, I&#039;ll probably look for duplication, and remove it.

DRY may be SRP&#039;s natural enemy...

However, I think it&#039;s fine to use mappers too, except I&#039;ll delegate to a communication strategy:

class A {
  CommunicationPolicy cp;
  populate( Message&lt;A&gt; msg){
    cp.populate( this, msg )
  }
}

where the communication strategy knows how to map and send the message.

So clearly you can have your cake and eat it.

My preferred option is to drive everything from the domain object, and use layers of abstraction to remove duplication or defer committing to a particular design.

Regarding SRP:

Does it just mean I have to encapsulate what I mean by &quot;One thing?&quot;, so rather than &quot;it changes if A or Msg changes&quot;, I phrase it as &quot;it changes if the relationship between A and Msg changes&quot; (which is still one thing).</description>
		<content:encoded><![CDATA[<p>Hee hee &#8211; good old object orientation.  Clearly you should trade and trade and trade.  Then go with the supportive one.</p>
<p>In practice, I </p>
<p>  a) rarely rely on one pattern to guide a design (no, really Mark), or<br />
  b) consider design to be a static thing.</p>
<p>So if you can evolve comfortably from literal message creation to domain model, then you&#8217;re going in the right direction.  Whatever path you took to go there will be reflected in your design.  Each path is valid.  </p>
<p>My main concern is that you focus on one design pattern. I think that having parallel class hierarchies is a smell.  If I find myself creating class A and class AMapperForSystemX, and AMapperForSystemY, I&#8217;ll probably look for duplication, and remove it.</p>
<p>DRY may be SRP&#8217;s natural enemy&#8230;</p>
<p>However, I think it&#8217;s fine to use mappers too, except I&#8217;ll delegate to a communication strategy:</p>
<p>class A {<br />
  CommunicationPolicy cp;<br />
  populate( Message<a> msg){<br />
    cp.populate( this, msg )<br />
  }<br />
}</p>
<p>where the communication strategy knows how to map and send the message.</p>
<p>So clearly you can have your cake and eat it.</p>
<p>My preferred option is to drive everything from the domain object, and use layers of abstraction to remove duplication or defer committing to a particular design.</p>
<p>Regarding SRP:</p>
<p>Does it just mean I have to encapsulate what I mean by &#8220;One thing?&#8221;, so rather than &#8220;it changes if A or Msg changes&#8221;, I phrase it as &#8220;it changes if the relationship between A and Msg changes&#8221; (which is still one thing).</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

