<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The .NET Buffet - All Comments</title><link>http://weblogs.asp.net/drohrer/default.aspx</link><description>.Net, .Net CF, Architecture, and more (would you like Fries with that?)</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Twitter Trackbacks for                 The Dangers of Hammers (or, Why SRP Isn???t Dangerous) - The .NET Buffet         [asp.net]        on Topsy.com</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/20/the-dangers-of-hammers-or-why-srp-isn-t-dangerous.aspx#7262223</link><pubDate>Sat, 21 Nov 2009 03:35:49 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7262223</guid><dc:creator>Twitter Trackbacks for                 The Dangers of Hammers (or, Why SRP Isn???t Dangerous) - The .NET Buffet         [asp.net]        on Topsy.com</dc:creator><author>Twitter Trackbacks for                 The Dangers of Hammers (or, Why SRP Isn???t Dangerous) - The .NET Buffet         [asp.net]        on Topsy.com</author><description>&lt;p&gt;Pingback from &amp;nbsp;Twitter Trackbacks for &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; The Dangers of Hammers (or, Why SRP Isn???t Dangerous) - The .NET Buffet &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [asp.net] &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;on Topsy.com&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7262223" width="1" height="1"&gt;</description></item><item><title>re: In response to "The Dangers of Single Responsibility in Programming"</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/10/in-response-to-quot-the-dangers-of-single-responsibility-in-programming-quot.aspx#7261897</link><pubDate>Fri, 20 Nov 2009 20:39:41 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7261897</guid><dc:creator>Jonathan Allen</dc:creator><author>Jonathan Allen</author><description>&lt;p&gt;When I see things like ICustomer, I can't help but think you messed up. The chances that you need to expand on the Customer class is high. This means breaking the ICustomer interface, which is bad, or creating ICustomer2, ICustomer3, etc, which is worse.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7261897" width="1" height="1"&gt;</description></item><item><title>re: In response to "The Dangers of Single Responsibility in Programming"</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/10/in-response-to-quot-the-dangers-of-single-responsibility-in-programming-quot.aspx#7260631</link><pubDate>Thu, 19 Nov 2009 17:01:58 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7260631</guid><dc:creator>David Cooksey</dc:creator><author>David Cooksey</author><description>&lt;p&gt;Doug,&lt;/p&gt;
&lt;p&gt;You make a number of good points, but given the number of arguments I've been in regarding the SRP, I feel that 'got it wrong' is insufficiently descriptive. &amp;nbsp;I don't believe that we are in disagreement about SRP's application, but I do feel that the frequency with which the SRP is misunderstood is a good indication of how dangerous it is. &amp;nbsp;I have a more detailed response posted.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7260631" width="1" height="1"&gt;</description></item><item><title>The Danger of Single Responsibility in Programming Continued | Thycotic Software Ltd. | Team Blog</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/10/in-response-to-quot-the-dangers-of-single-responsibility-in-programming-quot.aspx#7260498</link><pubDate>Thu, 19 Nov 2009 14:48:13 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7260498</guid><dc:creator>The Danger of Single Responsibility in Programming Continued | Thycotic Software Ltd. | Team Blog</dc:creator><author>The Danger of Single Responsibility in Programming Continued | Thycotic Software Ltd. | Team Blog</author><description>&lt;p&gt;Pingback from &amp;nbsp;The Danger of Single Responsibility in Programming Continued | Thycotic Software Ltd. | Team Blog&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7260498" width="1" height="1"&gt;</description></item><item><title>re: In response to "The Dangers of Single Responsibility in Programming"</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/10/in-response-to-quot-the-dangers-of-single-responsibility-in-programming-quot.aspx#7252384</link><pubDate>Thu, 12 Nov 2009 11:21:31 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7252384</guid><dc:creator>Dhananjay Goyani</dc:creator><author>Dhananjay Goyani</author><description>&lt;p&gt;Nice explanation...&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7252384" width="1" height="1"&gt;</description></item><item><title>re: In response to "The Dangers of Single Responsibility in Programming"</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/10/in-response-to-quot-the-dangers-of-single-responsibility-in-programming-quot.aspx#7251960</link><pubDate>Thu, 12 Nov 2009 02:08:01 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7251960</guid><dc:creator>drohrer</dc:creator><author>drohrer</author><description>&lt;p&gt;Phil - Actually, if you look at the initial problem David put together, there are several types of pricing rules that can apply. &amp;nbsp;Some of them override prices, and some of them modify the previous price. &amp;nbsp;Therefore, the way I implemented it was to pass the &amp;quot;current&amp;quot; price in the loop to each calculator, and let them figure out how to update/modify the price. &amp;nbsp;More specifically, the &amp;quot;Gold Member&amp;quot; price is calculated based on the base price, but if the item is on sale and the sales price is lower than the currently calculated price, the sales price is returned. &amp;nbsp;In this way, you allow all pricing calculators a chance at processing the price. &amp;nbsp;Perhaps there should be some sort of out param that would indicate that price calculations should stop after a certain calculator runs (allowing it to override all other calculator values) but that didn't seem to be part of the business requirements at the time. &amp;nbsp;Does this help you understand it a bit better?&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7251960" width="1" height="1"&gt;</description></item><item><title>re: In response to "The Dangers of Single Responsibility in Programming"</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/10/in-response-to-quot-the-dangers-of-single-responsibility-in-programming-quot.aspx#7251821</link><pubDate>Wed, 11 Nov 2009 23:03:21 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7251821</guid><dc:creator>Phil</dc:creator><author>Phil</author><description>&lt;p&gt;I am a little unsure of this function:&lt;/p&gt;
&lt;p&gt;public decimal GetPrice(IProduct product, ICustomer customer)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; decimal price = product.BasePrice;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; foreach (IPriceCalculator calculator in _calculators)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Right here needs to find the correct &amp;nbsp; //calculator, &amp;nbsp; right?&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; price = calculator.CalculatePrice(price, customer, product);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; return price;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;I think you want to use your IoC container to get the correct calculator. &amp;nbsp;This code will just overwrite price and return whatever the last calculator added calculates. &amp;nbsp;A bit confusing for those unfamiliar with DI.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7251821" width="1" height="1"&gt;</description></item><item><title>re: In response to "The Dangers of Single Responsibility in Programming"</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/10/in-response-to-quot-the-dangers-of-single-responsibility-in-programming-quot.aspx#7251464</link><pubDate>Wed, 11 Nov 2009 14:26:50 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7251464</guid><dc:creator>drohrer</dc:creator><author>drohrer</author><description>&lt;p&gt;&lt;strong&gt;sifarrell&lt;/strong&gt;: Yea - as I said in the original post, I would probably use some DI/IOC container (StructureMap is my personal favoriate right now) to load the calculators - which would handle the open/closed principle issue, but lacking some sort of DI container I would do something like you suggest and pass in the calculators as a constructor parameter.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7251464" width="1" height="1"&gt;</description></item><item><title>Dew Drop &amp;#8211; November 11, 2009 | Alvin Ashcraft&amp;#039;s Morning Dew</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/10/in-response-to-quot-the-dangers-of-single-responsibility-in-programming-quot.aspx#7251446</link><pubDate>Wed, 11 Nov 2009 13:56:21 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7251446</guid><dc:creator>Dew Drop – November 11, 2009 | Alvin Ashcraft's Morning Dew</dc:creator><author>Dew Drop – November 11, 2009 | Alvin Ashcraft's Morning Dew</author><description>&lt;p&gt;Pingback from &amp;nbsp;Dew Drop &amp;amp;#8211; November 11, 2009 | Alvin Ashcraft&amp;amp;#039;s Morning Dew&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7251446" width="1" height="1"&gt;</description></item><item><title>re: In response to "The Dangers of Single Responsibility in Programming"</title><link>http://weblogs.asp.net/drohrer/archive/2009/11/10/in-response-to-quot-the-dangers-of-single-responsibility-in-programming-quot.aspx#7251188</link><pubDate>Wed, 11 Nov 2009 07:36:53 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7251188</guid><dc:creator>sifarrell</dc:creator><author>sifarrell</author><description>&lt;p&gt;Great post!! I've been trying to get my head around real work implementations of the SOLID principles.&lt;/p&gt;
&lt;p&gt;To make the code adhere to the open closed principle you could extend the Pricer class to take in a list of calculators, therefore none of your core code classes would have to change.&lt;/p&gt;
&lt;p&gt;private readonly List&amp;lt;IPriceCalculator&amp;gt; _calculators;&lt;/p&gt;
&lt;p&gt;public Pricer(List&amp;lt;IPriceCalculator&amp;gt; calculators)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; _calculators = calculators;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7251188" width="1" height="1"&gt;</description></item></channel></rss>