<?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: Anti-Patterns and Worst Practices – Utils Class</title>
	<atom:link href="http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/</link>
	<description>Thoughts while working and playing as a Software Developer</description>
	<lastBuildDate>Thu, 11 Apr 2013 16:53:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Dark Phoenix</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-444</link>
		<dc:creator>Dark Phoenix</dc:creator>
		<pubDate>Fri, 07 Sep 2012 15:30:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-444</guid>
		<description>Well, I don&#039;t really see a need for a Utils collection in something like Java/.NET, but I know in my PHP library I have a utilities file.  It contains functions that perform generic actions on primitives that don&#039;t really belong in any specific class (for example, merging two arrays, checking for string prefixes/suffixes, and so on).  And even in that situation, when a lot of functions on one primitive start to pile up, it&#039;s usually a clue to write a class abstraction over that primitive (for example, I have 15 or so string functions, so I&#039;m working on refactoring them into a String abstraction class rather than leave them as loose functions).</description>
		<content:encoded><![CDATA[<p>Well, I don&#8217;t really see a need for a Utils collection in something like Java/.NET, but I know in my PHP library I have a utilities file.  It contains functions that perform generic actions on primitives that don&#8217;t really belong in any specific class (for example, merging two arrays, checking for string prefixes/suffixes, and so on).  And even in that situation, when a lot of functions on one primitive start to pile up, it&#8217;s usually a clue to write a class abstraction over that primitive (for example, I have 15 or so string functions, so I&#8217;m working on refactoring them into a String abstraction class rather than leave them as loose functions).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Missal</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-391</link>
		<dc:creator>Chris Missal</dc:creator>
		<pubDate>Tue, 12 Jun 2012 13:52:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-391</guid>
		<description>Thanks for pointing that out, it&#039;s fixed now. I also found some broken links that I could correct, cheers!</description>
		<content:encoded><![CDATA[<p>Thanks for pointing that out, it&#8217;s fixed now. I also found some broken links that I could correct, cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Any name which u like to call</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-389</link>
		<dc:creator>Any name which u like to call</dc:creator>
		<pubDate>Tue, 12 Jun 2012 06:23:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-389</guid>
		<description>The code snippets are not line wrapped. It&#039;s annoying. </description>
		<content:encoded><![CDATA[<p>The code snippets are not line wrapped. It&#8217;s annoying. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-112</link>
		<dc:creator>steve</dc:creator>
		<pubDate>Fri, 11 Mar 2011 21:07:32 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-112</guid>
		<description>I think Utilities classes are a great way to PREVENT code redundancy - they give the common developer a single place to look for utilities.  Also they make code more readable. 

I agree, that Log4J should be used instead of writing your own logger.... But in a typical application , there often exist clumsy , verbose API&#039;s for doing simple tasks ... i.e. low level API&#039;s for executing queries.  Its alot easier to read code that sais 

List&lt;Employee&gt; employees = db.getAllEmployees();
BeanUtilities.sortResults(employees, &quot;birthday&quot;); 

then to write 

Collections.sort(employees, new Comparable(Object e){
return java.util.Date.compare ... (Employee)e.getBirthday().......}; //you get the point !

Furthermore when internal APIs for such tasks are used, they encourage developers to actually USE the same mechanism and logic over.  

Classes and object orientation are great, but its easy to get lost in a sea of objects.... Utilities classes that wrap objects and muddy APIs are extremely valuable.  </description>
		<content:encoded><![CDATA[<p>I think Utilities classes are a great way to PREVENT code redundancy &#8211; they give the common developer a single place to look for utilities.  Also they make code more readable. </p>
<p>I agree, that Log4J should be used instead of writing your own logger&#8230;. But in a typical application , there often exist clumsy , verbose API&#8217;s for doing simple tasks &#8230; i.e. low level API&#8217;s for executing queries.  Its alot easier to read code that sais </p>
<p>List<employee> employees = db.getAllEmployees();<br />
BeanUtilities.sortResults(employees, &#8220;birthday&#8221;); </p>
<p>then to write </p>
<p>Collections.sort(employees, new Comparable(Object e){<br />
return java.util.Date.compare &#8230; (Employee)e.getBirthday()&#8230;&#8230;.}; //you get the point !</p>
<p>Furthermore when internal APIs for such tasks are used, they encourage developers to actually USE the same mechanism and logic over.  </p>
<p>Classes and object orientation are great, but its easy to get lost in a sea of objects&#8230;. Utilities classes that wrap objects and muddy APIs are extremely valuable.  </employee></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AndyB</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-111</link>
		<dc:creator>AndyB</dc:creator>
		<pubDate>Thu, 04 Jun 2009 04:10:13 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-111</guid>
		<description>Chris

After following the SRP and DRY principles a couple of times, what you explain above should become almost instinctive for a good developer. 
What I mean by instinctive isn&#039;t necessarily that you remove or avoid these Utility classes without thinking but rather when you see or think of them, you get that stench of bad / rotting code.  Your design nose then gets more sensitive as you plough on to the next projects.
Anyways, good post!

@Ryan - a single Manager class or multiple XYZManager classes or both?
</description>
		<content:encoded><![CDATA[<p>Chris</p>
<p>After following the SRP and DRY principles a couple of times, what you explain above should become almost instinctive for a good developer.<br />
What I mean by instinctive isn&#8217;t necessarily that you remove or avoid these Utility classes without thinking but rather when you see or think of them, you get that stench of bad / rotting code.  Your design nose then gets more sensitive as you plough on to the next projects.<br />
Anyways, good post!</p>
<p>@Ryan &#8211; a single Manager class or multiple XYZManager classes or both?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Svihla</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-110</link>
		<dc:creator>Ryan Svihla</dc:creator>
		<pubDate>Thu, 04 Jun 2009 03:33:01 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-110</guid>
		<description>Can we have a special mention for &quot;Manager&quot; classes.</description>
		<content:encoded><![CDATA[<p>Can we have a special mention for &#8220;Manager&#8221; classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Missal</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-109</link>
		<dc:creator>Chris Missal</dc:creator>
		<pubDate>Tue, 02 Jun 2009 14:37:28 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-109</guid>
		<description>@Dustin
Ha, I like that... &quot;MissalCode&quot;</description>
		<content:encoded><![CDATA[<p>@Dustin<br />
Ha, I like that&#8230; &#8220;MissalCode&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dustin Thostenson</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-108</link>
		<dc:creator>Dustin Thostenson</dc:creator>
		<pubDate>Tue, 02 Jun 2009 13:50:29 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-108</guid>
		<description>Yet another handy installment of MissalCode!  Thanks Chris!</description>
		<content:encoded><![CDATA[<p>Yet another handy installment of MissalCode!  Thanks Chris!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Fisher</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-107</link>
		<dc:creator>Daniel Fisher</dc:creator>
		<pubDate>Tue, 02 Jun 2009 06:43:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-107</guid>
		<description>1) Since Extension Methods are in place ther mustn&#039;t be Util-Classes

2) Take whats already in the platform: System.Diagnostics

Rgs,
Daniel</description>
		<content:encoded><![CDATA[<p>1) Since Extension Methods are in place ther mustn&#8217;t be Util-Classes</p>
<p>2) Take whats already in the platform: System.Diagnostics</p>
<p>Rgs,<br />
Daniel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Missal</title>
		<link>http://lostechies.com/chrismissal/2009/06/01/anti-patterns-and-worst-practices-utils-class/#comment-106</link>
		<dc:creator>Chris Missal</dc:creator>
		<pubDate>Mon, 01 Jun 2009 18:23:46 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx#comment-106</guid>
		<description>@Karthik
Foremost, you want to make sure that your classes only have one reason to change. If you&#039;re looking to add something new, there&#039;s likely a chance you&#039;ll want to add a new class(es). Modifying existing functionality would probably allow you to keep the code in an existing class. As for naming it, something obvious is always good; I don&#039;t mind long class names most of the time, intellisense helps speed things up so you don&#039;t have to type the whole class name most of the time (there should be limits of course ;) A lot of this has to do with the domain you&#039;re working in and there isn&#039;t a set of rules you must follow, just keep an open mind and don&#039;t be afraid to see and fix any mistakes.</description>
		<content:encoded><![CDATA[<p>@Karthik<br />
Foremost, you want to make sure that your classes only have one reason to change. If you&#8217;re looking to add something new, there&#8217;s likely a chance you&#8217;ll want to add a new class(es). Modifying existing functionality would probably allow you to keep the code in an existing class. As for naming it, something obvious is always good; I don&#8217;t mind long class names most of the time, intellisense helps speed things up so you don&#8217;t have to type the whole class name most of the time (there should be limits of course ;) A lot of this has to do with the domain you&#8217;re working in and there isn&#8217;t a set of rules you must follow, just keep an open mind and don&#8217;t be afraid to see and fix any mistakes.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
