<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>StupidZombie &#187; refactoring</title>
	<atom:link href="http://stupidzombie.com/blog/tag/refactoring/feed/" rel="self" type="application/rss+xml" />
	<link>http://stupidzombie.com/blog</link>
	<description>Updates and news of Blockhead</description>
	<lastBuildDate>Wed, 28 Oct 2009 15:05:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Refactoring, refactoring&#8230;</title>
		<link>http://stupidzombie.com/blog/2009/04/11/refactoring-refactoring/</link>
		<comments>http://stupidzombie.com/blog/2009/04/11/refactoring-refactoring/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 12:05:35 +0000</pubDate>
		<dc:creator>josevnz</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[zombie]]></category>
		<category><![CDATA[enumerations]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://stupidzombie.com/blog/?p=23</guid>
		<description><![CDATA[Yep. Old code was &#8230; old, and kind of ugly. Okay, just plain ugly. So refactoring was in order, like on the Ping Factory class which looks much cleaner now: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [...]]]></description>
			<content:encoded><![CDATA[<p>Yep. Old code was &#8230; old, and kind of ugly. Okay, just plain ugly. So refactoring was in order, like on the Ping Factory class which looks much cleaner now:</p>

<div class="wp_codebox"><table><tr id="p232"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code" id="p23code2"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.management.ManagementFactory</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Set</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.TreeSet</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Level</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Logger</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.prefs.Preferences</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ResourceBundle</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.management.MBeanServer</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.management.ObjectName</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Factory class to return the proper Ping instance
 * @author undead@stupidzombie.com
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">class</span> PingFactory <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Supported ping types
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">enum</span> PingTypes <span style="color: #009900;">&#123;</span>
&nbsp;
		<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aunknown+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">UNKNOWN</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span>, <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>, 
		TO2BLOGS<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;To2Blogs&quot;</span>, <span style="color: #0000ff;">&quot;PINGBLOG_TO2BLOGS_UNIQUEID&quot;</span><span style="color: #009900;">&#41;</span>, 
		BLOGALAXIA<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Blogalaxia&quot;</span>, <span style="color: #0000ff;">&quot;PINGBLOG_BLOGALAXIA_UNIQUEID&quot;</span><span style="color: #009900;">&#41;</span>, 
		VENEBLOGS<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Venblogs&quot;</span>, <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>, 
		WEBLOGS<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Weblogs&quot;</span>, <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>, 
		TECHNORATI<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Technorati&quot;</span>, <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>, 
		BITACORASCOM<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Bitacoras.com&quot;</span>, <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>, 
		PINGOMATIC<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PingOMatic&quot;</span>, <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> desc<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> id<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> PingTypes<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> aDesc, <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> aId<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			desc <span style="color: #339933;">=</span> aDesc<span style="color: #339933;">;</span>
			id <span style="color: #339933;">=</span> aId<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> PingFactory factory<span style="color: #339933;">;</span>
       <span style="color: #666666; font-style: italic;">// Rest of the code ommited :)</span></pre></td></tr></table></div>

<p>it is amazing how simple Enumerations simplified the code on this class. Now working on the ping controller, that section is long overdue <img src='http://stupidzombie.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://stupidzombie.com/blog/2009/04/11/refactoring-refactoring/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
