<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Rails et al</title>
	<atom:link href="http://johnragan.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://johnragan.org</link>
	<description>My experiences in using Rails and associated Web 2.0 technologies</description>
	<lastBuildDate>Sat, 27 Feb 2010 21:22:31 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='johnragan.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/2d3be32dc1107f273b88154afd16d2e8?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Rails et al</title>
		<link>http://johnragan.org</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://johnragan.org/osd.xml" title="Rails et al" />
	<atom:link rel='hub' href='http://johnragan.org/?pushpress=hub'/>
		<item>
		<title>Clean Code and the 5S Principles</title>
		<link>http://johnragan.org/2010/02/27/clean-code-and-the-5s-principles/</link>
		<comments>http://johnragan.org/2010/02/27/clean-code-and-the-5s-principles/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 21:22:31 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Soft Skills]]></category>
		<category><![CDATA[Usability and Design]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=813</guid>
		<description><![CDATA[I recently listened to &#8220;Uncle &#8221; Bob Martin giving a podcast on Software Craftsmanship on Software Engineering Radio, and decided to pick up his book Clean Code &#8211; A Handbook of Agile Software Craftsmanship.  I was struck by the forward by James O. Coplien of Denmark on the 5S Principles and how they tied to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=813&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I recently listened to &#8220;Uncle &#8221; Bob Martin giving a podcast on Software Craftsmanship on Software Engineering Radio, and decided to pick up his book <em>Clean Code &#8211; A Handbook of Agile Software Craftsmanship</em>.  I was struck by the forward by James O. Coplien of Denmark on the 5S Principles and how they tied to maintenance instead of production in Total Productive Maintenance (TPM).  Furthermore, these principles as applied to the maintenance floor apply equally well to software:</p>
<ul>
<li><strong>Seiri (organization).</strong> You need to be able to find things easily.  In software, proper naming helps you find things easily.</li>
<li><strong>Seiton (tidiness; systematize).</strong> Everything has its appropriate place.  Code should be where it is expected to be, and if not, refactor to get it there.</li>
<li><strong>Seiso (cleaning; shine).</strong> Keep the workplace clean for easier thinking (think grease, wires, etc.).  In code, leaving commented-out code and inappropriate comments increases mental clutter that has to be overcome.</li>
<li><strong>Seiketso (standardization).</strong> The group agrees on how to keep the work place clean.  Consistent coding standards and patterns apply here.</li>
<li><strong>Shutsuke (self-discipline).</strong> Having the internal discipline to follow the practices and to reflect on one&#8217;s work.</li>
</ul>
<p>If you take a moment to really think about these parallels between the factory maintenance floor and the code we have to work in, these practices that reduce mental clutter on the factory floor apply equally well to developers working with code.  Less clutter means higher productivity and later mistakes.  For me, it was like a light bulb turned on.</p>
<p>One of his major points is that in coding, we spend 90% of our time reading, and only 10% of our time writing.  Thus, what we do to improve the efficiency of reading carries further weight.  Unfortunately, we are measured (subjectively or objectively) in terms of writing productivity, passing the costs on to fellow programmers later on.</p>
<p>It reminds me of what I wrote earlier while musing on Steve Krug&#8217;s <em>Don&#8217;t Make Me Think</em> as applied to web site design and usability.  By writing clean code, we require later developers to not have to think more deeply than necessary when reading and using our code by reducing misdirection and mental clutter.</p>
<p>I&#8217;m on page 21 of the book now, and looking forward to working through it in continuing to improve my own software craftsmanship.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/813/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=813&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/02/27/clean-code-and-the-5s-principles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
		<item>
		<title>Fluent Interfaces in Ruby</title>
		<link>http://johnragan.org/2010/02/26/fluent-interfaces-in-ruby/</link>
		<comments>http://johnragan.org/2010/02/26/fluent-interfaces-in-ruby/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 23:21:33 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=800</guid>
		<description><![CDATA[I had a chance to look at what Neal Ford had to write on Fluent Interfaces in his book The Productive Programmer.  Granted, I heard him cover it before at one of his presentations at the No Fluff Just Stuff conference in Reston, VA.
Basically, fluent interfaces have setter functions return self (or this in Java).  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=800&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I had a chance to look at what Neal Ford had to write on Fluent Interfaces in his book <em>The Productive Programmer</em>.  Granted, I heard him cover it before at one of his presentations at the <em>No Fluff Just Stuff</em> conference in Reston, VA.</p>
<p>Basically, fluent interfaces have setter functions return <em>self</em> (or <em>this</em> in Java).  By doing this, you can chain the setters together into what looks more like a composed english sentence instead of multiple single-line setter statements.  I find it easier to code and read code written in this manner (particularly in the <em>jQuery</em> style).</p>
<p>Sitting here watching Olympic couple&#8217;s figure skating with my wife, it seems like the perfect time to put some example ruby code together for this (as well as the <em>Self Yield</em> spell from Paolo Perrotta&#8217;s <em>Metaprogramming Ruby)</em>:</p>
<pre>class Car
    attr_accessor :speed, :wheels, :direction

    def initialize
        self
    end

    def moving_at(mph)
        self.speed = mph
        self
    end

    def with_wheel_count(count)
        self.wheels = count
        self
    end

    def heading_toward(toward)
        self.direction = toward
        self
    end

    def display
        puts "speed is #{speed}"
        puts "moving in direction #{direction}"
        puts "number of wheels is #{wheels}"
    end
end

car = Car.new.moving_at(65).heading_toward("NE").with_wheel_count(4).display</pre>
<p>attr_accessor would not have returned the object instance, requiring a different line for each mutator.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/800/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/800/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/800/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/800/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/800/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/800/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/800/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/800/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/800/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/800/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=800&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/02/26/fluent-interfaces-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
		<item>
		<title>Using SED for Variable Replacement</title>
		<link>http://johnragan.org/2010/02/24/using-sed-for-variable-replacement/</link>
		<comments>http://johnragan.org/2010/02/24/using-sed-for-variable-replacement/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 09:40:40 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=789</guid>
		<description><![CDATA[I was writing a KSH script with the following snippet:
exercises="ex1 ex2 ex3"
for exercise in exercises; do
    mkdir $home/$exercise
    filename=Target${exercise}Config.xml
done

The problem was I did not want the file to be named Targetex1Config.xml, but TargetExercise1Config.xml, respectively.  So, I wondered if it was possible to do double-dereferencing (i.e., go from exercise to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=789&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I was writing a KSH script with the following snippet:</p>
<pre>exercises="ex1 ex2 ex3"
for exercise in exercises; do
    mkdir $home/$exercise
    filename=Target${exercise}Config.xml
done
</pre>
<p>The problem was I did not want the file to be named <em>Targetex1Config.xml</em>, but <em>TargetExercise1Config.xml</em>, respectively.  So, I wondered if it was possible to do double-dereferencing (i.e., go from exercise to ex1 to Exercise1, such as in the following:</p>
<pre>exercises="ex1 ex2 ex3"
ex1=Exercise1
ex2=Exercise2
ex3=Exercise3
for exercise in exercises; do
    mkdir $home/$exercise
    filename=Target${${exercise}}Config.xml
done
</pre>
<p>That did not work, but a friend showed me the following use of SED with a regular expression to do the replacement:</p>
<pre>exercises="ex1 ex2 ex3"
for exercise in exercises; do
    mkdir $home/$exercise
    newName=`echo $exercise | sed -e s/ex/Exercise/`
    filename=Target${newName}Config.xml
done
</pre>
<p>This worked like a charm (at least once I figured out that the &#8216;`&#8217; above is not an apostrophe but the backward apostrophe underneath the &#8216;~&#8217; key).  Later that day when I needed to copy and rename a bunch of files using a boring, repetitive pattern, I used SED to help make that easier:</p>
<pre>
for file in Provider*.xml ; do
  mv $file `echo $file | sed 's/Ex/Exercise/'` ;
done
</pre>
<p>I would like to have used Ruby to modify the contents of the files automatically using regular expressions, but Ruby is not available in this environment, and case-sensitivity in changes is an issue.  Perhaps AWK can help me out with this.  Either way, I plan to dig deeper into SED and AWK.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/789/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/789/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/789/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/789/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/789/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/789/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/789/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/789/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/789/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/789/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=789&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/02/24/using-sed-for-variable-replacement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
		<item>
		<title>Safer Monkey Patching</title>
		<link>http://johnragan.org/2010/02/22/safer-monkey-patching/</link>
		<comments>http://johnragan.org/2010/02/22/safer-monkey-patching/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 08:30:48 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=761</guid>
		<description><![CDATA[General Monkey Patching
In Java, classes are defined up front, compiled into bytecode, and remain unaltered.  Every instance created from a class adheres to that class.
Of course, Ruby is different.  In Ruby, you can define a class and later redefine it (and of course, you can modify individual instances of a class so that they differ [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=761&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<h3>General Monkey Patching</h3>
<p>In Java, classes are defined up front, compiled into bytecode, and remain unaltered.  Every instance created from a class adheres to that class.</p>
<p>Of course, Ruby is different.  In Ruby, you can define a class and later redefine it (and of course, you can modify individual instances of a class so that they differ from the class):</p>
<pre>class car
   def drive
      "I'm driving!"
  end
end

# blah blah blah

# Reopen car and monkey patch it by adding a new method
class car
  def brake
     "hitting the brakes!"
  end
end</pre>
<p>From the Java point of view, it looks odd to repeat the class keyword twice with the same class.  But in Ruby, the class keyword simply places you back into the scope of the class you are working with (e.g., car).   There is no significant distinction in using it a second time.</p>
<p>What becomes more of an issue is that any plug-in or any code in your Ruby space can monkey patch a top-level entity (e.g., String) and globally change or break behavior.  This could include over-writing an existing method.  Furthermore, it can be difficult to determine what entity made the change.</p>
<p>There are two approaches that were highlighted from Rake and ActiveRecord in <em>Ruby Metaprogramming</em> for safer monkey patching.</p>
<h3>Monkey Patch with Module</h3>
<p>I lived in Texas for a few years, and the people were really friendly.  In their honor, I could monkey patch String as follows:</p>
<pre>class String
    def greeting
        "howdy ya'll!"
    end
end

"abc".greeting # =&gt; howdy ya'll!</pre>
<p>Unfortunately, there is no easy way to tell what made this change.  This would make it more explicit:</p>
<pre>module JohnRagan
    module String
        def greeting
            "howdy ya'll!"
        end
    end
end

class String
    include JohnRagan::String
end

puts "abc".howdy  # =&gt; howdy ya'll
puts String.ancestors # "JohnRagan::String" shows up as a module</pre>
<p>Now, the modules involved in monkey patching show up via ancestors.</p>
<h3>Preventing Monkey Patches</h3>
<p>Common lore is that folks in New York City are not as friendly as in Texas.  Whether or not this is actually true, let&#8217;s have some fun with it.  Let&#8217;s say a NYC developer writes a plug-in your Rails app includes, which contains the following:</p>
<pre>class String
    def greeting
        "go screw yourself!"
    end
end

"abc".greeting # =&gt; go screw yourself!</pre>
<p>Now, your code is suddenly rude and devoid of its previous Southern charm as this monkey patch has overridden the previous one.</p>
<p>While there may not much be you can do to prevent monkey patching by others, you can check to see if a method already exists before you monkey patch it yourself.  Rake has a mechanism it uses to prevent unintended monkey patching overwrites on its part.  Rake itself monkey patches the class Module, adding a method called rake_extension(method), which takes the method name, and method to be extended as a code block, and prevents the monkey patching (with a warning) if the method already exists.  I would have used it as follows:</p>
<pre>require 'rake'
class String
    rake_extension("greeting" ) do
        def greeting
            "howdy ya'll!"
        end
    end
end
</pre>
<p>If my developer friend in New York City had already added a greeting method, this logic would have ignored my monkey patch.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/761/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/761/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/761/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/761/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/761/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/761/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/761/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/761/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/761/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/761/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=761&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/02/22/safer-monkey-patching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby Metaprogramming &#8211; Dynamically Defining Classes and Methods</title>
		<link>http://johnragan.org/2010/02/18/ruby-metaprogramming-dynamically-defining-classes-and-methods/</link>
		<comments>http://johnragan.org/2010/02/18/ruby-metaprogramming-dynamically-defining-classes-and-methods/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:30:50 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=740</guid>
		<description><![CDATA[The following code uses a class factory to create a new class along with getter and setters for the fields passed into it:
class ClassFactory
  def self.create_class(new_class, *fields)
    c = Class.new do
      fields.each do &#124;field&#124;
        define_method field.intern do
   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=740&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>The following code uses a class factory to create a new class along with getter and setters for the fields passed into it:</p>
<pre>class ClassFactory
  def self.create_class(new_class, *fields)
    c = Class.new do
      fields.each do |field|
        define_method field.intern do
          instance_variable_get("@#{field}")
        end
        define_method "#{field}=".intern do |arg|
          instance_variable_set("@#{field}", arg)
        end
      end
    end

    Kernel.const_set new_class, c
  end
end

ClassFactory.create_class "Car", "make", "model", "year"

new_class = Car.new
new_class.make = "Nissan"
puts new_class.make # =&gt; "Nissan"
new_class.model = "Maxima"
puts new_class.model # =&gt; "Maxima"
new_class.year = "2001"
puts new_class.year # =&gt; "2001"
</pre>
<p>In Ruby, classes are simply objects like any other, which are then assigned to a constant.  Hence, to create a new class dynamically we instantiate the class Class with Class.new, and then assign it to a constant via const_set (we invoke it on Kernel so that it is a top-level constant like any other class).  We then add the code that makes up the class in a do-end block.</p>
<p>In that do-end block, for each field we invoke define_method twice, first for the getter method and then the setter method with get_instance_variable and set_instance_variable, respectively.  For each field, we create the instance variables (e.g., for make, we use @make).  Note how we make use of passing the argument in for the setter.</p>
<p>Additionally, if I wanted to make the class a sub-class, I could have used Class.new(parent_class)</p>
<p>I gave a brownbag recently at work on Java Web Services.  To get that to work, I had to run utilities to generate skeletons and stubs in java source that were then compiled into byte-code.  As you can see above, no such steps are necessary as the metaprogramming is naturally built into the language.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/740/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=740&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/02/18/ruby-metaprogramming-dynamically-defining-classes-and-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
		<item>
		<title>How Ruby Differs From Java</title>
		<link>http://johnragan.org/2010/02/15/how-ruby-differs-from-java/</link>
		<comments>http://johnragan.org/2010/02/15/how-ruby-differs-from-java/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 21:02:35 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=735</guid>
		<description><![CDATA[The biggest difference really comes down to metaprogramming.  While Java offers introspection (which was a major step up from C++), Ruby offers the ability to dynamically define new classes and methods without recompilation.  Additionally, the ability to hook into a module being included or a new class being sub-classed combined with metaprogramming adds extremely powerful [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=735&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>The biggest difference really comes down to metaprogramming.  While Java offers introspection (which was a major step up from C++), Ruby offers the ability to dynamically define new classes and methods without recompilation.  Additionally, the ability to hook into a module being included or a new class being sub-classed combined with metaprogramming adds extremely powerful new capabilities.  This is why in Rails I can sub-class from the model class and automatically have all the methods available to me for CRUD operations for my database entities.</p>
<p>In other words, I can create and use frameworks that leverage metaprogramming to make their use by end-users almost trivial.</p>
<p>Nonetheless, my love of Ruby does not cause me to knock Java.  I still enjoy coding in Java, and one should use the right tool for the job.</p>
<p>In order to be a better Rails and Ruby developer, I studied Pragmatic Programmer&#8217;s &#8220;Metaprogramming Ruby&#8221; (thumbs up).  By study, I mean read, took notes, created flash cards, wrote sample code and played, then finally created a suite of RUnit tests to exercise all the various capabilities.  &#8220;Mastering&#8221; Ruby metaprogramming greatly expanded my understanding of how Rails works under the covers.</p>
<p>I was surprised by how much Ruby metaprogramming had in common with JavaScript metaprogramming (such as dynamically defining methods).  Once again, this is one of the benefits of studying different languages &#8211; seeing the common patterns that emerge.</p>
<p>The next few blogs I do will go into Ruby metaprogramming.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/735/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/735/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/735/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/735/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/735/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/735/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/735/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/735/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/735/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/735/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=735&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/02/15/how-ruby-differs-from-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
		<item>
		<title>Pragmatic Wetware and The Dreyfuss Model</title>
		<link>http://johnragan.org/2010/01/28/pragmatic-wetware-and-the-dreyfuss-model/</link>
		<comments>http://johnragan.org/2010/01/28/pragmatic-wetware-and-the-dreyfuss-model/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 15:45:30 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=682</guid>
		<description><![CDATA[I saw the Pragmatic Wetware book by Andy Hunt.  &#8220;Hmm&#8221;, I thought, &#8220;a book on the human brain and how it works.  Interesting, but I have too much else to read and study.&#8221; Wrong.
Apparently I had missed the pragmatic part of that title.  As I am averaging three to five technical books a month right [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=682&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I saw the <em>Pragmatic Wetware</em> book by Andy Hunt.  <em>&#8220;Hmm&#8221;</em>, I thought, <em>&#8220;a book on the human brain and how it works.  Interesting, but I have too much else to read and study.&#8221;</em> Wrong.</p>
<p>Apparently I had missed the <em>pragmatic</em> part of that title.  As I am averaging three to five technical books a month right now, an investment in becoming more efficient in my learning and study would surely pay off.  So, I got the book, and I am glad I did.</p>
<p>Just as you want to be an efficient coder, if you are doing a lot of studying, you want to be an efficient learner.  I will talk about a few of things I found over a few blogs, but I highly recommend purchasing this book and implementing it.</p>
<p>In the Dreyfuss model, there are five levels of progression of mastery in terms of problem solving and the mental models you form:</p>
<ul>
<li>Novice.  They have little experience to rely on, but they can follow context-free rules (recipes) to guide them (think ISP help-desks and pre-canned scripts).</li>
<li>Advanced Beginner.  They can break away from context-free rules a little bit and try things on their own, but they do not have a big picture understanding.</li>
<li>Competent.  They have developed conceptual domain models and can work with them and solve problems.</li>
<li>Proficient.  They can reflect, improve, and learn from the experience of others.  They can apply maxims (as opposed to just recipes) to problems.</li>
<li>Expert.  They work from intuition instead of simply reason and are primary sources of information.</li>
</ul>
<p>Becoming an expert is more than just collecting a body of skills and knowledge; it is about moving to intuition-based problem solving based upon those experiences.</p>
<p>We have a great cookbook that my wife and I pick out a new recipe from to try each week.  I take the recipe, and I follow it carefully (X amount of flour, Y amount of seasoning X, etc.).  A great chef (such as my grandmother) did not follow a recipe &#8211; it was based on intuition gained over experience (a pinch of this, adjust it this much because of the humidity, etc.).  I tried to ask my grandmother once how to make something, and she couldn&#8217;t really articulate her responses beyond &#8220;add a little bit of this&#8221; and &#8220;cook it until its ready but not too long&#8221;.  This is the typical mark of an expert.</p>
<p>What does this mean in terms of coding?  Well, it means becoming an expert is a little less about collecting skills and more about applying skills intuitively given a particular context.  Any fool can apply a parade of various design patterns (I recall being one of those fools 13 years ago), but an expert will intuitively apply the right pattern given a particular context.  That seriously shifted my paradigm when I read it.</p>
<p>Personally, I have a backlog of skills I am studying and investing in to increase my knowledge and skills portfolio.  However, I plan to spend a lot more time going forward on context.  One of the things I will soon be doing is personally reviewing my entire technical career to determine what I did and did not do right given the particular contexts I was working in.  Am I repeating any poor patterns, what should I continue, what should I drop?  I expect it to be a worthwhile exercise.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/682/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/682/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/682/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/682/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/682/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/682/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/682/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/682/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/682/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/682/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=682&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/01/28/pragmatic-wetware-and-the-dreyfuss-model/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
		<item>
		<title>Software Anti-patterns and Software Development Philosophies</title>
		<link>http://johnragan.org/2010/01/23/software-anti-patterns-and-software-development-philosophies/</link>
		<comments>http://johnragan.org/2010/01/23/software-anti-patterns-and-software-development-philosophies/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 16:49:34 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Soft Skills]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=683</guid>
		<description><![CDATA[I always wanted to read the Anti-Patterns book, but never got to it.  I stumbled across the Anti-Patterns list on Wikipedia at http://en.wikipedia.org/wiki/Anti-patterns and found it to be a worthwhile read.  Obviously, a big part of learning what to do is learning what not to do as well.
I got to the end of it, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=683&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I always wanted to read the Anti-Patterns book, but never got to it.  I stumbled across the Anti-Patterns list on Wikipedia at <a href="http://en.wikipedia.org/wiki/Anti-patterns">http://en.wikipedia.org/wiki/Anti-patterns</a> and found it to be a worthwhile read.  Obviously, a big part of learning what to do is learning what not to do as well.</p>
<p>I got to the end of it, and discovered a link to Software Development Philosophies at <a href="http://en.wikipedia.org/wiki/List_of_software_development_philosophies" target="_blank">http://en.wikipedia.org/wiki/List_of_software_development_philosophies</a>.  Now, I can Kanban with the best of them!</p>
<p>A worthwhile read &#8211; check it out!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/683/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/683/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/683/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/683/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/683/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/683/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/683/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/683/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/683/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/683/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=683&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/01/23/software-anti-patterns-and-software-development-philosophies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
		<item>
		<title>Regular Expression Pushups</title>
		<link>http://johnragan.org/2010/01/21/regular-expression-pushups/</link>
		<comments>http://johnragan.org/2010/01/21/regular-expression-pushups/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 16:36:36 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Soft Skills]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=494</guid>
		<description><![CDATA[Regular expressions were not my strong suit, but I felt it was important to master them (or at least reach competency).  So, on a flight back from Walt Disney World last summer, I studied them from one of my Ruby books and summarized them in detail in Evernote (to refer back to them).  I thought [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=494&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Regular expressions were not my strong suit, but I felt it was important to master them (or at least reach competency).  So, on a flight back from Walt Disney World last summer, I studied them from one of my Ruby books and summarized them in detail in Evernote (to refer back to them).  I thought I had a good enough understanding where I could refer back to my Evernote reference material and quickly put it together &#8211; I was wrong.</p>
<p>Writing a Rails app I have been working on for fun, it took longer for me to put a working regular expression together than I expected.  I had studied, summarized and even written a few short programs for regular expressions in Ruby.  However, what I hadn&#8217;t done was to go from the other direction &#8211; take a domain problem and map it back to a regular expression.  That&#8217;s when I came up with &#8220;Regular Expression Pushups&#8221;.</p>
<p>When I was younger, I used to be able to do a massive amount of push-ups.  Rather than continuing to increase the count, I tried to do them more quickly.  Similarly, I reviewed my notes and created thirty-three problems that would use the underlying techniques.  I would do these as quickly as possible, and then later change the questions a little to see if I could do them more quickly.  The idea was to better form the &#8220;regular expression neural networks&#8221; in my brain</p>
<p>I&#8217;ve gone through one round and have seen a huge improvement.  I expect the second round will go a lot faster than the first (how could it not)?!</p>
<p>Here are the ones I put together:</p>
<ol>
<li> Find out if a certain string exists in as a substring within a document; and if so, where</li>
<li> Replace the contents of a string within a document with something else</li>
<li> Find three keys parts of a document and pull them out</li>
<li> Find the word &#8220;foo&#8221; in a sentence but it cannot be &#8220;foobar&#8221;.</li>
<li> Find a string that is a whole word only</li>
<li> Find a string that is not a case-sensitive match</li>
<li> Find the string foo or bar</li>
<li> Match foo and goo (and so forth) but not boo without using these as words in your formula</li>
<li> Find all strings that end in &#8220;oo&#8221; (3 character, and unlimited characters)</li>
<li> Find any string that ends in &#8220;oo&#8221; but boo is not valid (REPEATS #8?  Or subtle difference?  I think I reversed them)</li>
<li> See if a word matches that starts with &#8220;foo&#8221;.  Additionally, one that does not start with &#8220;foo&#8221;.</li>
<li> See if a string matches that ends with &#8220;bar&#8221;.  Additionally, one that does not end with &#8220;bar&#8221;.</li>
<li> Find a substring that begins with &#8220;foo&#8221; and ends with &#8220;bar&#8221;.</li>
<li> Find the first and last word in a sentence</li>
<li> Find the first character that is not a number or digit in a string</li>
<li> Find the first number in a string (and last number)</li>
<li> What is the text before the phrase &#8220;in the middle&#8221;?  What is the text that follows?</li>
<li> Find  &#8220;abc&#8221; or &#8220;abcabc&#8221; and so forth in the sentence</li>
<li> Find the string &#8220;abc&#8221; or &#8220;abcdef&#8221;</li>
<li> Find the string &#8220;abc&#8221; or &#8220;abc1&#8243; or &#8220;abc11&#8243; and so forth</li>
<li> Find all alphabetic words that end with the first &#8220;3&#8243;</li>
<li> Find the word that starts with an alphabetic character and ends with 17</li>
<li> Find the telephone number in the format 571-217-9451</li>
<li> Find a number (without commas) that is at least 5 digits</li>
<li> Find a number between 4 to 9 digits</li>
<li> Find the word that matches a sequence of 5 instances where there is one to 3 numbers and a single character</li>
<li> Find the string &#8220;abc&#8221; at the end of the string where there is a newline character</li>
<li> Given a dollar figure, return the portion without the cents.</li>
<li> Given string &#8220;#@%# 123bar 23bar 342 siojbar&#8221;, find the first word that does not have &#8220;bar&#8221; in it</li>
<li> Find all the instances of numbers greater than 5 digits</li>
<li> Find the number followed by the a space and word &#8220;bang&#8221; from &#8220;123 howdy 456 wow 789 bang&#8221;</li>
<li> Do a greedy match (from &#8220;abc!def!ghi!&#8221; get the whole thing for .+!)</li>
<li> Do a non-greedy match (from &#8220;abc!def!ghi!&#8221; get &#8220;the whole thing&#8221;abc!&#8221;" for .+!)</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/494/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/494/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/494/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/494/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/494/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/494/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/494/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/494/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/494/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/494/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=494&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/01/21/regular-expression-pushups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
		<item>
		<title>Debugging and Assumptions</title>
		<link>http://johnragan.org/2010/01/18/debugging-and-assumptions/</link>
		<comments>http://johnragan.org/2010/01/18/debugging-and-assumptions/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 15:35:12 +0000</pubDate>
		<dc:creator>John Ragan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Soft Skills]]></category>

		<guid isPermaLink="false">http://johnragan.org/?p=686</guid>
		<description><![CDATA[I wrote a simple program for work a week ago &#8211; a webMethods java service that deletes a directory and recursively deletes all files and sub-directories.  I put together some unit tests, and it ran great.  Then, I was told that when invoked from another service (creating the directory for zip/unzip), half the time the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=686&subd=johnragan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I wrote a simple program for work a week ago &#8211; a webMethods java service that deletes a directory and recursively deletes all files and sub-directories.  I put together some unit tests, and it ran great.  Then, I was told that when invoked from another service (creating the directory for zip/unzip), half the time the directory would not be deleted (though the children usually were), unless the program was run in debug mode.  Of course, when the program ran stand-alone, it was flawless.</p>
<p>Suspecting a race condition, I played with some delays (for analysis only) between the child and parent deletions as well as between this service and the service invoking it.  No luck with that.  Perhaps the invoking service was taking time to release the directory resource so I tried a 15 second delay to rule that out &#8211; no luck as well.</p>
<p>It didn&#8217;t make sense for such a simple program.  My guess was that another process was sometimes not releasing the resource and got stuck down that path for a bit.  After a while, I decided to create a mind-map as to what was going on and what I was observing to see what would be revealed.  As suggested in the <em>Pragmatic Wetware</em> book by Andy Hunt that I am finishing up, after a little bit of time the R-mode of my brain took over and I found a number of things I could try.</p>
<p>One of those things was checking to see if the directory had any children even after deleting all of them.  Of course, this was silly because only the directory remained empty (the files were gone), and I almost skipped trying.  Much to my surprise, they were not empty.  Playing with Winscp, I discovered unexpected .nfs files were showing up as files were deleted.  Furthermore, deleting the normal children mysteriously caused these files to be created, and deleting these files caused other .nfs files to suddenly spawn into the directory.  Thus, the directories were no longer empty and could not be deleted.</p>
<p>I drove home thinking about this debugging incident and how to make it better and more efficient.  Here is what came to mind:</p>
<ul>
<li>The use of mind maps was certainly effective and something I want to continue</li>
<li>Its important to challenge your assumptions and don&#8217;t get locked into them early.  Yes, it could be that another process did not release it, but there are other possibilities as well.  Using a mind map earlier would have helped, but more helpful would have been to assess how locked into my assumptions I was</li>
<li>Debugging is a technical and creative endeavor.  Studying L-mode facts about the situation, and then employing R-Mode techniques earlier on would have helped</li>
<li>You don&#8217;t need to stay locked on the problem until it is solved.  I should have moved on to other work and let the R-mode side of brain work on the problem in the background</li>
<li>Sitting down and trying to think of all the &#8220;evil&#8221; ways that the system could be messing me up was also helpful</li>
<li>Continue playing and trying things that should not happen &#8211; I am really glad I did that!</li>
</ul>
<p>In the end, I coded my program to delete the children before the parent directory because File.delete did not get rid of non-empty directories.  Because I saw the children gone, that obvious possiblity eluded me for a bit.  That is what I am thinking about for the future.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johnragan.wordpress.com/686/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johnragan.wordpress.com/686/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johnragan.wordpress.com/686/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johnragan.wordpress.com/686/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johnragan.wordpress.com/686/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johnragan.wordpress.com/686/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johnragan.wordpress.com/686/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johnragan.wordpress.com/686/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johnragan.wordpress.com/686/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johnragan.wordpress.com/686/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johnragan.org&blog=6643405&post=686&subd=johnragan&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://johnragan.org/2010/01/18/debugging-and-assumptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/157b41fc8320e0abfad285db47311e80?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">John Ragan</media:title>
		</media:content>
	</item>
	</channel>
</rss>