<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Robby on Rails: Keeping the Code Organic</title>
    <link>http://www.robbyonrails.com/articles/2005/10/29/keeping-the-code-organic</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>thoughts.sort_by{|t| t[:topic]}.collect </description>
    <item>
      <title>Keeping the Code Organic</title>
      <description>&lt;p&gt;The landscape around us is quickly changing-&lt;del&gt;really, it has been changing for some time now&lt;/del&gt;-we&amp;#8217;ve come a point where we admit that it&amp;#8217;s okay to want more for less. We want more features, &lt;strong&gt;in less time&lt;/strong&gt;. We want more control, for &lt;strong&gt;less money&lt;/strong&gt;. Why? When did we collectively decide that huge monolithic systems could be completed in a fraction of the time it &lt;em&gt;should&lt;/em&gt; take?&lt;/p&gt;


	&lt;p&gt;After years of working in  .NET, &lt;span class="caps"&gt;PHP&lt;/span&gt;, Perl, and even a little Python, I have gone down the road of simplicity. I want simple looking code (thank you Ruby). Code that I can hand off to another developer and for them to simply &lt;strong&gt;get it&lt;/strong&gt;&amp;#8212;which helps to keep things moving. It&amp;#8217;s about getting the project done.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; The client wants delivery in X days, so you aim for Y days early. Shortcuts get made, tests are forgotten, code is blemished, and deadlines still manage to sneak by unmet. Why do we do this to ourselves?&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;I say, no more!&lt;/strong&gt;&lt;/p&gt;


	&lt;h3&gt;Sacrifices Are Okay&lt;/h3&gt;


	&lt;p&gt;What? You mean I can &lt;em&gt;choose&lt;/em&gt; to leave something out? I can-&lt;del&gt;dare, I say&lt;/del&gt;-tell my client &lt;strong&gt;no&lt;/strong&gt;? Yes! Well, maybe. It&amp;#8217;s time to &lt;strong&gt;re&lt;/strong&gt;-think how you view your projects. Have you asked your client, &amp;#8220;What is the &lt;strong&gt;single-most-important&lt;/strong&gt; feature of this project?&amp;#8221; Every project has one. Your customer will likely be relieved to hear that you care about the purpose of the project. And it gives you an idea as to where &lt;strong&gt;not&lt;/strong&gt; to make sacrifices, which in turn helps to identify the areas where you can.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;So, if you haven&amp;#8217;t asked them yet&amp;#8230; &lt;em&gt;ask them now&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;


	&lt;h3&gt;The Big Picture&lt;/h3&gt;


	&lt;p&gt;If things change, how will it impact your timeframe? When your schedule is threatened, it becomes easier to see what isn&amp;#8217;t necessary, or perhaps, not necessary &lt;strong&gt;right now&lt;/strong&gt;.&lt;/p&gt;


	&lt;p&gt;All features in a project are part of the big pictures. If you ask your client what is &lt;strong&gt;required&lt;/strong&gt; they will almost always respond with the all to easy, &amp;#8220;everything.&amp;#8221; Simply accepting this as fact often leads to shoddy workmanship in favor of giving your client &amp;#8220;everything.&amp;#8221; To the client it may seem like you aced the test, but that&amp;#8217;s because they don&amp;#8217;t know you&amp;#8217;ve cheated. I&amp;#8217;m sure a lot of you know what it&amp;#8217;s like to inherit the code of someone who has done this, and you know you&amp;#8217;ve probably been on the other end as well.&lt;/p&gt;


	&lt;h3&gt;A Neverending Story&lt;/h3&gt;


	&lt;p&gt;Projects aren&amp;#8217;t just instantly created, they &lt;strong&gt;evolve&lt;/strong&gt;. They need to be fine-tuned, maintained and should most certainly be &lt;a href="http://www.refactoringrails.com"&gt;refactored&lt;/a&gt; when necessary. Most projects require ongoing work&amp;#8230; because requirements &lt;strong&gt;do&lt;/strong&gt; change.&lt;/p&gt;


	&lt;p&gt;It&amp;#8217;s time to stop and really consider how you approach both your clients and their projects. Can the next project be built in an evolutionary fashion? Can you focus on one new feature at a time, maintaining your tests, and &lt;em&gt;avoiding bloat&lt;/em&gt;?&lt;/p&gt;


&lt;blockquote&gt;
&amp;#8220;Big fleas have little fleas
Upon their backs to bite &amp;#8216;em:
Little fleas have lesser fleas
And so ad infinitum.&amp;#8221; 
&lt;/blockquote&gt;

	&lt;p&gt;I found this in a book that I picked up at the local Library booksale for something like 20 cents. The book, &lt;a href="http://www.amazon.com/exec/obidos/tg/detail/-/B0006D8J40/qid=1130637858/sr"&gt;The New Utopians&lt;/a&gt; by, Robert Boguslaw was written in 1965 and has some  insightful thoughts on systems as &lt;strong&gt;organisms.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Keep it Organic&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Pesticides are not necesary to produce quality produce. They are a cheap shortcut that can cause other problems in the longrun, and are generally not a healthy addition to the lifecycle of the fruit or vegetable (or to those who harvest it and consume it).&lt;/p&gt;


	&lt;p&gt;Test-Driven Development allows you to constantly monitor the behavior of your application. Feature-Driven Development keeps your team focused on what is currently the most important piece of your project. Don&amp;#8217;t rely on pesticide, let the project flow the way it wants to.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Keep it Flexible&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Business Rules should not be flexible&amp;#8230; but they should. That sounds confusing, but it&amp;#8217;s not. Know where to make that distinction. Add your rules first&amp;#8230; build your tests&amp;#8230; then code. Maintain flexibility &lt;strong&gt;through&lt;/strong&gt; your rules.&lt;/p&gt;


	&lt;p&gt;Test First. Code Second. Lather. Rinse. Repeat.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Be Proud of Your Code, But Not Blinded By It&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;&lt;em&gt;You&amp;#8217;re&lt;/em&gt; biased. Your &lt;em&gt;code&lt;/em&gt; is biased. The opinion that you have &lt;em&gt;about&lt;/em&gt; your code is biased. You are proud of your code&amp;#8230; but you can do it better and some people are better at somethings than you are. Don&amp;#8217;t dwell on it, embrace it.&lt;/p&gt;


	&lt;p&gt;How many of you are making the mistake of being the &lt;strong&gt;only&lt;/strong&gt; programmer on a project? I&amp;#8217;m not a big fan of &lt;strong&gt;big&lt;/strong&gt; teams, but I know that &lt;strong&gt;small&lt;/strong&gt; and &lt;strong&gt;focused&lt;/strong&gt; teams are extremly productive and better positioned for the big projects of tomorrow. Find someone that you trust and trade peer-review time. Not sure where to start? Pick up a copy of &lt;a href="http://www.powells.com/biblio/4-0201485672-0"&gt;Refactoring&lt;/a&gt;.  It&amp;#8217;s time that you &lt;strong&gt;RE&lt;/strong&gt;-think how you are doing things.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Embrace Heuristics&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;It&amp;#8217;s time to challenge yourself. A new year is almost upon us and we&amp;#8217;re all behind on our goals&amp;#8230; because things change. This is the time to explore your possibilities. Learn something new. Don&amp;#8217;t be afraid to break things. Just learn why the thing broke. Learn to be a good tester. Learn to write cleaner code. Learn to refactor your code. Learn to make it readable.&lt;/p&gt;


	&lt;p&gt;Learn to learn&amp;#8230; and remember to buy organic. ;-)&lt;/p&gt;</description>
      <pubDate>Sat, 29 Oct 2005 20:30:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:8e3c4ec83c18f48e2eb9d05efe9ff9ac</guid>
      <author>Robby Russell</author>
      <link>http://www.robbyonrails.com/articles/2005/10/29/keeping-the-code-organic</link>
      <category>Off-Topic</category>
      <category>Ruby</category>
      <category>Programming</category>
      <category>programming</category>
      <category>tdd</category>
      <category>fdd</category>
    </item>
  </channel>
</rss>
