<?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: Refactoring Exercise: The Single Responsibility Principle vs Needless Complexity</title>
	<atom:link href="http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity</link>
	<description></description>
	<lastBuildDate>Sun, 12 Feb 2012 18:54:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	<item>
		<title>By: master plastic</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-2/#comment-64475</link>
		<dc:creator>master plastic</dc:creator>
		<pubDate>Sat, 10 Dec 2011 22:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-64475</guid>
		<description>Absolutely unique and fine piece of information. 
&lt;a href=&quot;http://master-pipe.com&quot; rel=&quot;nofollow&quot;&gt;pvc pakistan&lt;/a&gt; I&#039;ve never spent that much time reading before but this is really awesome..  
&lt;a href=&quot;http://masterpipe.pk&quot; rel=&quot;nofollow&quot;&gt;pvc&lt;/a&gt; </description>
		<content:encoded><![CDATA[<p>Absolutely unique and fine piece of information.<br />
<a href="http://master-pipe.com" rel="nofollow">pvc pakistan</a> I&#8217;ve never spent that much time reading before but this is really awesome.. <br />
<a href="http://masterpipe.pk" rel="nofollow">pvc</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Van Ryswyck</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-2/#comment-34944</link>
		<dc:creator>Jan Van Ryswyck</dc:creator>
		<pubDate>Wed, 08 Oct 2008 07:08:20 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-34944</guid>
		<description>@Mark: You are right on the NPE.</description>
		<content:encoded><![CDATA[<p>@Mark: You are right on the NPE.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Anderson</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-2/#comment-34903</link>
		<dc:creator>Mark Anderson</dc:creator>
		<pubDate>Tue, 07 Oct 2008 20:39:15 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-34903</guid>
		<description>Likely another problem with refactoring in notepad:

When you isolated the validation of the user in IsValid(), you lost the behavior that a null username fell out of the Login() method returning false.  The behavior that you have is that if user is null, you are turning around and calling FailedToLogin() on the null user.  Wouldn&#039;t that cause a NPE?</description>
		<content:encoded><![CDATA[<p>Likely another problem with refactoring in notepad:</p>
<p>When you isolated the validation of the user in IsValid(), you lost the behavior that a null username fell out of the Login() method returning false.  The behavior that you have is that if user is null, you are turning around and calling FailedToLogin() on the null user.  Wouldn&#8217;t that cause a NPE?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-2/#comment-34890</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 07 Oct 2008 16:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-34890</guid>
		<description>Not to mention resetting the number of failed login attempts after a successful login?

Also where are you checking to see if the account is locked to see if you should bother validating the username/password anyway?</description>
		<content:encoded><![CDATA[<p>Not to mention resetting the number of failed login attempts after a successful login?</p>
<p>Also where are you checking to see if the account is locked to see if you should bother validating the username/password anyway?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-2/#comment-34889</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 07 Oct 2008 16:00:40 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-34889</guid>
		<description>So where are you persisting the number of failed login attempts, updating that the account was locked and possibly writing the failed attempt or lockout (or both) to a system log?</description>
		<content:encoded><![CDATA[<p>So where are you persisting the number of failed login attempts, updating that the account was locked and possibly writing the failed attempt or lockout (or both) to a system log?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjan`s World &#187; LINKBLOG for October 7, 2008</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-2/#comment-34880</link>
		<dc:creator>Arjan`s World &#187; LINKBLOG for October 7, 2008</dc:creator>
		<pubDate>Tue, 07 Oct 2008 14:13:09 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-34880</guid>
		<description>[...] Refactoring Exercise: The Single Responsibility Principle vs Needless Complexity - Jan van Ryswyk &#8216; Besides good judgment, SRP is also about organizing complexity so that other developers/readers know where to look for it &#8216; [...]</description>
		<content:encoded><![CDATA[<p>[...] Refactoring Exercise: The Single Responsibility Principle vs Needless Complexity &#8211; Jan van Ryswyk &#8216; Besides good judgment, SRP is also about organizing complexity so that other developers/readers know where to look for it &#8216; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dew Drop - October 7, 2008 &#124; Alvin Ashcraft's Morning Dew</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-2/#comment-34878</link>
		<dc:creator>Dew Drop - October 7, 2008 &#124; Alvin Ashcraft's Morning Dew</dc:creator>
		<pubDate>Tue, 07 Oct 2008 13:37:12 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-34878</guid>
		<description>[...] Refactoring Exercise: The Single Responsibility Principle vs Needless Complexity (Jan Van Ryswyck) [...]</description>
		<content:encoded><![CDATA[<p>[...] Refactoring Exercise: The Single Responsibility Principle vs Needless Complexity (Jan Van Ryswyck) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SteveP</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-1/#comment-34807</link>
		<dc:creator>SteveP</dc:creator>
		<pubDate>Mon, 06 Oct 2008 23:41:18 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-34807</guid>
		<description>ack, scratch that. Checking the returned user reference for null, then validating the user against PW.  ^_^ I shouldn&#039;t read code before noon. *sigh*</description>
		<content:encoded><![CDATA[<p>ack, scratch that. Checking the returned user reference for null, then validating the user against PW.  ^_^ I shouldn&#8217;t read code before noon. *sigh*</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SteveP</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-1/#comment-34805</link>
		<dc:creator>SteveP</dc:creator>
		<pubDate>Mon, 06 Oct 2008 23:36:52 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-34805</guid>
		<description>A few random thoughts. (Just finished reading &quot;Clean Code&quot; as well, awesome book.)

Argument validation, generally I try to move this as deep as possible to avoid issues. loginValidator takes a user name &amp; password. Should it ever validate a null (or empty) user name successfully? This would essentially get rid of IsValid().

This would change Login to:
public bool Login(string username, string password)
{
    var user = userRepo.GetUserByUsername(username);
    bool isValid = loginValidator.IsValid(user, password))

    if ( !isValid) // or (false = isValid)
    {
        user.FailedToLogin();
    }

    return isValid;
}

generally I&#039;m a stickler for 1-way-in, 1-way-out.</description>
		<content:encoded><![CDATA[<p>A few random thoughts. (Just finished reading &#8220;Clean Code&#8221; as well, awesome book.)</p>
<p>Argument validation, generally I try to move this as deep as possible to avoid issues. loginValidator takes a user name &amp; password. Should it ever validate a null (or empty) user name successfully? This would essentially get rid of IsValid().</p>
<p>This would change Login to:<br />
public bool Login(string username, string password)<br />
{<br />
    var user = userRepo.GetUserByUsername(username);<br />
    bool isValid = loginValidator.IsValid(user, password))</p>
<p>    if ( !isValid) // or (false = isValid)<br />
    {<br />
        user.FailedToLogin();<br />
    }</p>
<p>    return isValid;<br />
}</p>
<p>generally I&#8217;m a stickler for 1-way-in, 1-way-out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Van Ryswyck</title>
		<link>http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/comment-page-1/#comment-34790</link>
		<dc:creator>Jan Van Ryswyck</dc:creator>
		<pubDate>Mon, 06 Oct 2008 21:57:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/10/06/refactoring-exercise-the-single-responsibility-principle-vs-needless-complexity/#comment-34790</guid>
		<description>Given the fact that I forgot the password argument to the IsValid method, maybe its better to rename this method to &#039;Authenticate&#039; or something?</description>
		<content:encoded><![CDATA[<p>Given the fact that I forgot the password argument to the IsValid method, maybe its better to rename this method to &#8216;Authenticate&#8217; or something?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

