<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>refactoring &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/refactoring/</link>
	<description>Feed of posts on WordPress.com tagged "refactoring"</description>
	<pubDate>Sun, 29 Nov 2009 13:03:32 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Prezentare - Pimp My Architecture]]></title>
<link>http://cultivatinro.wordpress.com/2009/11/25/prezentare-pimp-my-architecture/</link>
<pubDate>Wed, 25 Nov 2009 19:50:56 +0000</pubDate>
<dc:creator>Bogdan Mocanu</dc:creator>
<guid>http://cultivatinro.wordpress.com/2009/11/25/prezentare-pimp-my-architecture/</guid>
<description><![CDATA[Am vizionat recent o prezentare pe InfoQ, ținută de Dan North, consultant principal la ThoughtWorks.]]></description>
<content:encoded><![CDATA[Am vizionat recent o prezentare pe InfoQ, ținută de Dan North, consultant principal la ThoughtWorks.]]></content:encoded>
</item>
<item>
<title><![CDATA[Eclipse IDE Refactoring, Searching &amp; Navigating Trips &amp; Tricks]]></title>
<link>http://tecnoesis.wordpress.com/2009/11/25/eclipse-ide-productivity-tips-tricks-refactoring-searching-navigating/</link>
<pubDate>Wed, 25 Nov 2009 16:09:20 +0000</pubDate>
<dc:creator>Rajani Ramsagar</dc:creator>
<guid>http://tecnoesis.wordpress.com/2009/11/25/eclipse-ide-productivity-tips-tricks-refactoring-searching-navigating/</guid>
<description><![CDATA[  Eclipse IDE Productivity Tips &amp; Tricks – Refactoring, Searching &amp; Navigating:   In continu]]></description>
<content:encoded><![CDATA[  Eclipse IDE Productivity Tips &amp; Tricks – Refactoring, Searching &amp; Navigating:   In continu]]></content:encoded>
</item>
<item>
<title><![CDATA[Eclipse IDE Editing Source Trips &amp; Tricks]]></title>
<link>http://tecnoesis.wordpress.com/2009/11/25/eclipse-ide-productivity-tips-tricks-editing-source/</link>
<pubDate>Wed, 25 Nov 2009 15:09:09 +0000</pubDate>
<dc:creator>Rajani Ramsagar</dc:creator>
<guid>http://tecnoesis.wordpress.com/2009/11/25/eclipse-ide-productivity-tips-tricks-editing-source/</guid>
<description><![CDATA[  Eclipse IDE Productivity Tips &amp; Tricks &#8211; Editing Source: Okay, we might know about few o]]></description>
<content:encoded><![CDATA[  Eclipse IDE Productivity Tips &amp; Tricks &#8211; Editing Source: Okay, we might know about few o]]></content:encoded>
</item>
<item>
<title><![CDATA[remove-temps - Refactoring script para apagar arquivos temporários]]></title>
<link>http://hugomaia.wordpress.com/2009/11/25/remove-temps-refactoring-script-para-apagar-arquivos-temporarios/</link>
<pubDate>Wed, 25 Nov 2009 13:17:43 +0000</pubDate>
<dc:creator>hugomaia</dc:creator>
<guid>http://hugomaia.wordpress.com/2009/11/25/remove-temps-refactoring-script-para-apagar-arquivos-temporarios/</guid>
<description><![CDATA[Adicionei no projeto Refactoring-scripts um novo script: o remove-temps. Ele apenas busca recursivam]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Adicionei no <a href="http://github.com/hugomaia/Refactoring-scripts">projeto Refactoring-scripts</a> um novo script: o remove-temps. Ele apenas busca recursivamente em um diretório por arquivos temporários e os elimina. Como é útil rodar antes de comitar, adicionei a opção -g, ou &#8211;git, que executa o comando &#8220;git rm&#8221; para todos os arquivos temporários, sendo que para utilizar esta opção, deve-se estar na diretório root do projeto e os arquivos ainda devem existir.</p>
<p>[]&#8217;s</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Software Reuse Quick Tip #24]]></title>
<link>http://artofsoftwarereuse.com/2009/11/25/software-reuse-quick-tip-24/</link>
<pubDate>Wed, 25 Nov 2009 12:32:42 +0000</pubDate>
<dc:creator>vijaynarayanan</dc:creator>
<guid>http://artofsoftwarereuse.com/2009/11/25/software-reuse-quick-tip-24/</guid>
<description><![CDATA[Tip #24 &#8211; Identify common behavior and encapsulate it Looking for common behavior across class]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Tip #24 &#8211; Identify common behavior and encapsulate it<br />
</strong></p>
<p>Looking for common behavior across classes is an effective way to reuse behavior. When you find yourself cutting and pasting code, take a step back and reflect on the common behavior that is being implemented. If the duplication is due to the same behavior realized in different ways, introduce a new interface. If multiple objects have the same functionality and can derive from a parent object, introduce an inheritance hierarchy.</p>
<p>This can be done in an iterative fashion as well &#8211; if you failed to recognize an interface initially that is okay. Look for opportunities to refactor existing code to introduce a new interface. For example, you can use the Eclipse IDE&#8217;s refactoring feature &#8211; extract interface &#8211; to create a new interface from an existing class.</p>
<p>Why is this important for systematic reuse? Because, by isolating and realizing common behavior you reduce the need for multiple components and classes to re-implement the same functionality. If two classes need the same piece of data, or if they both connect with the same external system, why would you want to code them separately?</p>
<p><strong>Like this post?</strong> Subscribe to <a href="http://feeds2.feedburner.com/SoftwareReuseInTheRealWorld">RSS feed</a> or get blog <a href="http://feedburner.google.com/fb/a/mailverify?uri=SoftwareReuseInTheRealWorld&#38;loc=en_US">updates via email</a>.</p>
<p style="text-align:right;"><strong> <a href="http://twitter.com/home?status=http://wp.me/ptCiB-lM"><img title="tweet this" src="/files/2009/10/twitter2.png" alt="tweet this" width="32" height="32" /></a> <a href="http://del.icio.us/post?url=http://wp.me/ptCiB-lM&#38;title=Software Reuse Quick Tip #24"><img title="del.icio.us:Software Reuse Quick Tip #24" src="/files/2009/10/dellicious.png" alt="add to del.icio.us" width="32" height="32" /></a></strong> <a href="http://www.facebook.com/sharer.php?u=http://wp.me/ptCiB-lM&#38;title=Software Reuse Quick Tip #24"><img title="facebook:Software Reuse Quick Tip #24" src="/files/2009/10/48x48.png" alt="post to facebook" width="32" height="32" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Agile revelations part 2]]></title>
<link>http://implementingagile.wordpress.com/2009/11/21/agile-revelations-part-2/</link>
<pubDate>Sat, 21 Nov 2009 23:04:52 +0000</pubDate>
<dc:creator>Paul Harrington</dc:creator>
<guid>http://implementingagile.wordpress.com/2009/11/21/agile-revelations-part-2/</guid>
<description><![CDATA[My last Agile Revelations post was an unexpected foray into the reasons behind why I love Agile so m]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>My last <a href="http://implementingagile.wordpress.com/2009/09/11/agile-revelations/">Agile Revelations</a> post was an unexpected foray into the reasons behind why I love Agile so much. Written on a Friday night, a bit bored, it started me thinking about my career in software development and how I got to this point in my life.</p>
<p>So if you weren&#8217;t put off by my previous post and are still interested in what motivates people like me to pursue this most rewarding of methodologies then read on&#8230;&#8230;..</p>
<p>So where was I? Oh yes, I was still in my first development job and I&#8217;d just finished reading <a href="http://www.amazon.co.uk/Extreme-Programming-Explained-Embrace-Change/dp/0321278658">Extreme Programming: embrace change</a> by Kent Beck &#8211; the book which single-handedly inspired me to take on Agile. I&#8217;d been in that role for about a year by the time I finished the book and at around the same time I completed my full MCSD in my spare time. And it was lucky because within a month my company had no more C# work for me (they&#8217;d decided to re-write in java) so I took a junior C# developer role with a new company.</p>
<p>The development work there was challenging for a relatively in-experienced developer so I found it hard work implementing real WinForms and ASP.Net Web applications into production, but the hardest thing about it was that between projects there was a lot of &#8220;sitting around time&#8221; where we would be waiting for work (read spec documents as it was a classic waterfall environment!). This was so immensely painful as I hate being bored, having to pester people to give me work to do so in the end I used this time to improve my development skills and learn more about Agile.</p>
<p>The funny thing is that nowadays “being Agile” is such a buzz word and everybody and his dog is claiming that their company is doing it. But at the time it still felt very new (well I guess it was in the UK) and it wasn’t enough to just read buzz word books about XP &#8211; I wanted to learn the coding principles behind Agile and understand what made these programmers (apparently) so talented.</p>
<p>So I spent loads of time reading blogs, researching who was saying the most about Agile and XP and (to name but a few) I came up with some very well known writers on these subjects: <a href="http://www.martinfowler.com/bliki/">Martin Fowler</a>, <a href="http://www.threeriversinstitute.org/blog/?p=29">Kent Beck</a> and my own personal God <a href="//codebetter.com/blogs/jeremy.miller/">Jeremy Miller</a>.</p>
<p>I quickly realised that an Agile methodogy is useless if you don&#8217;t know how to write quality code so I started buying books which concentrated on improving development skills and writing clean code, here are just a few I started out with:</p>
<p><a href="http://www.amazon.co.uk/Refactoring-Improving-Design-Existing-Technology/dp/0201485672">Refactoring</a> by Martin Fowler<br />
<a href="http://www.amazon.co.uk/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530">Test Driven Development</a> by Kent Beck<br />
<a href="http://www.amazon.co.uk/Enterprise-Application-Architecture-Addison-Wesley-signature/dp/0321127420">POEAA</a> by Martin Fowler<br />
<a href="http://www.amazon.co.uk/Head-First-Design-Patterns-Freeman/dp/0596007124">Head first Design Patterns</a> by the Freemans<br />
<a href="http://www.amazon.co.uk/Applying-Domain-Driven-Design-Patterns-Using/dp/0321268202">Applying DDD</a> by Jimmy Nilsson</p>
<p>And that was how I spent my 2nd year in software development. It was an interesting time and for anyone just starting out I would definitely recommend these writers (and obviously a whole load more now &#8211; you&#8217;ll have to wait for part 3 for those!). The only caveat I would say is that these guys are so good that I did sometimes feel out of my depth, thinking I would never be able to write code as well as them (which is probably still true but I do at least now try!). I think this was probably a very natural reaction but to counter it I would recommend that rather than just reading about the concepts, try to implement them as often as you can in production code.  With that said, the best way to ultimately learn is to find an environment with technically excellent, like minded people, eager to learn the same values and able to implement them in production.</p>
<p>Enter <a href="www.uswitch.com">uSwitch</a> stage left <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Until next time&#8230;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Pushing the envelope]]></title>
<link>http://softwareprototyping.net/2009/11/21/pushing-the-envelope/</link>
<pubDate>Sat, 21 Nov 2009 08:27:31 +0000</pubDate>
<dc:creator>reynardthomson</dc:creator>
<guid>http://softwareprototyping.net/2009/11/21/pushing-the-envelope/</guid>
<description><![CDATA[Sometimes a design will arrive for an everyday item that’s so blindingly obvious yet revolutionary y]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Sometimes a design will arrive for an everyday item that’s so blindingly obvious yet revolutionary you have to wonder why nobody did it before.</p>
<p>Such a design is the <a href="http://www.minkyu.co.uk/Site/Product/Entries/2009/4/20_Folding_Plug_System.html" target="_blank">folding plug</a>, designed by Min-kyu Choi.</p>
<p>Taking inspiration from the Apple Macbook Air, which is advertised as being the ‘world’s thinnest laptop’, Min-kyu found irony in the fact that this wonder of modern design was saddled with the rather archaic and clunky UK three-pin plug:</p>
<p><a href="http://protosmart.wordpress.com/files/2009/11/macbook-air-plug-envelope.jpg"></a><img class="alignnone size-full wp-image-205" title="macbook-air-plug-envelope" src="http://protosmart.wordpress.com/files/2009/11/macbook-air-plug-envelope1.jpg" alt="Picture of Macbook Air and folding plug in an envelope" width="400" height="649" /></p>
<p>In a breathtakingly simple but inspired design, Min-kyu has created a clever folding plug which occupies under 1/3 of the space of a conventional UK plug.  Thinner than your little finger when folded, this beautiful bit of design refactoring takes plug design forward in leaps and bounds:</p>
<p><img class="alignnone size-medium wp-image-204" title="folding-plugs" src="http://protosmart.wordpress.com/files/2009/11/folding-plugs.jpg?w=227" alt="Picture of folding plugs" width="227" height="300" /></p>
<p>As software designers, we should be actively seeking out the ‘chunky plugs’ in our world – awkward, unfriendly, approaches to interaction that have somehow become the ‘norm’.  These are the things that people put up with despite their shortcomings.  If we put the effort in, we shall and will find them.  We may even be able to come up with something significantly better.</p>
<p>Min-kyu deserves great credit and recognition for making such an improvement to an everyday object.  I hope that you can find your own ‘chunky plug’ and make your own mark.  After all, that’s the essence of good design – improving our everyday lives.</p>
<p><iframe src='http://digg.com/api/diggthis.php?u=http%3A%2F%2Fdigg.com%2Fdesign%2FPushing_the_envelope_4' height='82' width='55' frameborder='0' scrolling='no' style='float: right; margin-left: 10px; margin-bottom: 5px; padding: 4px 0 2px 4px; background: #fff;'></iframe></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[The Power of Dumb Ideas II]]></title>
<link>http://blog.criticalresults.com/2009/11/20/dumb-idea-ii/</link>
<pubDate>Fri, 20 Nov 2009 17:32:06 +0000</pubDate>
<dc:creator>Mark W. Schumann</dc:creator>
<guid>http://blog.criticalresults.com/2009/11/20/dumb-idea-ii/</guid>
<description><![CDATA[Recently I wrote about some of the Really Big Cool Commercial Things people tried to do on the Inter]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Recently I <a title="The Power of Dumb Ideas I" href="http://blog.criticalresults.com/2009/10/30/dumb-idea-i/">wrote about</a> some of the Really Big Cool Commercial Things people tried to do on the Internet when it was still kind of a fad. These Big Things tended not to work out either because they didn&#8217;t make sense to begin with, or because their perpetrators could never settle for something that <em>actually worked and delivered value.</em></p>
<p>I think (and said then) that this is probably because people often enter into business for reasons other than <em>doing stuff that works and delivers value.</em> If, on the other hand, you *cough* <strong>do stuff that works and delivers value</strong> it&#8217;s a lot more likely your business will do well. Notably, it doesn&#8217;t have to have an amazing idea behind it.</p>
<p>My favorite example of this is those nifty little PC-based cash registers. I&#8217;m a bit out of date on who has what these days, but back in the early and middle 1990s it seemed like one out of four mall stores had something from Systems for Today&#8217;s Retailer, which went by STR most of the time when I worked there.</p>
<p>STR started a little like this. Scott and Chuck what I call a dumb idea: to mimic those $10,000 intelligent cash registers that know how much everything costs, calculate discounts, print time cards, keep inventory up to date, and send sales data back to the corporate offices. Except they would do it for around $3,000 on an industry-standard PC.</p>
<h2>That&#8217;s all. That was the big idea.</h2>
<p>I&#8217;m sorry, there just isn&#8217;t very much to it.</p>
<p>It hit <strong>big.</strong> Everyone wanted this. They made their first sale to a small chain of jewelry stores headquartered in California. Then there were a couple of local Ohio customers. A place that sold swimming pool supplies, stuff like that. There was a chain of pet supply stores. And a nascent chain of computer superstores. None of these were gigantic wins, but they were mostly solid customers who paid a fair price for a good product.</p>
<p>Hey, there were a lot of problems with the software. By the time I showed up as the fifth employee, Scott&#8217;s office contained a clear box of 5.25&#8243; floppy diskettes, generally three for the <em>uniquely copied</em> source code for each client&#8217;s custom applications. &#8220;Source control&#8221; was pulling things out of the box and putting them back.</p>
<p>What we considered the &#8220;base&#8221; application was about 160,000 lines of Clipper code, largely cut and paste from previous versions. In fact, one of my first really big refactorings involved merging eleven slightly different versions of the main item entry function into one, with just a little branching to distinguish the eleven kinds of transactions. It wasn&#8217;t the best code base to work with.</p>
<h2>But it didn&#8217;t matter, not then, not really.</h2>
<p>The key thing Scott and Chuck did, and this was seriously brilliant, was to <em>figure out what people wanted to pay money for</em> and <em>making it work well enough to use.</em> (Well, that and hiring me.) In a few years, STR had become fairly stable and rather profitable. We had matching 401(k) plans and good health insurance. It was a good place to work, and the software itself got quite a bit better as we improved our code and project management practices.</p>
<p>I started working with those guys almost twenty years ago now, and I <em>still</em> keep thinking&#8230; wow, it&#8217;s just a cash register with a regular computer in it. That&#8217;s all.</p>
<h2>What&#8217;s the difference between a Great Idea and a Great Business?</h2>
<p>One is fun to think about. The other is a lot of hard work.</p>
<p>And what do you know, tonight begins <a title="Startup Weekend in Cleveland!" href="http://cleveland.startupweekend.org">Startup Weekend Cleveland</a>. In about five hours, I&#8217;m going to join about seventy other business and technical people to talk about ideas, pick a subset that the group will develop into products, and personally contribute to one of those. Which ones will be most successful? I&#8217;m betting on the ideas that make people say &#8220;I need that!&#8221; not &#8220;Oh cool!&#8221; In other words, the <em>stuff that works and creates value.</em></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Kid teaches me a lesson on clean code. ]]></title>
<link>http://jeungun.wordpress.com/2009/11/16/kid-teaches-me-a-lesson-on-clean-code/</link>
<pubDate>Mon, 16 Nov 2009 14:18:18 +0000</pubDate>
<dc:creator>Jose  Asuncion</dc:creator>
<guid>http://jeungun.wordpress.com/2009/11/16/kid-teaches-me-a-lesson-on-clean-code/</guid>
<description><![CDATA[This is probably the cleanest CS11 code I have ever seen: main(void){ load_file(); interface(); retu]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This is probably the cleanest CS11 code I have ever seen: </p>
<pre class="brush: cpp;">
main(void){
  load_file();
  interface();
  return 0;
}
// method definitions here
</pre>
<p>It&#8217;s a Pokedex program in C. This one got a really high grade I heard but best of all, it&#8217;s just so clean &#8212; although its stack call can tend to grow. </p>
<p>I&#8217;d like to say that this gave me insight on how to clean my CS180mp. Which before I saw this, my main method looked like this: </p>
<pre class="brush: java;">
public class Runner {
	private static final String EXIT = &#34;-1&#34;;
	public static void main(String args[]){

		Scanner scanner = new Scanner(System.in);
		String input;
		double learningRate;
		int maxEpochs;

		while (true){
			printWhatFunctionToLearn();
			input=scanner.next();
			if (input.equals(EXIT)) break;
			BooleanFunction functionToLearn = functionToLearn(input);

			System.out.println(&#34;learning rate?&#34;);
			input=scanner.next();
			if (input.equals(EXIT)) break;
			learningRate = Double.parseDouble(input);

			System.out.println(&#34;maximum epochs?&#34;);
			input=scanner.next();
			if (input.equals(EXIT)) break;
			maxEpochs = Integer.parseInt(input);

			Perceptron p = new Perceptron(learningRate,maxEpochs);
			p.setTrainingExamples(new Input(0,0),new Input(0,1),
					new Input(1,0),new Input(1,1));
			p.setFunctionToLearn(functionToLearn);
			p.initializeWeights();
			p.learn();
			p.seeLearningResults();
		}
	}
</pre>
<p>Using the technique the kid did in his code and applying it to mine: </p>
<pre class="brush: java;">
public class Runner {
  public static void main(String args[]){
     while (true) {
        displayMenu();
        Input input = getInput();
        Perceptron p
          = new Perceptron(input.getLearningRate(),maxEpochs);
        p.setTrainingExamples(new Input(0,0),new Input(0,1),
	   new Input(1,0),new Input(1,1))
        p.setFunctionToLearn(input.getFunctionToLearn());
        p.initializeWeights();
        p.learn();
        if (input==NULL) break;
   }
}
}
</pre>
<p>Poof! I go from 34 lines to 15 readable lines! I have reduced my code to half and it still behaves the same way. Now, I don&#8217;t know exactly what design pattern this is but it sure is pretty. </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[interviewed on InformIT]]></title>
<link>http://silkandspinach.net/2009/11/16/interviewed-on-informit/</link>
<pubDate>Mon, 16 Nov 2009 10:04:05 +0000</pubDate>
<dc:creator>Kevin Rutherford</dc:creator>
<guid>http://silkandspinach.net/2009/11/16/interviewed-on-informit/</guid>
<description><![CDATA[Bill Wake and I have been interviewed about Refactoring in Ruby by Russ Olsen for InformIT; you can ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Bill Wake and I have been interviewed about <a href="http://www.refactoringinruby.info" target="blank">Refactoring in Ruby</a> by Russ Olsen for InformIT; you can read the <a href="http://www.informit.com/articles/article.aspx?p=1402446" target="blank">interview here</a>. (I note that my answers have been re-spelt the American way <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Refactoring scripts em shell]]></title>
<link>http://hugomaia.wordpress.com/2009/11/15/refactoring-scripts-em-shell/</link>
<pubDate>Sun, 15 Nov 2009 18:25:32 +0000</pubDate>
<dc:creator>hugomaia</dc:creator>
<guid>http://hugomaia.wordpress.com/2009/11/15/refactoring-scripts-em-shell/</guid>
<description><![CDATA[Mês passado estava trabalhando em um sistema que estou desenvolvendo em Rails com amigos da faculdad]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Mês passado estava trabalhando em um sistema que estou desenvolvendo em <a href="http://rubyonrails.org/">Rails</a> com amigos da <a href="http://www.uenf.br">faculdade</a> quando um deles viu que tinha feito uma <a href="http://pt.wikipedia.org/wiki/Merda">merda</a>. Ele tinha criado um modelo &#8220;viagem&#8221; com o scaffolding mas esqueceu de colocar o plural correto no inflections. Assim o scaffolding criou vários arquivos que continham no nome as palavras &#8220;viagems&#8221; ou &#8220;Viagems&#8221; e vários arquivos que tinham em seu conteúdo essas mesmas palavras. Contudo ele já havia programado bastante coisa depois disso e ficaria ruim retornar ao commit anterior no git.<br />
Ele já ia alterar tudo manualmente quando falei: Calma aí! Vou criar um script para isso!<br />
Era uma boa oportunidade, já que estou aprendendo a programar em shell. Em pouco tempo criei dois scripts básicos: um para modificar os nomes dos arquivos e outro para modificar o conteúdo. Logo pensei em montar um conjunto de scripts para refactoring já que uso o combo Gedit + Terminal para programar. Daí essa semana comecei a ler o livro <a href="http://www.shellscript.com.br/">Shell Script Professional</a> do <a href="http://aurelio.net/">Aurélio Marinho</a>, que é muito bom livro por sinal, e dei uma profissionalizada nos scripts para colocar em prática meus aprendizados.<br />
O resultado está no projeto <a href="http://github.com/hugomaia/Refactoring-scripts">Refactoring-scripts</a> github. Por enquanto são dois:</p>
<p>- find-replace.sh &#8211; Busca em um arquivo, ou recursivamente em todos os arquivos de um diretório, por uma palavra e a substitui por outra.</p>
<p>- change-file-name.sh &#8211; Busca recursivamente em um diretório por arquivos que contenham uma palavra em seu nome e a substitui por outra.</p>
<p>A pretensão é, além criar outros scripts, cirar um fork para um plugin de refactoring em python para o gedit.<br />
Mas isso é coisa para as férias de fim de ano. =)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Refactoring to Reuse #4]]></title>
<link>http://artofsoftwarereuse.com/2009/11/13/refactoring-to-reuse-4/</link>
<pubDate>Sat, 14 Nov 2009 01:02:21 +0000</pubDate>
<dc:creator>vijaynarayanan</dc:creator>
<guid>http://artofsoftwarereuse.com/2009/11/13/refactoring-to-reuse-4/</guid>
<description><![CDATA[#4 Separate Message Construction from Message Delivery There are a variety of scenarios where you wi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>#4 Separate Message Construction from Message Delivery</strong></p>
<p>There are a variety of scenarios where you will build a message and deliver it to a destination. The message itself could be free-form text, delimited/fixed-length text, XML, or some other format. The destination itself could be a system, service, application, a server, or a human user or group of users (in the case of email). If you decouple message construction from its destination, that will drive in reuse of both of these assets. For example, you can take a message and send it via email or send to a message queue. In the same vein, you can potentially use the same code that sends email to send a newsletter message and a reminder message.</p>
<p>To illustrate this idea, take a look at this code fragment:</p>
<pre style="font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;color:#000000;background-color:#eeeeee;font-size:12px;border:1px dashed #999999;line-height:14px;overflow:auto;padding:5px;"><code>MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress("someone@xyz.com"));
message.setSubject("Hello there...");

FileReader fr = new FileReader("some-template.html");
StringBuffer sb = new StringBuffer();
BufferedReader reader = new BufferedReader(fr);
String line = reader.readLine();
while (line != null) {
     sb.append(line);
     line = reader.readLine();
}
reader.close();

message.setText(sb.toString());
// Send message
Transport tr = session.getTransport("smtp");
tr.connect("host-name", "user", "some-password");
message.saveChanges();
tr.sendMessage(message, message.getAllRecipients());
tr.close();
</code></pre>
<p>There is a file that is read from the file system and a data buffer is being constructed. The data is then used to send an email. However, this class isn’t very reusable because of the tight coupling between message construction and delivery logic.</p>
<p>Now examine, a newer version that has modularized this code &#8211; <code>Publisher</code> sends the message using an <code>EmailConfiguration</code> and <code>TemplateBuilder</code> constructs the message using an instance of <code>Template</code>.</p>
<pre style="font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;color:#000000;background-color:#eeeeee;font-size:12px;border:1px dashed #999999;line-height:14px;overflow:auto;padding:5px;"><code>Publisher publisher = new Publisher();
EmailConfiguration eConfig = new EmailConfiguration();
publisher.setConfiguration(eConfig);
TemplateBuilder builder = new TemplateBuilder();
Template template = builder.build();
publisher.publishMessage(template);
</code></pre>
<p>Now, <code>Publisher, EmailConfiguration, Template, and TemplateBuilder</code> are all candidate assets that are available for other classes to reuse. If you have other types of configurations, they can be included as well and bound polymorphically. This concept can be further extended based on the quantity and quality of <a href="http://artofsoftwarereuse.com/2009/10/10/systematic-reuse-success-factor-4-domain-context/">variations</a>. For instance, the message construction can be realized using a common interface with multiple implementations. The message itself might have standard and personalized content.</p>
<p>You may move to a more modular version iteratively. Which version do you think facilitates reuse, faster integration, and higher productivity? This new design will make it easier to test message construction independently from publisher.<br />
<strong>Like this post?</strong> Subscribe to <a href="http://feeds2.feedburner.com/SoftwareReuseInTheRealWorld">RSS feed</a> or get blog <a href="http://feedburner.google.com/fb/a/mailverify?uri=SoftwareReuseInTheRealWorld&#38;loc=en_US">updates via email</a>.</p>
<p style="text-align:right;"><strong> <a href="http://twitter.com/home?status=http://wp.me/ptCiB-wX"><img title="tweet this" src="/files/2009/10/twitter2.png" alt="tweet this" width="32" height="32" /></a> <a href="http://del.icio.us/post?url=http://wp.me/ptCiB-wX&#38;title=Refactoring to Reuse 4"><img title="del.icio.us:Refactoring to Reuse 4" src="/files/2009/10/dellicious.png" alt="add to del.icio.us" width="32" height="32" /></a></strong> <a href="http://www.facebook.com/sharer.php?u=http://wp.me/ptCiB-wX&#38;title=Refactoring to Reuse 4"><img title="facebook:Refactoring to Reuse 4" src="/files/2009/10/48x48.png" alt="post to facebook" width="32" height="32" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Technical Debt: Refactoring vis-a-vis Starting Afresh]]></title>
<link>http://theagileexecutive.com/2009/11/10/technical-debt-refactoring-vis-a-vis-starting-afresh/</link>
<pubDate>Tue, 10 Nov 2009 12:20:32 +0000</pubDate>
<dc:creator>israelgat</dc:creator>
<guid>http://theagileexecutive.com/2009/11/10/technical-debt-refactoring-vis-a-vis-starting-afresh/</guid>
<description><![CDATA[Only three options are available to you once your technical debt overwhelms the development and cust]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://theagileexecutive.com/2009/02/01/can-you-afford-the-software-you-are-developing/">Only three options are available to you</a> once your technical debt overwhelms the development and customer support teams:</p>
<ol>
<li>Continue as is.</li>
<li>Start refactoring in earnest to pay back your debt.</li>
<li>Switch to a new code base, either by launching an unencumbered development project or through acquiring new software from another company.</li>
</ol>
<p>The first option, obviously, does not solve any problem &#8211; you simply continue a struggle that becomes more and more difficult over time. As indicated in the post <a href="http://theagileexecutive.com/2009/10/07/elbow-room-for-handling-technical-debt/">Elbow Room for Handling Technical Debt</a>, the second option is quite difficult to carry out if it is exercised at a late point in the software&#8217;s life cycle. This post examines the third option &#8211; starting afresh.</p>
<p>The attraction of starting afresh is always tempting. The sins of the past, hidden in layers over layers of technical debt and manifesting themselves in low customer satisfaction and poor customer retention, are (sort of) forgiven. The shiny new software holds the promise of better days to come.</p>
<p>Trouble is, your old sins are there to get you in three nasty ways:</p>
<ol>
<li><span style="text-decoration:underline;">New technical debt</span>: Even if the shiny new software is very good indeed, it will <a href="http://theagileexecutive.com/2009/06/01/rusty-automobiles/">decay over time</a>. Unless you transformed your software engineering practices to ensure refactoring is carried out on an ongoing basis, sooner or later you will accrue new technical debt.</li>
<li><span style="text-decoration:underline;">Migration</span>: Good that the new software might be, it is not likely to provide all the functionality the old software had. Migrating your customers will require a lot of hard work, particularly if your customers developed elaborate business processes on top of your old software.</li>
<li><span style="text-decoration:underline;">Critical race between old and new</span>: For a period of time (say a couple of years) the old software is likely to run alongside the new software. Any significant new regulatory requirement will force you to update both the old software and the new software. Ditto for security. Any nifty new technology you might want to embed in your new software is likely to be equally desirable to customers who still use your old software. You will be pressed to incorporate the new technology in the old software, not just in the new software.</li>
</ol>
<p>Before opting for new software (in preference to refactoring the old software), I would recommend you compare the economics of the two option. My rule of a thumb for the calculus of introducing new enterprise software to replace legacy software is straightforward:</p>
<p style="padding-left:30px;"><strong><em>For a period of about two years, assume the run rate for dev/test/support will be 150% of your current investment in development, test and support of the old software.</em></strong></p>
<p>Please note that the 150% figure is just the expected run rate for running the new software alongside the legacy software. You will need, of course, to add the cost of acquiring/producing the new software to the economic calculus.</p>
<p><strong><em><span style="font-style:normal;font-weight:normal;">You might be able to reduce the ‘150% for two years’ investment by applying some draconian migration measures. Such measures, of course, will affect your customers. In the final analysis, your decision to acquire new software must be viewed as the following simple question:</span></em></strong></p>
<p style="padding-left:30px;"><strong><em>What value do you place on your customer base?!</em></strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[When you're stuck]]></title>
<link>http://blog.criticalresults.com/2009/11/09/when-youre-stuck/</link>
<pubDate>Mon, 09 Nov 2009 17:28:19 +0000</pubDate>
<dc:creator>Mark W. Schumann</dc:creator>
<guid>http://blog.criticalresults.com/2009/11/09/when-youre-stuck/</guid>
<description><![CDATA[It happens a lot, especially when working on legacy code, that you can&#8217;t figure out a &#8220;b]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>It happens a lot, especially when working on legacy code, that you can&#8217;t figure out a &#8220;business logic&#8221; algorithm that isn&#8217;t already well documented. Sure, it&#8217;s in the code, but so are a million other things, and you can&#8217;t eyeball the part that does all the calculation. The client is asking for a change or a fix and you&#8217;re not sure where to start.<br />
That&#8217;s when I think you can do three things at once: improve the overall structure, impose some unit testing, and solve the problem you were asked to. Refactoring does all of these.<!--more--></p>
<h2>Long story short</h2>
<p>Refactoring is the practice of changing existing code to improve its structure without changing its function or effect. Ordinarily you do it when something changes in the requirements. For example, the simple structure that works fine when your software supports only one state&#8217;s regulations has to turn into a lookup table when you add another state.</p>
<p>Sometimes the requirements change is implicit though. The old system worked because Rick patched it to death, and Rick isn&#8217;t here anymore, and the new requirement is <em>someone besides Rick has to know what it does</em>. Commenting is a well-known (because it&#8217;s easy) but also widely ignored (because it&#8217;s rarely accurate) way to communicate, but you&#8217;re probably better off letting the code do the talking.</p>
<h2>What that means</h2>
<p>Suppose you&#8217;re doing a WinForms application and an event handler does an important calculation. You want to figure out what that calculation does, because it probably needs to be changed, but it&#8217;s entangled with all the code that updates the GUI and saves some stuff to a database.</p>
<p>The thing to do is create at least a token class that pulls the calculation into a single method or group of methods. To wit, you&#8217;d edit this:</p>
<pre class="brush: vb;">
Private Sub btnGo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGo.Click
btnClose.Enabled = True
btnUpdate.Enabled = False
Dim moneyvalue as Decimal
moneyvalue = ... ' Complex money calculation here
txtPrice.Text = &#34;$&#34; &#38;amp; String.Format(&#34;Order Total: {0:C}&#34;, moneyvalue);
End Sub
</pre>
<p>Into this:</p>
<pre class="brush: vb;">
Private Sub btnGo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGo.Click
btnClose.Enabled = True
btnUpdate.Enabled = False
Dim quantity as Integer
Dim moneyvalue as Decimal
quantity = Integer.Parse(txtQuantity)
moneyvalue = calc.GetTotalPrice(quantity)
txtPrice.Text = &#34;$&#34; &#38; String.Format(&#34;Order Total: {0:C}&#34;, moneyvalue);
End Sub
Public Class PriceCalculator
   Public Function GetMoneyValue(qty as Integer)
      ' Complex calculation goes here
   End Function
End Class
</pre>
<h2>The simplest thing that could possibly work</h2>
<p>What&#8217;s the point? You haven&#8217;t changed any functionality at all!</p>
<p>Yes, that&#8217;s the point. You have the exact same inputs and outputs, but now the <tt>PriceCalculator</tt> class can be maintained free of GUI pollution. The next step is to download something like <a href="http://nunit.org">NUnit</a>, add it to your project, and create unit tests for all the methods of the <tt>PriceCalculator</tt>.</p>
<p>Here&#8217;s the crazy thing. When you write unit tests for the existing code, you will gradually close in on the intended (and actual) functionality of the code you&#8217;ve refactored. So while you put the code into a more testable format, you are also getting closer to understanding enough to make the change, <em>and</em> making it much easier to modify in the future.</p>
<div style="border:1px solid gray;background:yellow none repeat scroll 0 0;width:30%;float:right;font-size:small;padding:3px;">
<p>You totally want to read more about this, and you will, if you opt in to <a title="Free stuff! Easy! Fun!" href="http://criticalresults.com/freestuff.html">my eZine</a>. You get a complete mailing about once a month, with articles and link that help you do your job, as well a quick note every week or so with something funny or interesting.</p>
<p>If you work with software, and if you&#8217;re frustrated, then this is for you.</p>
</div>
<p>Look, I know you&#8217;re busy. You want to do, as they say in Extreme Programming, <a href="http://c2.com/xp/DoTheSimplestThingThatCouldPossiblyWork.html">&#8220;The Simplest Thing That Could Possibly Work.&#8221;</a> I&#8217;m saying <em>this is the simplest thing</em> that could possibly work!</p>
<h3>Two reasons for that</h3>
<p>For one thing, the dependent clause is important. The &#8220;simplest thing&#8221; is no good if it doesn&#8217;t work! And by &#8220;work&#8221; we mean a solution that doesn&#8217;t create more headaches than it removes. Hacking at pre-existing financial code in a GUI event handler? Well, that <em>doesn&#8217;t work</em>, almost tautologically. Because in the end you still have financial code in a GUI event handler.</p>
<p>The other thing is that the default approach, that of modifying the code in place and hoping you got it right, <em>isn&#8217;t the simplest thing</em>. It&#8217;s a lot of work! And it&#8217;s error-prone, which means you have to do it again probably, and that isn&#8217;t simple either.</p>
<h3>The cost of refactoring</h3>
<p>If you choose your oppportunities carefully, refactoring makes your code better <em>at no cost</em> because it is only the shortest path to getting the right answer that you wanted anyway. Truly, the question isn&#8217;t whether you have time for refactoring; the question is whether you have time <em>not</em> to.</p>
<h2>A chance to talk</h2>
<p>Do you work in a shop where obvious refactorings are &#8220;a waste of time&#8221;? Do they <a title="Programmer &#34;optimism&#34; and the death march" href="http://blog.criticalresults.com/2009/11/04/optimism-death-march/">turn your best estimates to mush</a>? Is it hard to do your best work because they won&#8217;t let you fnish things? I can&#8217;t immediately solve those problems <a title="Critical Results Now!" href="http://now.criticalresults.com">unless you hire me</a>, but I can provide a place to talk and vent.</p>
<p>Take five minutes away from whatever is frustrating you at the moment, and bend it to my <a title="Survey on the Bull Session" href="http://www.surveymonkey.com/s.aspx?sm=t2sFjstKKbeH4_2bku8KZgSA_3d_3d">survey on the Developer Bull Session</a> concept. Let me know if you&#8217;re interested in talking or listening in a voice (!) conversation now and then, via conference call or stream.</p>
<p>&#160;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[O que aprendemos no Encontro Ágil 2009]]></title>
<link>http://bluesoft.wordpress.com/2009/11/09/o-que-aprendemos-no-encontro-agil-2009/</link>
<pubDate>Mon, 09 Nov 2009 13:29:36 +0000</pubDate>
<dc:creator>Luiz Faias Jr</dc:creator>
<guid>http://bluesoft.wordpress.com/2009/11/09/o-que-aprendemos-no-encontro-agil-2009/</guid>
<description><![CDATA[Como havíamos publicado no início de outubro, a Bluesoft patrocinou o evento Encontro Ágil 2009 que ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Como havíamos <a href="http://bluesoft.wordpress.com/2009/10/05/eventos-sobre-metodos-ageis-em-outubro/" target="_blank">publicado no início de outubro</a>, a Bluesoft patrocinou o evento <a href="http://www.encontroagil.com.br" target="_blank">Encontro Ágil 2009</a> que aconteceu na Universidade de São Paulo nos dias 10 e 11 de outubro de 2009.</p>
<p>No primeiro dia rolaram diversas <a href="http://www.encontroagil.com.br/principal/agenda1.jsf" target="_blank">sessões em paralelo</a>, todas apresentadas por grandes nomes do meio de desenvolvimento ágil nacional. Já no segundo dia houve uma <a href="http://www.encontroagil.com.br/principal/agenda2.jsf" target="_blank">série de apresentações</a> com Joe Yoder (americado) e Jutta Eckstein (alemã) no auditório da <a href="http://www.fau.usp.br/" target="_blank">FAU</a>.</p>
<p>A integração com a galera foi ótima durante estes dois dias através dos &#8220;Birds of a Feather&#8221;, discussões sobre um tema proposto por algum participante com a finalidade de distribuir o conhecimento. Outro pronto chave para esta integração  foi  o almoço que aconteceu no próprio local.</p>
<p>Veja os <a href="http://www.slideshare.net/bluesoftbr/encontro-gil-2009" target="_blank">slides desta palestra</a> realizada por <a href="http://andrefaria.com" target="_blank">André Faria</a>, <a href="http://twitter.com/luizfaias" target="_blank">Luiz Faias Jr</a> e <a href="http://twitter.com/robson_santiago" target="_blank">Robson Santiago</a> com as licões aprendidas no evento:</p>
<p><!-- SlideShare error: doc is missing or has illegal characters /[^-_a-zA-Z0-9]/ --></p>
<p>Assista também o vídeo que encontra-se disponível <a href="http://vimeo.com/7420166">em nosso canal do Vimeo</a>:</p>
<p><span style='text-align:center; display: block;'><br />
<object type="application/x-shockwave-flash" width="440" height="300" data="http://www.vimeo.com/moogaloop.swf?clip_id=7444360&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA"><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=7444360&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA" /></object><br />
</span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[The Systematic Software Reuse Roadmap]]></title>
<link>http://artofsoftwarereuse.com/2009/11/08/the-systematic-software-reuse-roadmap/</link>
<pubDate>Sun, 08 Nov 2009 23:20:01 +0000</pubDate>
<dc:creator>vijaynarayanan</dc:creator>
<guid>http://artofsoftwarereuse.com/2009/11/08/the-systematic-software-reuse-roadmap/</guid>
<description><![CDATA[In an earlier post, I outlined the four key ingredients for agile software reuse. One of which is th]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In an earlier post, I outlined the <a href="http://artofsoftwarereuse.com/2009/08/20/agile-software-reuse-key-ingredients/">four key ingredients</a> for agile software reuse. One of which is the reuse roadmap. In this post I want to share an example roadmap and illustrate how they tie into other business and IT objectives. The idea is to start at the ad-hoc state (where there is little or no reuse) and move to truly utilizing systematic reuse across multiple projects.</p>
<p><strong>Phase 1-Ad-hoc </strong>- In this initial phase there is little or no awareness of reusable assets, and there is very little customer integration expertise. Consumers have low awareness of what assets are available. Systematic reuse efforts not considered and there is a lack of alignment between project deliverables, reuse strategy, and business objectives. Applications within the same domain do not share assets i.e. there is a lot of duplicate code.</p>
<div id="attachment_1963" class="wp-caption alignright" style="width: 163px"><a href="http://www.flickr.com/photos/vijay_narayanan/4086982415/sizes/o/" target="new"><img class="size-thumbnail wp-image-1963   " title="reuse roadmap" src="/files/2009/11/reuse-roadmap1.jpg?w=150" alt="reuse roadmap" width="153" height="93" /></a><p class="wp-caption-text">View Reuse Roadmap</p></div>
<p><strong>Phase 2-Aware </strong>- In the second phase, legacy capabilities and processes are mined for building assets. Agile practices are minimally aligned to the reuse strategy. Consumers seek reusable assets for applications in the domain and rudimentary product lines take shape. Communication about reusable assets have improved and awareness is increasing.</p>
<p><strong>Phase 3-Ready</strong> &#8211; In this phase, asset inventory expands task, entity, and utility capabilities. User stories are analyzed within a product line context and additional assets are built iteratively. Agile practices specifically code reviews, refactoring, iteration planning, and pair programming used to identify and refine assets in a <a href="http://artofsoftwarereuse.com/2009/05/24/continously-align-your-software-assets-to-be-more-reusable/">continuous fashion</a>. Consumers increasingly use reusable assets to build applications and start to co-create assets. Additionally, assets are used across multiple applications in the domain. A few business process flows start to leverage reusable assets.</p>
<p><strong>Phase 4-Systematic</strong> &#8211; This is when your systematic reuse program starts to really reap rewards. Asset inventory expands to include additional capabilities in your domain. Assets are used to automate many more business processes and they provide variability mechanisms to meet business needs. User stories and iteration planning are well aligned with reuse strategy which facilitate iterative reusable asset development. Additionally, several assets built by refactoring legacy capabilities and communication about reusable assets are available. Finally, consumers are actively engaged in asset co-creation, retrieval, and consumption and supported by a mature <a href="http://artofsoftwarereuse.com/2009/07/18/systematic-reuse-success-factor-2-ease-of-integration/">integration</a> function.</p>
<p><strong>Like this post?</strong> Subscribe to <a href="http://feeds2.feedburner.com/SoftwareReuseInTheRealWorld">RSS feed</a> or get blog <a href="http://feedburner.google.com/fb/a/mailverify?uri=SoftwareReuseInTheRealWorld&#38;loc=en_US">updates via email</a>.</p>
<p style="text-align:right;"><strong> <a href="http://twitter.com/home?status=http://wp.me/ptCiB-vB"><img title="tweet this" src="/files/2009/10/twitter2.png" alt="tweet this" width="32" height="32" /></a> <a href="http://del.icio.us/post?url=http://wp.me/ptCiB-vB&#38;title=The Systematic Software Reuse Roadmap"><img title="del.icio.us:The Systematic Software Reuse Roadmap" src="/files/2009/10/dellicious.png" alt="add to del.icio.us" width="32" height="32" /></a></strong> <a href="http://www.facebook.com/sharer.php?u=http://wp.me/ptCiB-vB&#38;title=The Systematic Software Reuse Roadmap"><img title="facebook:The Systematic Software Reuse Roadmap" src="/files/2009/10/48x48.png" alt="post to facebook" width="32" height="32" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Considerations When Refactoring to Reuse]]></title>
<link>http://artofsoftwarereuse.com/2009/11/04/considerations-when-refactoring-to-reuse/</link>
<pubDate>Thu, 05 Nov 2009 00:47:20 +0000</pubDate>
<dc:creator>vijaynarayanan</dc:creator>
<guid>http://artofsoftwarereuse.com/2009/11/04/considerations-when-refactoring-to-reuse/</guid>
<description><![CDATA[Here are a few points to consider while you refactor existing or new software assets for reuse: If y]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Here are a few points to consider while you refactor existing or new software assets for reuse:<strong><br />
</strong></p>
<ul>
<li>If your team is building reusable assets for multiple applications (as part of a product line) within your control you could use a library approach (a JAR or DLL). How you package and deploy the asset is dependent on the development platform. Similarly, if your team is building reusable assets for external applications outside your control, it is better to with a service oriented approach.</li>
<li>Deploying reusable assets can be tricky! Spend some time thinking about how this asset will work within your environment. Is it going go be centrally deployed for all consumers? Or will each consumer have a copy of the asset in their application? If there are multiple copies, how will you track usage metrics?</li>
<li>Make sure you have covered security requirements. Your shop might have special information/privacy standards and even legal ones to comply with. Ask around.</li>
<li>Large shops might have enterprise standards that you might be forced to comply with. Work with the appropriate folks to avoid roadblocks when you deploy!</li>
<li>A good rule of thumb is to seek input from your production support team (or your own team if you play that role) for understanding their needs. Think of production support input as part of your refactoring effort. Sure you can get away not doing this but why waste a precious opportunity to build a higher quality product while strengthening the partnership.</li>
</ul>
<p>Don&#8217;t wait till the end of your iteration to consider these issues. You will have higher success with systematic reuse if you work these details out as well.</p>
<p><strong>Like this post?</strong> Subscribe to <a href="http://feeds2.feedburner.com/SoftwareReuseInTheRealWorld">RSS feed</a> or get blog <a href="http://feedburner.google.com/fb/a/mailverify?uri=SoftwareReuseInTheRealWorld&#38;loc=en_US">updates via email</a>.</p>
<p style="text-align:right;"><strong> <a href="http://twitter.com/home?status=http://wp.me/ptCiB-md"><img title="tweet this" src="/files/2009/10/twitter2.png" alt="tweet this" width="32" height="32" /></a> <a href="http://del.icio.us/post?url=http://wp.me/ptCiB-md&#38;title=Considerations When Refactoring to Reuse"><img title="del.icio.us:Considerations When Refactoring to Reuse" src="/files/2009/10/dellicious.png" alt="add to del.icio.us" width="32" height="32" /></a></strong> <a href="http://www.facebook.com/sharer.php?u=http://wp.me/ptCiB-md&#38;title=Considerations When Refactoring to Reuse"><img title="facebook:Considerations When Refactoring to Reuse" src="/files/2009/10/48x48.png" alt="post to facebook" width="32" height="32" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Using Agile Practices for Building Reusable Services]]></title>
<link>http://artofsoftwarereuse.com/2009/11/02/using-agile-practices-for-building-reusable-services/</link>
<pubDate>Tue, 03 Nov 2009 01:43:36 +0000</pubDate>
<dc:creator>vijaynarayanan</dc:creator>
<guid>http://artofsoftwarereuse.com/2009/11/02/using-agile-practices-for-building-reusable-services/</guid>
<description><![CDATA[I wrote earlier about using agile software reuse and the key ingredients that are beneficial when pu]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I wrote earlier about using <a href="http://artofsoftwarereuse.com/2009/09/25/building-reusable-assets-with-agile-practices/">agile software reuse</a> and the <a href="http://artofsoftwarereuse.com/2009/08/20/agile-software-reuse-key-ingredients/">key ingredients</a> that are beneficial when pursuing such a strategy. In this post, I want to summarize how agile practices can be used to build reusable service capabilities.</p>
<div style="font-size:x-small;font-family:Sans-serif;">
<table style="border-style:solid;border-width:1px;" border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr bgcolor="#cccccc">
<td width="20%" valign="top"><strong>Practice</strong></td>
<td width="40%" valign="top"><strong>How is this practice supported?</strong></td>
<td width="40%" valign="top"><strong>Why is this practice supported?</strong></td>
</tr>
<tr>
<td width="20%" valign="top">User stories</td>
<td width="40%" valign="top">Examine user stories   within the context of the overall reuse strategy. Differentiate functionality   for the overall domain vs. for a single application. Match story with known   service and identify development and refactoring tasks.</td>
<td width="40%" valign="top">User stories are the   primary means for getting requirements for services. User stories can be used   to recognize common functionality across services. It bridges business needs   with reusable services.</td>
</tr>
<tr bgcolor="#cccccc">
<td width="20%" valign="top">Don’t Repeat Yourself</td>
<td width="40%" valign="top">Code reviews done to   remove duplication across existing and new services. Review code at multiple   levels of granularity – source code snippets, classes, services, and across   the domain services inventory. Prefer building only domain services.</td>
<td width="40%" valign="top">Ensure services are   reusable and do not have channel/technology/transport coupling.Keeps codebase light by   removing unwanted code. Helps leverage internal and/or external solutions for   functionality that is outside of your core domain.</td>
</tr>
<tr>
<td width="20%" valign="top">Refactoring</td>
<td width="40%" valign="top">Heavily used for two   primary purposes: iterative service development and legacy asset leverage.   Refactoring used to identify and fix service limitations (functional and   technical). Align user stories to known set of service refactorings.   Refactoring also used to wrap legacy functionality and loosen coupling among   legacy systems.</td>
<td width="40%" valign="top">Refactoring is the   foundational technique to achieve agility and helps deliver functional   services iteratively. Refactoring is also necessary since domain knowledge   and business strategy gets refined over time. Legacy assets can quickly be   put to use as part of the service inventory by refactoring them saving time   and money.</td>
</tr>
<tr bgcolor="#cccccc">
<td width="20%" valign="top">Done, Done</td>
<td width="40%" valign="top">Unit and integration   test the service, perform necessary refactorings, add suite of tests to the   continuous integration process, and document service in the service catalog.</td>
<td width="40%" valign="top">Ensure reuse-friendly   techniques are performed and quality isn’t comprised when adding/updating   services to the domain inventory.</td>
</tr>
<tr>
<td width="20%" valign="top">Release planning</td>
<td width="40%" valign="top">Only build services when   there is a known consumer. Support backward compatibility using service   wrappers and co-existence using versioning. Bundle enhancements across   multiple services.</td>
<td width="40%" valign="top">Deliver business value   early with service orientation. Maximize service reuse across initiatives by   releasing early and often. Reduces burden on development team and allows   graceful migration path for consumers.</td>
</tr>
<tr bgcolor="#cccccc">
<td width="20%" valign="top">Iteration planning</td>
<td width="40%" valign="top">Plan iteration scope   using prioritized list of user stories. This list will in turn drive new   service development and updates to existing ones. Allocate time for service   development, decomposing legacy code, perform reviews, refactoring, integrate   with continuous builds, as well as documentation.</td>
<td width="40%" valign="top">Capture assumptions and   known refactorings to continuously deliver working software and address   limitations over multiple releases. Iterations help build reusable services   over time greatly minimizing schedule risk.</td>
</tr>
</tbody>
</table>
</div>
<p>This isn&#8217;t an exhaustive list of agile practices that facilitate reuse &#8211; consider these as a starting point.</p>
<p><strong>Like this post?</strong> Subscribe to <a href="http://feeds2.feedburner.com/SoftwareReuseInTheRealWorld">RSS feed</a> or get blog <a href="http://feedburner.google.com/fb/a/mailverify?uri=SoftwareReuseInTheRealWorld&#38;loc=en_US">updates via email</a>.</p>
<p style="text-align:right;"><strong> <a href="http://twitter.com/home?status=http://wp.me/ptCiB-rw"><img title="tweet this" src="/files/2009/10/twitter2.png" alt="tweet this" width="32" height="32" /></a> <a href="http://del.icio.us/post?url=http://wp.me/ptCiB-rw&#38;title=Using Agile Practices for Building Reusable Services"><img title="del.icio.us:Using Agile Practices for Building Reusable Services" src="/files/2009/10/dellicious.png" alt="add to del.icio.us" width="32" height="32" /></a></strong> <a href="http://www.facebook.com/sharer.php?u=http://wp.me/ptCiB-rw&#38;title=Using Agile Practices for Building Reusable Services"><img title="facebook:Using Agile Practices for Building Reusable Services" src="/files/2009/10/48x48.png" alt="post to facebook" width="32" height="32" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Ten Signs Your Team Needs Systematic Reuse]]></title>
<link>http://artofsoftwarereuse.com/2009/11/01/ten-signs-your-team-needs-systematic-reuse/</link>
<pubDate>Sun, 01 Nov 2009 21:55:43 +0000</pubDate>
<dc:creator>vijaynarayanan</dc:creator>
<guid>http://artofsoftwarereuse.com/2009/11/01/ten-signs-your-team-needs-systematic-reuse/</guid>
<description><![CDATA[In the hectic routines of projects and deadlines it is easy to ignore reuse. After all, we are deliv]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In the hectic routines of projects and deadlines it is easy to ignore reuse. After all, we are delivering code, features, and churning out applications &#8211; aren&#8217;t we? May be you are waiting for the right time to start and execute on a reuse strategy. May be you think software reuse is a big myth and isn&#8217;t worth pursuing. Regardless of reason poor design will eventually inhibit your efforts to more agile and responsive to business needs. Here are ten tell-tale signs that your team needs systematic reuse:</p>
<ol>
<li>Management believes they can install or buy reuse. You are told reuse comes for &#8220;free&#8221; with OOPS, SOA, BPM, MDM, (you can add your favorite buzzwords here!). <em>Nothing could be farther from the truth <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </em></li>
<li>There is no management support for reuse. You typically hear some variation of deliver, execute, and just hit the deadline. What should be a small change rapidly mushrooms into something that touches several classes or services and forces you to change code across modules. To boot, this happens often. This of course adds technical debt and will hurt the team in the long term.</li>
<li>Developers love to build their custom implementations for which satisfactory solutions exist. It could exist in-house, in the open source community, or available commercially. We have all met the developer who wants to build a better logger than Log4J or a better dependency injection container than Spring. Whatever. The argument usually goes this way: we have special requirements that no one else has and we have the best talent to build it (maintenance, ongoing bugfixes, support costs are conveniently excluded).</li>
<li>No scope for reuse in the problem domain.  Nothing can be considered for reuse you are told. Our domain is so unique that it changes often &#8211; nothing is common across projects or initiatives and we need to keep churning out code to meet business needs. This might be true to an extent but not the way it is portrayed.</li>
<li>Your developers and technical leads tell you that their software assets are perfect &#8211; they have been made completely reusable for all future needs. Be very wary! Predicting the future is tricky and systematic reuse isn&#8217;t going to guarantee perfection. More importantly, your investment in reuse is going to provide you the foundation to turn out new features and business processes quicker but doesn&#8217;t eliminate the need for continuous evolution of those reusable capabilities.</li>
<li>There are several different versions of a common need like getting customer data or getting a database connection. Each with its own set of assumptions about data structure, error handling, etc. You know there is an opportunity to create a common capability but developers find it easy to cut and paste code from one project or component into another.</li>
<li>Each developer implements capabilities without the faintest idea of existing ones. You find duplication sprinkled liberally across your codebase &#8211; all trying to do the same thing in multiple ways. Each developer of course believes that they were the first ones to implement it (and implement it right!!).</li>
<li>Design is an after-thought you are told. Why waste time in design when you can implement? No, you don&#8217;t want big design up front &#8211; and you also don&#8217;t want the opposite. This sign usually manifests itself during testing &#8211; you discover the same need across sub-systems or modules. A little design would have discovered this as a reusable capability early on.</li>
<li>There is no investment in training, documentation, communication, or integration support for reusable assets. If you build it they won&#8217;t come and you end up with a library of assets that are buggy, unusable, and worse &#8211; irrelevant to business needs.</li>
<li>You have no hooks in the development process that will help you proactively take advantage of reuse opportunities. Reuse if any happens ad-hoc due to heroic efforts of one or two developers sporadically.</li>
</ol>
<p>Have any of these signs resonate with your experiences? are there additional ones you can suggest?</p>
<p><strong>Like this post?</strong> Subscribe to <a href="http://feeds2.feedburner.com/SoftwareReuseInTheRealWorld">RSS feed</a> or get blog <a href="http://feedburner.google.com/fb/a/mailverify?uri=SoftwareReuseInTheRealWorld&#38;loc=en_US">updates via email</a>.</p>
<p style="text-align:right;"><strong> <a href="http://twitter.com/home?status=http://wp.me/ptCiB-qV"><img title="tweet this" src="/files/2009/10/twitter2.png" alt="tweet this" width="32" height="32" /></a> <a href="http://del.icio.us/post?url=http://wp.me/ptCiB-qV&#38;title=10 Signs Your Team Needs Systematic Reuse"><img title="del.icio.us:10 Signs Your Team Needs Systematic Reuse" src="/files/2009/10/dellicious.png" alt="add to del.icio.us" width="32" height="32" /></a></strong> <a href="http://www.facebook.com/sharer.php?u=http://wp.me/ptCiB-qV&#38;title=10 Signs Your Team Needs Systematic Reuse"><img title="facebook:10 Signs Your Team Needs Systematic Reuse" src="/files/2009/10/48x48.png" alt="post to facebook" width="32" height="32" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[replacer.rb and deleter.rb]]></title>
<link>http://thinkingbox.wordpress.com/2009/10/30/replacer-rb-deleter-rb/</link>
<pubDate>Fri, 30 Oct 2009 18:45:23 +0000</pubDate>
<dc:creator>thinkingbox</dc:creator>
<guid>http://thinkingbox.wordpress.com/2009/10/30/replacer-rb-deleter-rb/</guid>
<description><![CDATA[From time to time I find myself needing to replace certain strings globally (eg: in a directory tree]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>From time to time I find myself needing to replace certain strings globally (eg: in a directory tree), or deleting lines based on a match. I find sed extremely annoying and I don&#8217;t manage to get around its syntax. So ruby comes in handy!</p>
<p><strong>replacer.rb</strong></p>
<pre style="padding-left:30px;">exp_search = '&#60;%=launchBean\.getCustomVersion\(\)%&#62;'
exp_replace = '${xsession.info.launchBean.customVersion}'
directory = '**/'
file_mask = '*.jsp'

Dir.glob(directory+file_mask).each do &#124;file&#124;
  File.open(file, 'r+') do &#124;f&#124;
    content = f.read
    if /#{exp_search}/ =~ content
      s = content.gsub(/#{exp_search}/, exp_replace)
      f.rewind
      f.write s
      puts "#{file}: #{content.split(/#{exp_search}/).size-1} matches"
    end
  end
end
</pre>
<p><strong>deleter.rb</strong></p>
<pre style="padding-left:30px;">exp_search = 'useBean.*launchBean'
directory = '**/'
file_mask = '*.jsp'

Dir.glob(directory+file_mask).each do &#124;file&#124;
  count = 0
  content = ""
  File.open(file, 'r+') do &#124;f&#124;
    while line = f.gets
      if /#{exp_search}/ =~ line
        count += 1
      else
        content = content &#60;&#60; line
      end
    end
  end
  if count &#62; 0
    File.open(file, 'w') do &#124;f&#124;
      f.write content
      puts "#{file}: #{count} lines deleted"
    end
  end
end
</pre>
<p>These commands are especially useful if you have to refactor a codebase that doesn&#8217;t provide direct support with refactoring tools. In this case, I was refactoring a few hundred JSPs of a legacy system.</p>
<p>Credits to <a title="Use Ruby Scripting File (RSF) to manage your files" href="http://snippets.dzone.com/posts/show/7533" target="_blank">RSF</a> &#38; <a title="Ruby One-Liners @ reference.jumpingmonkey.org" href="http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-one-liners.html" target="_blank">Ruby One-Liners</a> for most of the code &#38; ideas. rcscript seems to be a bit too much for me at this time, I&#8217;m perfectly happy modifying replacer.rb and deleter.rb when I need it.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[KISS - Not Just A Legendary Rock Band (part 1)]]></title>
<link>http://tomschunkmn.wordpress.com/2009/10/30/kiss-not-just-a-legendary-rock-band-part-1/</link>
<pubDate>Fri, 30 Oct 2009 04:30:33 +0000</pubDate>
<dc:creator>tomschunkmn</dc:creator>
<guid>http://tomschunkmn.wordpress.com/2009/10/30/kiss-not-just-a-legendary-rock-band-part-1/</guid>
<description><![CDATA[I learned the KISS acronym (Keep It Simple Silly) a long time ago. Looking back on my career, I see ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I learned the KISS acronym (Keep It Simple Silly) a long time ago. Looking back on my<br />
career, I see the wisdom that the KISS acronym teaches.</p>
<p>When I was enhancing software or using some software (or website) and a recurring thought would cross my mind.  This thought was&#8221;what were they thinking about when they designed this screen (or web page, software, &#8230;)?&#8221;  It is a good bet that some of you might have had a similar thought. </p>
<p>What prompts that thought though?</p>
<p>Most often, it is simply about cramming too much information into the screen (or web page or software , from now on I will simply refer to both a screen and web page and software as software).</p>
<p>This data overload comes in the form of text, images, and data entry controls. There are resolutions using KISS to redesign the software. I propose 4 strategies to how to re-design (or refactor)  the software screen to alleviate the information overload. In the next 3 blog entries, I present those 4 strategies.</p>
<p>Stay tuned for more</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[NetBeans Refactoring - Part 1]]></title>
<link>http://significantinsignificance.wordpress.com/2009/10/30/netbeans-refactoring-part-1/</link>
<pubDate>Thu, 29 Oct 2009 22:29:58 +0000</pubDate>
<dc:creator>aelsadek</dc:creator>
<guid>http://significantinsignificance.wordpress.com/2009/10/30/netbeans-refactoring-part-1/</guid>
<description><![CDATA[This week I decided to give you, my dear readers, a little rest from my blabbering and go technical ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:center;"><a href="http://www.netbeans.org/"><img class="aligncenter" title="Splash Screen" src="http://i625.photobucket.com/albums/tt337/aelsadek/Splash.jpg" alt="" width="428" height="269" /></a></p>
<p>This week I decided to give you, my dear readers, a little rest from my blabbering and go technical a bit. I am going to talk about a very powerful and a personal favorite NetBeans feature: Refactoring.</p>
<p>If you do not know NetBeans, it is a free, cross-platform, open-source Integrated Development Environment (IDE) for software developers and a product of Sun Microsystems. An IDE is a software application that provides extensive facilities to programmers for software development, such as a source code editor, a compiler, an interpreter, build automation tools, and a debugger. For more information about NetBeans’ features, <a href="http://www.netbeans.org/features/index.html">visit the official website</a>.</p>
<p>Refactoring is about changing your source code easily. Imagine moving a class between packages and having to edit the package statements manually at the top of each file, or wanting delete a variable in the code and not knowing if it is referenced somewhere else in your application. Performing these types of operations manually can be time consuming and prone to error. However, with the advanced refactoring capability available in NetBeans, you can do such changes very easily. NetBeans provides many refactoring options on its Refactor menu. I am going illustrate half of them today and the other half in a following post.</p>
<p>For this post I have created two classes, ImportingClass and MoveClass. View them <a href="http://i625.photobucket.com/albums/tt337/aelsadek/ImportingClass.jpg">here</a> and <a href="http://i625.photobucket.com/albums/tt337/aelsadek/ImportingClass.jpg">here</a>.</p>
<p>There are some images that are not very clear because of page size limitations. You can click on any image to see it in full size.</p>
<p><strong>Rename:</strong></p>
<p>Rename refactoring allows you to change not only the name of the class but also any constructors, internal usages, and references to the renamed class by other classes. You can also rename the package, which will automatically rename all instances of the package name in your code, including comments. Here, I am going to change the name of the variable value to AddedValue in class ImportingClass:</p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/Rename1.jpg"><img class="aligncenter" title="Rename 1" src="http://i625.photobucket.com/albums/tt337/aelsadek/Rename1.jpg" alt="" width="717" height="451" /></a></p>
<p><strong> </strong></p>
<p style="text-align:left;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/Rename2.jpg"><img class="aligncenter" title="Rename 2" src="http://i625.photobucket.com/albums/tt337/aelsadek/Rename2.jpg" alt="" width="715" height="450" /></a></p>
<p style="text-align:left;">Automatically, the variable name is also changed in class MoveClass:</p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/Rename3.jpg"><img class="aligncenter" title="Rename 3" src="http://i625.photobucket.com/albums/tt337/aelsadek/Rename3.jpg" alt="" width="716" height="451" /></a></p>
<p><strong>Move:</strong></p>
<p>Moving a class from one package to another may seem like an easy task; you just have to copy and paste the contents of the source file into the new directory and then edit the package statement at the top of the file then you are good to go. However, if other classes import or reference that class, then the developer must also search through and modify those files. Here is how you can move MoveClass from the refactoringpackage2 package to refactoringpackage1:</p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/Move1.jpg"><img class="aligncenter" title="Move 1" src="http://i625.photobucket.com/albums/tt337/aelsadek/Move1.jpg" alt="" width="716" height="456" /></a></p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/Move2.jpg"><img class="aligncenter" title="Move 2" src="http://i625.photobucket.com/albums/tt337/aelsadek/Move2.jpg" alt="" width="716" height="452" /></a></p>
<p><strong>Copy:</strong></p>
<p>Copy refactoring allows you to copy the contents of a class to another package, automatically changing the package statement at the top of the source file.</p>
<p><strong>Safe Delete:</strong></p>
<p>Sometimes when you are reviewing a previously written code, you decide to remove a class member variable that you think is not used, only to find out that it does indeed appear in your code, and then your class does not compile. With Safe Delete refactoring, you can identify each usage of a class, method, or field in code before deleting it. I am going to illustrate it by trying to delete the AddedValue variable from class ImportingClass:</p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/Delete1.jpg"><img class="aligncenter" title="Delete 1" src="http://i625.photobucket.com/albums/tt337/aelsadek/Delete1.jpg" alt="" width="716" height="453" /></a></p>
<p>However, the variable was referenced in class MoveClass, so deleting it would cause an error. T=NetBeans alerts you to that, and can even show you where the member you want to delete is referenced if you clicked the &#8220;Show Usages&#8230;&#8221; button:</p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/Delete2.jpg"><img class="aligncenter" title="Delete 2" src="http://i625.photobucket.com/albums/tt337/aelsadek/Delete2.jpg" alt="" width="716" height="451" /></a></p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/Delete3.jpg"><img class="aligncenter" title="Delete 3" src="http://i625.photobucket.com/albums/tt337/aelsadek/Delete3.jpg" alt="" width="715" height="451" /></a></p>
<p><strong>Change Method Parameters:</strong></p>
<p>Change Method Parameters allows you to safely change everything in a method header- access modifier and arguments- and notifies you if this change is going to affect your source file. Here, I am going to try to delete the parameter x of the display method of class ImportingClass:</p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/ChangeMethod1.jpg"><img class="aligncenter" title="Change 1" src="http://i625.photobucket.com/albums/tt337/aelsadek/ChangeMethod1.jpg" alt="" width="716" height="453" /></a></p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/ChangeMethod2.jpg"><img class="aligncenter" title="Change 2" src="http://i625.photobucket.com/albums/tt337/aelsadek/ChangeMethod2.jpg" alt="" width="716" height="454" /></a></p>
<p>Parameter x is used within the method body, and so a warning is displayed:</p>
<p><a href="http://i625.photobucket.com/albums/tt337/aelsadek/ChangeMethod3.jpg"><img class="alignnone" title="Change 3" src="http://i625.photobucket.com/albums/tt337/aelsadek/ChangeMethod3.jpg" alt="" width="716" height="451" /></a></p>
<p>For the following examples, I created a class called Truck, which inherits fr0m a class called Vehicle. View <a href="http://i625.photobucket.com/albums/tt337/aelsadek/Netbeans/Vehicle.jpg">here</a>.</p>
<p><strong>Pull Up:</strong></p>
<p>When working with classes and superclasses, Pull Up refactoring is very useful. It allows you to move class members and methods from a subclass up into the superclass.</p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/PullUp1.jpg"><img class="aligncenter" title="Pull 1" src="http://i625.photobucket.com/albums/tt337/aelsadek/PullUp1.jpg" alt="" width="715" height="450" /></a></p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/PullUp2.jpg"><img class="aligncenter" title="Pull 2" src="http://i625.photobucket.com/albums/tt337/aelsadek/PullUp2.jpg" alt="" width="715" height="452" /></a></p>
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/PullUp3.jpg"><img class="aligncenter" title="Pull 3" src="http://i625.photobucket.com/albums/tt337/aelsadek/PullUp3.jpg" alt="" width="716" height="456" /></a></p>
<p><strong>Push Down:</strong></p>
<p>Push Down is the opposite of Pull Up refactoring. It pushes a superclass member down into a subclass.</p>
<p style="text-align:center;"><a style="text-decoration:none;" href="http://i625.photobucket.com/albums/tt337/aelsadek/PushDown1.jpg"><img class="aligncenter" title="Push 1" src="http://i625.photobucket.com/albums/tt337/aelsadek/PushDown1.jpg" alt="" width="716" height="451" /></a></p>
<p style="text-align:center;">
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/PushDown2.jpg"><img class="aligncenter" title="Push 2" src="http://i625.photobucket.com/albums/tt337/aelsadek/PushDown2.jpg" alt="" width="716" height="450" /></a></p>
<p style="text-align:center;">
<p style="text-align:center;"><a href="http://i625.photobucket.com/albums/tt337/aelsadek/Netbeans/Vehicle.jpg"><img class="aligncenter" title="Push 3" src="http://i625.photobucket.com/albums/tt337/aelsadek/Netbeans/Vehicle.jpg" alt="" width="716" height="449" /></a></p>
<p style="text-align:left;">
<p style="text-align:left;">And that&#8217;s it for this time, note that those are only half of the capabilities of NetBeans refactoring. I am going to go through the other half in a following post soon. If you have any question or comment, do not hesitate to <a href="http://significantinsignificance.wordpress.com/contact/">contact me</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Roll your own process]]></title>
<link>http://davidvivash.wordpress.com/2009/10/29/roll-your-own-process/</link>
<pubDate>Thu, 29 Oct 2009 13:51:53 +0000</pubDate>
<dc:creator>davidvivash</dc:creator>
<guid>http://davidvivash.wordpress.com/2009/10/29/roll-your-own-process/</guid>
<description><![CDATA[There are many software development methodologies out there &#8211; some are beaurocratic, with a bi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>There are many software development methodologies out there &#8211; some are beaurocratic, with a big design up front, some are agile, with lots of practices to follow, and some are &#8220;lean&#8221;, where you&#8217;re given guidelines on how to optimise the flow of new requirements into features. Or whatever.</p>
<p>Today, i&#8217;ll be looking at how to create your very own agile process, based on lean principles &#8211; imagine that! Your very own process! You then have to write your own book on it and defend it to the hills (this is left as an exercise to the reader).</p>
<p><strong>Choose your process</strong></p>
<p>You need to pick 1 (yep, just 1) practice from under each of the bullet points.  If a practice is repeated you should pick a different one, unless you want to be ultra-lean.</p>
<ol>
<li><strong>Eliminate Waste</strong>
<ul>
<li>Test driven development</li>
<li>Simple design</li>
<li>Measure velocity</li>
<li>Reduce task switching</li>
<li>Make value flow</li>
<li>JIT development</li>
</ul>
</li>
<li><strong>Create Knowledge</strong>
<ul>
<li> Pair programming</li>
<li> Perform retrospectives</li>
<li> Do spike solutions to difficult problems</li>
<li> Collective ownership</li>
</ul>
</li>
<li><strong>Build Quality In</strong>
<ul>
<li> Pair programming</li>
<li> Test driven development</li>
<li> Peer review</li>
<li> Coding standards</li>
</ul>
</li>
<li><strong>Defer Commitment</strong>
<ul>
<li> Incremental design</li>
<li> Short iterations</li>
<li> Refactor</li>
</ul>
</li>
<li><strong>Optimize the Whole</strong>
<ul>
<li> Continuous integration</li>
<li> Refactor</li>
<li> Automate everything! (Tests, build process, release process&#8230;)</li>
</ul>
</li>
<li><strong>Deliver Fast</strong>
<ul>
<li> Continuous integration</li>
<li> Optimize workflow (eg. limit 3 items in the &#8220;ToDo&#8221; stage)</li>
<li> Short iterations</li>
<li> No BDUF</li>
<li> JIT development</li>
</ul>
</li>
<li><strong>Respect People</strong>
<ul>
<li> Daily Scrum</li>
<li> Collective ownership</li>
<li> Sustainable pace</li>
</ul>
</li>
</ol>
<p>&#160;</p>
<p>You should now have 7 practices. If you have fewer (eg. you&#8217;ve chosen pair programming for &#8220;create knowledge&#8221; and &#8220;build quality in&#8221;), then you&#8217;ll need to defend your process more by saying your developers are smart.</p>
<p>If you think your developers aren&#8217;t that smart, or you don&#8217;t trust that your set of practices will reinforce each other, go and select a couple more practices to be on the safe side.</p>
<p><strong>Now argue</strong></p>
<p>The most important thing is, of course, how well you argue that your new process is better than all the others. I&#8217;ll give you the process i have selected, and show you how to argue about it:</p>
<ol>
<li>Test driven development</li>
<li>Pair programming</li>
<li>Peer review</li>
<li>Short iterations</li>
<li>Continuous integration</li>
<li>JIT development</li>
<li>Collective ownership</li>
</ol>
<p>An argument may now ensue:</p>
<p><strong>You:</strong> Your process doesn&#8217;t involve the customer enough &#8211; how do you make sure the correct software is written?</p>
<p><strong>Me:</strong> Obviously &#8220;collective ownership&#8221; extends to the customer &#8211; they need to take equal responsibility for the development. We also have short iterations which means, of course, we have regular release to the customer, so they can be sure we are moving in the right direction. And because of our other practices, the code that&#8217;s released will always be production quality!</p>
<p><strong>You:</strong> Well, that won&#8217;t work for us because&#8230;</p>
<p><strong>Me:</strong> Either (a) You&#8217;re not doing it right! or (b) Obviously you need to change it slightly for your circumstances&#8230;</p>
<p>&#160;</p>
<p>So the next time you find your current process isn&#8217;t working for you, revisit this blog post and create your own! You can swap-in and swap out whatever practices you want under 1 heading, or just do them all and say you&#8217;re doing XP!</p>
<p><em>Whilst this is tongue in cheek, the question you should really be asking yourself  is: does the process you are currently following cover the above 7 process headings. If not, is that something you can live without, or are you missing something?</em> And you really should be doing at least those 7 things&#8230;</p>
<p>&#160;</p>
<p>&#160;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Beware of Resharper's var hint]]></title>
<link>http://davidvivash.wordpress.com/2009/10/29/beware-of-resharpers-var-hint/</link>
<pubDate>Thu, 29 Oct 2009 11:31:15 +0000</pubDate>
<dc:creator>davidvivash</dc:creator>
<guid>http://davidvivash.wordpress.com/2009/10/29/beware-of-resharpers-var-hint/</guid>
<description><![CDATA[I don&#8217;t personally use Resharper, but a few developers i work with love it, so i thought i]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I don&#8217;t personally use Resharper, but a few developers i work with love it, so i thought i&#8217;d give it a go.</p>
<p>I won&#8217;t bother reviewing it, as that&#8217;s something that&#8217;s been done everywhere already, but i&#8217;d like to highlight 1 particular danger of using such tools: <strong>these tools may suggest you do things which are dangerous, and are bad programming practice</strong>.</p>
<p>I am posting specifically about Resharper&#8217;s hint to replace all variable declarations with the <strong>var</strong> keyword.</p>
<p>So i looked on the internet, and saw that other people have similar concerns about using the var keyword.  I don&#8217;t share all those concerns &#8211; i think it&#8217;s worth using when a variable is created on the same line it is declared.  I think it&#8217;s very dangerous to use it when capturing the return value from a method call.</p>
<p>This is okay:<br />
<code>var myList = new List&#60;int&#62;();</code></p>
<p>This is not okay:<br />
<code>var myList = peopleDataAccess.GetPeopleIDs();</code></p>
<p>If you are not familiar with C#, or especially if you are not familiar with the new features being added to C#, it&#8217;s tempting to take Resharper&#8217;s suggestions on face value.</p>
<p>However, in the second example above, <code>myList</code> is now depending on the return value of a particular method.  If that method is refactored such that the return type changes, the line above will still work fine, but using the variable elsewhere in the function will <em>probably</em> cause a compile time error. If you were explicit and said what you expect the method to return, the compiler would point to the declaration of the variable being wrong, not the use of it.</p>
<p>This is a big problem if you have many developers working on a project &#8211; if you change the return type, and update all the references, other developers may still get problems when they update to the latest version on their branch and get strange &#8220;method doesn&#8217;t exist&#8221; errors at compile time. If they were to <em>instead</em> get an error on the variable declaration line, they can see GetPeopleIDs now returns a PeopleIDCollection object (for example), rather than a list of integers, and fix the code much more quickly.</p>
<p>Why make developers hunt around for the cause of the problem, when the compiler can point to the cause directly?</p>
<p>So the moral, if there is one, is probably: <strong>Be wary of the advice that tools are giving to developers</strong>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[When it's Design Hell]]></title>
<link>http://blog.criticalresults.com/2009/10/28/design-hell/</link>
<pubDate>Wed, 28 Oct 2009 16:33:09 +0000</pubDate>
<dc:creator>Mark W. Schumann</dc:creator>
<guid>http://blog.criticalresults.com/2009/10/28/design-hell/</guid>
<description><![CDATA[What do you do when your project already sucks, and it&#8217;s already late, and the design you]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>What do you do when your project already sucks, and it&#8217;s already late, and the design you&#8217;ve been committed to is Hell?</p>
<p><!--more-->I have this thing I do; I sort of call it &#8220;Emergency Agile.&#8221; Note that it&#8217;s <strong>completely wrong</strong> by normal standards but it kind of gets projects off the proverbial dime.</p>
<p>You totally want to read more about this, and you will, if you get onto <a title="Free stuff! Easy! Fun!" href="http://criticalresults.com/freestuff.html">my eZine mailing list</a>. You get a complete mailing about once a month, with articles and links and special offers that help you do your job, as well a quick note every week or so with something funny or interesting. Do you need more stress? No? Then this is for you.</p>
<p>Anyway, here&#8217;s how I deal with Design Hell.</p>
<h2>First thing</h2>
<p>You know what? Projects get messed up for good reason. Software design and implementation is really difficult, defintely more difficult than your management grasps. I keep getting called ostensibly because this or that team member is a jerk or over his head or not working hard enough. <em>This very rarely turns out to be true.</em> The world of software development is full of clever, hard-working, professional people.</p>
<p>Nobody does a bad design on purpose. Got it?</p>
<h2>Second thing</h2>
<p>Almost always, there is some particularly big obstacle, but it can be at any conceptual level. Finding that level is the key. Is it as simple and direct as a specific, deep bug? That&#8217;s awesome, because you can find it and fix it and be on your way.</p>
<p>As a software practitioner, one of the coolest and most useful skills you can develop is that of <a title="Reading other people's code" href="http://designbygravity.wordpress.com/2009/10/23/how-to-read-other-peoples-code-and-why/">reading other people&#8217;s code</a>. It&#8217;s cool because it&#8217;s difficult, combining technical kung-fu with a rough-and-ready psychology. It&#8217;s useful because it prevents having to rewrite the entire system from scratch. In particular, it&#8217;s good to make a <span style="text-decoration:underline;">separate model of the code</span>, something you can put in prose or on a whiteboard. Keep refining that model as you discover more and more about the existing code. Quite soon some patterns will emerge and repeat themselves.</p>
<p>Sometimes underlying it all is an overall design issue&#8211;like a messy class hierarchy that&#8217;s hard for normal people to follow, or a key data structure that nobody&#8217;s quite explained. One time I saw a four-dimensional array in JavaScript that drove <em>everything</em> in the application but had no descriptive comments at all!</p>
<p>Or you might find that the toolset is completely disconnected from the purpose of the application, such as n-tier applications done (in this decade) with Visual Basic 6 in the middle. (Sure you can make it work, but what a slog.) The original developers may have had great knowledge and the best intentions, but they were stuck working without implementation inheritance and a fairly weak standard class library.</p>
<p>In any case,the point is to answer the very general question: &#8220;What is it that we&#8217;re looking at?&#8221; Is it a solid design with a lot of implementation bugs? Is it overly ambitious? Did the first developer fail to understand inheritance, or when to use composition or interfaces instead? Is it way too highly coupled? (I see that one a lot.)</p>
<h3>Big Ball of Mud</h3>
<p>Very likely, though, your design issue is that <em>there is no design</em>. This is often referred to as the <a title="Big Ball o'Mud" href="http://www.laputan.org/mud/">Big Ball of Mud</a> pattern: &#8220;a casually, even haphazardly,  structured system.&#8221; What a pain! These systems are particularly hard to understand and modify. The good news is that the Ball of Mud gives you free rein to reformat and refactor the code; since there is no design, you can&#8217;t possibly break the design.</p>
<h2>Next thing</h2>
<p>Whether you&#8217;ve got a Big Ball of Mud, or just badly suited design, the key is to use <em>what you know about what&#8217;s wrong</em> to create <em>quick</em> and <em>incremental</em> design improvements. There&#8217;s more than one way to accomplish that, and the right way depends so much on the details of your project, but here are a few <em>wicked short-term techniques</em> for getting the code under control:</p>
<ul>
<li>Pair-program the easy parts first.</li>
<li>Collect selected globals into a Singleton class, then control access to them.</li>
<li>Run over the code with ReSharper or similar.</li>
<li>Pair-program the hard parts first.</li>
<li>If the design was too ambitious, extract the simplest parts and keep them.</li>
<li>Intentionally break highly coupled code. Stitch it back together with loose coupling.</li>
<li>Document the data structures, even if you have to guess a little.</li>
<li>Profile the code to find out what sections are never called, and remove them.</li>
<li>Impose naming conventions, which sometimes help reveal patterns in the code.</li>
</ul>
<p>When you do this, the design of the existing code isn&#8217;t so much created as discovered and shaped as you go along&#8211;less like architecture, more like sculpting.</p>
<h2>Back to the first thing</h2>
<p>If you make design improvements quickly as you go, you&#8217;ll doubtless find things the previous developers did right. Take a moment to appreciate their skull sweat, even as you regret the things they did wrong. Software development is an inherently difficult and frustrating task. There&#8217;s nothing wrong with sharing a laugh over some really bad code, but remember the goal is to build maximum value with what you have.</p>
<p>Good luck getting out of Design Hell! Do it one little bit at a time, but quickly.</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
