<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Andy Palmer - Latest Comments in Static Utility Methods</title><link>http://andypalmer.disqus.com/</link><description></description><atom:link href="https://andypalmer.disqus.com/static_utility_methods/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 22 May 2008 12:38:00 -0000</lastBuildDate><item><title>Re: Static Utility Methods</title><link>http://andypalmer.com/2008/05/static-utility-methods/#comment-9117635</link><description>&lt;p&gt;It's true with StringUtils.reverse that I would be unlikely to want to change the implementation, but I would much rather write:&lt;br&gt;"abc1234".reverse();&lt;br&gt;&lt;br&gt;than:&lt;br&gt;&lt;br&gt;StringUtils.reverse("abc1234");&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;I think if I bumped into one of the instances I mentioned where I wanted to be able to change out the configuration at runtime, then I would use an instance wrapper around a static method...&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;My opinions are no way set in stone, it's just that static methods make me feel icky and I'm not 100% sure why :-)&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Andy</dc:creator><pubDate>Thu, 22 May 2008 12:38:00 -0000</pubDate></item><item><title>Re: Static Utility Methods</title><link>http://andypalmer.com/2008/05/static-utility-methods/#comment-9117634</link><description>&lt;p&gt;You'd have to involve at least 3 classes and some DI library refs to accomplish your two strategies scenario. Even then you're still coupled to one of those 3 types (interface or abstract class supertype). This complexity may be appropriate at some times, but the setup/overhead/code is overkill for a great number of common cases. Think of Math.cos or StringUtils.reverse - very unlikely that'd you'd want to change those, much less do the plumbing for keeping instances of those utility class available in some global context.&lt;br&gt;&lt;br&gt;&lt;br&gt;Your post did leads me to wonder: what if static methods could be "extended" how might that work. I certainly haven't thought through that extensively. I'm sure the java language people have, and there must be great reasons why its not possible.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Maybe look at it this way: using "composition," you can make whatever instantiable utility classes to wrap any existing other classes/methods you find are otherwise unsatisfactory.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mc</dc:creator><pubDate>Wed, 21 May 2008 08:05:00 -0000</pubDate></item></channel></rss>