<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>Design Principle:  Don't Repeat Yourself</title><link>http://blogs.msdn.com/steverowe/archive/2008/05/15/design-principle-don-t-repeat-yourself.aspx</link><description>There's a design principle I neglected to mention in my initial list but which certainly merits attention. That principle is this: whenever possible, don't repeat yourself (DRY). Put another way, do things one time, in one place rather than having the</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Design Principle:  Don't Repeat Yourself</title><link>http://blogs.msdn.com/steverowe/archive/2008/05/15/design-principle-don-t-repeat-yourself.aspx#8508310</link><pubDate>Thu, 15 May 2008 18:46:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8508310</guid><dc:creator>rkpatrick</dc:creator><description>&lt;p&gt;I heard a very similar rule-of-thumb from my OO prof back in college. He worked at SGI and was just teaching as an adjunct, but I still have the phrase burned into my mind because I adhere to it to this day: &amp;quot;If you find yourself doing a copy/paste while you're coding, you're likely doing something wrong&amp;quot;.&lt;/p&gt;
</description></item><item><title>Design Principles To Live By</title><link>http://blogs.msdn.com/steverowe/archive/2008/05/15/design-principle-don-t-repeat-yourself.aspx#8508596</link><pubDate>Thu, 15 May 2008 20:44:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8508596</guid><dc:creator>Steve Rowe's Blog</dc:creator><description>&lt;p&gt;Object-oriented design and design patterns can seem complex. There are a lot of ideas and cases to consider.&lt;/p&gt;
</description></item><item><title>re: Design Principle:  Don't Repeat Yourself</title><link>http://blogs.msdn.com/steverowe/archive/2008/05/15/design-principle-don-t-repeat-yourself.aspx#8508900</link><pubDate>Thu, 15 May 2008 22:14:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8508900</guid><dc:creator>Mark Sowul</dc:creator><description>&lt;p&gt;This is my number one rule (its corollary is &amp;quot;don't hard-code constants&amp;quot;).&lt;/p&gt;
&lt;p&gt;If there's anything that will make your successor want to hang you in effigy (thanks Raymond), it's copying and pasting code.&lt;/p&gt;
</description></item><item><title>re: Design Principle:  Don't Repeat Yourself</title><link>http://blogs.msdn.com/steverowe/archive/2008/05/15/design-principle-don-t-repeat-yourself.aspx#8550872</link><pubDate>Sun, 25 May 2008 13:53:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8550872</guid><dc:creator>Shane MacLaughlin</dc:creator><description>&lt;p&gt;No doubt I'm telling Grandma how to suck eggs here but..&lt;/p&gt;
&lt;p&gt;This reminds me very much of the traditional computer science arguments relating to cohesion and coupling. &amp;nbsp;If you are tempted to cut &amp;amp; paste a piece of code (functionality) from somewhere, with the intention of modifying it slightly, there is a good argument for generalising the existing functionality to handle the new requirements as this will lead to less code to maintain in future. &amp;nbsp;The counter argument is that by modifying the existing functionality you risk breaking systems that depend on that functionality, and require additional interfaces to that functionality. &amp;nbsp;Basically, do we increase cohesion (good), or minimise coupling (good), where the two are in opposition. &amp;nbsp;My OO approach is usually to add a new interface to the existing functionality, in order to minimise potential for breaking existing code, i.e. favouring strong external cohesion at the cost of some extra coupling. &amp;nbsp;Where I'm adding additional parameters to support new requirements, I base it on the nearest interface, and change the body of that interface to call the new interface with default values for new parameters. &amp;nbsp;This is an attempt to maximise internal cohesion.&lt;/p&gt;
&lt;p&gt;Interestingly ( or not :) ), I'm seeing quite a bit of discussion on cyclomatic complexity at the moment on another forum, and I find that changing older and legacy interfaces to call newer interfaces as a mechanism for maximising internal cohesion also reduces cyclomatic complexity.&lt;/p&gt;
&lt;p&gt;Really just a load of obscure technical jargon referring to the same thing, and nothing that new to experienced programmers.&lt;/p&gt;
</description></item><item><title>Quote of the Day</title><link>http://blogs.msdn.com/steverowe/archive/2008/05/15/design-principle-don-t-repeat-yourself.aspx#8832123</link><pubDate>Mon, 04 Aug 2008 23:59:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8832123</guid><dc:creator>Simone 'Wiz' Tellini</dc:creator><description>&lt;p&gt;[...] a good programmer cultivates the virtue of laziness. (But not just any laziness: you must be aggressively, proactively lazy!) -- Chris Pine, dealing with the DRY rule&lt;/p&gt;
</description></item></channel></rss>