<?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: Coding: Single Level of Abstraction Principle</title>
	<atom:link href="http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/</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: Border Crossings &#187; Blog Archive &#187; The Elements of Style</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-124078</link>
		<dc:creator>Border Crossings &#187; Blog Archive &#187; The Elements of Style</dc:creator>
		<pubDate>Thu, 16 Jun 2011 10:38:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-124078</guid>
		<description>[...] (above) is closely related to the idea of cohesion in routines (Code Complete, p168), and to the &#8220;Single Level of Abstraction Principle&#8221; (SLAP). The first says that a routine should do one thing and one thing only. The second states that the [...]</description>
		<content:encoded><![CDATA[<p>[...] (above) is closely related to the idea of cohesion in routines (Code Complete, p168), and to the &#8220;Single Level of Abstraction Principle&#8221; (SLAP). The first says that a routine should do one thing and one thing only. The second states that the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaun Abram &#187; Blog Archive &#187; OSCON Day1: The Productive Programmer, part 2</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-42186</link>
		<dc:creator>Shaun Abram &#187; Blog Archive &#187; OSCON Day1: The Productive Programmer, part 2</dc:creator>
		<pubDate>Fri, 23 Jul 2010 03:12:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-42186</guid>
		<description>[...] Single Layer of Abstraction Principle Keep all lines of code in a method at the same level of abstraction Jumping abstraction layers makes code hard to understand (See a blog posting on this here) [...]</description>
		<content:encoded><![CDATA[<p>[...] Single Layer of Abstraction Principle Keep all lines of code in a method at the same level of abstraction Jumping abstraction layers makes code hard to understand (See a blog posting on this here) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: • Will a single level of abstraction result in a higher complexity? &#124; test.ical.ly</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-37772</link>
		<dc:creator>• Will a single level of abstraction result in a higher complexity? &#124; test.ical.ly</dc:creator>
		<pubDate>Wed, 26 May 2010 03:11:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-37772</guid>
		<description>[...] bore you with explanations instead I would like those of you who haven&#8217;t heard about it to Mark Needhams blog post which also links to two much recommended books covering this and other [...]</description>
		<content:encoded><![CDATA[<p>[...] bore you with explanations instead I would like those of you who haven&#8217;t heard about it to Mark Needhams blog post which also links to two much recommended books covering this and other [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aligning the abstraction level with constant booleans &#171; Schneide Blog</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-30946</link>
		<dc:creator>Aligning the abstraction level with constant booleans &#171; Schneide Blog</dc:creator>
		<pubDate>Mon, 25 Jan 2010 21:18:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-30946</guid>
		<description>[...] that is the principle to operate on only one level of abstraction within a method or function. See here for a detailed explanation. I have been applying this technique more or less unconsciously already [...]</description>
		<content:encoded><![CDATA[<p>[...] that is the principle to operate on only one level of abstraction within a method or function. See here for a detailed explanation. I have been applying this technique more or less unconsciously already [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-18683</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Mon, 15 Jun 2009 12:00:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-18683</guid>
		<description>@Jonas yeh just because all the other&#039;s are var that one&#039;s var. I tend to have all local variables as var these days. Rarely seem to miss explicitly typing on the left hand side of assignments.</description>
		<content:encoded><![CDATA[<p>@Jonas yeh just because all the other&#8217;s are var that one&#8217;s var. I tend to have all local variables as var these days. Rarely seem to miss explicitly typing on the left hand side of assignments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonas Elfström</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-18678</link>
		<dc:creator>Jonas Elfström</dc:creator>
		<pubDate>Mon, 15 Jun 2009 08:46:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-18678</guid>
		<description>I&#039;m a fan of &quot;var&quot; as much as the next guy but what&#039;s the reasoning behind &quot;var hasExpectedPrefix&quot; instead of &quot;bool hasExpectedPrefix&quot;? Since it only saves you from typing one single character I guess it&#039;s some kind of code convention of yours?</description>
		<content:encoded><![CDATA[<p>I&#8217;m a fan of &#8220;var&#8221; as much as the next guy but what&#8217;s the reasoning behind &#8220;var hasExpectedPrefix&#8221; instead of &#8220;bool hasExpectedPrefix&#8221;? Since it only saves you from typing one single character I guess it&#8217;s some kind of code convention of yours?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-18660</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Sun, 14 Jun 2009 22:09:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-18660</guid>
		<description>@Dan yeh you can have it simplified down to exactly what you said and yeh it can&#039;t be true - the example is slightly wrong actually.

It should be:

var followedBy7Digits = Regex.IsMatch(policyNumber.Substring(6,7), &quot;^[0-9]{7}$&quot;);</description>
		<content:encoded><![CDATA[<p>@Dan yeh you can have it simplified down to exactly what you said and yeh it can&#8217;t be true &#8211; the example is slightly wrong actually.</p>
<p>It should be:</p>
<p>var followedBy7Digits = Regex.IsMatch(policyNumber.Substring(6,7), &#8220;^[0-9]{7}$&#8221;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-18649</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Sun, 14 Jun 2009 16:20:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-18649</guid>
		<description>Perhaps this is because I&#039;m from a Java background and don&#039;t understand C# regex, but ...

Assuming it&#039;s like a POSIX regex, doesn&#039;t the ^ and $ in followedBy7Digits mean &quot;starts with 7 characters of [0-9] and then ends&quot;. If so, how can hasExpectedPrefix &amp;&amp; followedBy7Digits ever be true?

With a bit of refactoring I think you could just have one line:

  return Regex.IsMatch(policyNumber, &quot;^POLIC[0-9]{7}$&quot;);</description>
		<content:encoded><![CDATA[<p>Perhaps this is because I&#8217;m from a Java background and don&#8217;t understand C# regex, but &#8230;</p>
<p>Assuming it&#8217;s like a POSIX regex, doesn&#8217;t the ^ and $ in followedBy7Digits mean &#8220;starts with 7 characters of [0-9] and then ends&#8221;. If so, how can hasExpectedPrefix &amp;&amp; followedBy7Digits ever be true?</p>
<p>With a bit of refactoring I think you could just have one line:</p>
<p>  return Regex.IsMatch(policyNumber, &#8220;^POLIC[0-9]{7}$&#8221;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-18619</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Sun, 14 Jun 2009 00:18:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-18619</guid>
		<description>Hey Zach,

I actually came across this code in an acceptance test/end to end test so I guess then you have the debate of whether or not you should &lt;a href=&quot;http://www.markhneedham.com/blog/2008/11/23/testing-test-code/&quot; rel=&quot;nofollow&quot;&gt;test your test code or not&lt;/a&gt; . 

I think you&#039;re absolutely right that it would have been much easier if it had been TDD&#039;s in this case though.

My pair &amp; I&#039;s goal when we came across this code was to try and pull stuff out so that we could understand what was going on a bit more clearly and although it has rightly been pointed out that we don&#039;t need all of those assertions it did help us at the time.

Mark</description>
		<content:encoded><![CDATA[<p>Hey Zach,</p>
<p>I actually came across this code in an acceptance test/end to end test so I guess then you have the debate of whether or not you should <a href="http://www.markhneedham.com/blog/2008/11/23/testing-test-code/" rel="nofollow">test your test code or not</a> . </p>
<p>I think you&#8217;re absolutely right that it would have been much easier if it had been TDD&#8217;s in this case though.</p>
<p>My pair &#038; I&#8217;s goal when we came across this code was to try and pull stuff out so that we could understand what was going on a bit more clearly and although it has rightly been pointed out that we don&#8217;t need all of those assertions it did help us at the time.</p>
<p>Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Shaw</title>
		<link>http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of-abstraction-principle/comment-page-1/#comment-18618</link>
		<dc:creator>Zach Shaw</dc:creator>
		<pubDate>Sun, 14 Jun 2009 00:01:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1325#comment-18618</guid>
		<description>So... I&#039;ve been wondering this since the first post on this topic, why wasn&#039;t ValidPolicyNumber public / protected / what ever and just TDDed? Then you would have gotten around a lot of the tricky implementation details... like is policy.number == 12 needed.

-Zach</description>
		<content:encoded><![CDATA[<p>So&#8230; I&#8217;ve been wondering this since the first post on this topic, why wasn&#8217;t ValidPolicyNumber public / protected / what ever and just TDDed? Then you would have gotten around a lot of the tricky implementation details&#8230; like is policy.number == 12 needed.</p>
<p>-Zach</p>
]]></content:encoded>
	</item>
</channel>
</rss>

