<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ihumanable &#187; development</title>
	<atom:link href="http://ihumanable.com/blog/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://ihumanable.com/blog</link>
	<description>usable in any place a human can be used</description>
	<lastBuildDate>Wed, 11 May 2011 15:10:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>baby steps</title>
		<link>http://ihumanable.com/blog/2010/02/10/baby-steps/</link>
		<comments>http://ihumanable.com/blog/2010/02/10/baby-steps/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 18:09:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web dev]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[gtd]]></category>

		<guid isPermaLink="false">http://ihumanable.com/blog/?p=713</guid>
		<description><![CDATA[Last night I had the unadulterated fun of updating a client&#8217;s blog. After handing off the reigns everything was going smoothly until some unknown combination of plug-ins was causing the mobile version of the site to be served to actual browsers. I was called in to triage the situation, nothing too dire, just two plug-ins [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_714" class="wp-caption alignright" style="width: 210px"><a href="http://ihumanable.com/blog/wp-content/uploads/2010/02/baby-up-steps.jpg"><img src="http://ihumanable.com/blog/wp-content/uploads/2010/02/baby-up-steps-200x300.jpg" alt="baby going up steps" title="baby-up-steps" width="200" height="300" class="size-medium wp-image-714" /></a><p class="wp-caption-text">Today I conquer steps, tomorrow France!</p></div>
<p>Last night I had the unadulterated fun of updating a client&#8217;s blog.  After handing off the reigns everything was going smoothly until some unknown combination of plug-ins was causing the mobile version of the site to be served to actual browsers.  I was called in to triage the situation, nothing too dire, just two plug-ins with some configuration problems, once I told them to play nice, all was fine.  It was then that I noticed there were 15 plug-in updates waiting and the whole WordPress install needed to be updated.  So I took the time to take a backup and update everything, nothing too serious (for anyone that doesn&#8217;t use WordPress, updating is a one-click affair now) just the day to day stuff that needs to be done to keep the lights on.</p>
<p>This got me thinking about upgrading and Google&#8217;s decision to <a href="http://arstechnica.com/microsoft/news/2010/02/ie6-users-to-be-evicted-from-gmail-google-calendar.ars">discontinue support for IE6</a>.  Some people are crying foul, saying that IE6 should still be supported, I&#8217;m decidedly of the I-hope-IE6-dies-in-a-fire camp.  Lest this become a let&#8217;s bash on IE6 rant, which it so easily could, fucking broken box-model CSS1 piece of shit, let&#8217;s get back on track.  The people that are upset about this are not technical luddites clinging to the familiar.  <a href="http://about.digg.com/blog/much-ado-about-ie6">Digg performed a user survey</a> to figure out what they should do about IE6 and part of that was asking why people used IE6.  Of IE6 users 70% responded that they either lacked administrative rights needed to upgrade IE6 or were told by someone at work that they could not upgrade.  For anyone that has ever worked in Corporate America this should be no surprise to you.  The nagging question though is why?</p>
<p>Why would the IT department, home of nerds always hell bent on trying out the latest and greatest, demand that you use a 9 year old piece of software?  There are a number of reasons people point to.</p>
<ol>
<li>Mission Critical application is only compatible with IE6</li>
<li>IE6 comes installed on all the machines</li>
<li>IE6 is maintained by Microsoft, less of a headache for us</li>
<li>Licensing / Partnership / Legal-mumbo-jumbo</li>
</ol>
<p>If you fall into #4, I pity you.  #3 is laughable because although the updates might be bundled with Windows Updates you aren&#8217;t saving yourself any administrative costs by putting the most targeted web browser for malware on all your machines.  #2 is true, but if you are big enough for an IT department you probably have some way to push software to machines (or you could, and this is a shocking idea, trust your employees to choose a browser that fits their needs).  I really, really, really want to talk about #1 though, because that is the point of this whole post.</p>
<p>I&#8217;ve worked at a number of places that used some sort of Web Application that was deemed critical that only worked right in IE6.  This was then used as a justification for never moving past IE6, the timecard application won&#8217;t work or the spline flanger won&#8217;t have those cool IE6 exclusive filters.  I understand that no one wants to expend resources on a &#8220;working&#8221; application pulling it into the future.  But what is the longterm idea here, are you just going to use IE6 forever?  This prevailing consensus seems to be ultimately self-defeating.  Google recognizes this and as they try to push what can be done with the web they find themselves expending far too much time and energy on a nearly decade old piece of technology.</p>
<p>The nice part about fixing an application on IE6 is that you avoid some cost in updating it to make it work with other browsers like IE7.  You could have spent a week or two adding in some CSS fixes and some markup changes and bingo bango IE7 now works like a charm.  Instead you decide to use Corporate Fiat to force the continued use of IE6.  Well now IE9 is looming around the corner and instead of paying a week here or a week there you now have a mountain of technical debt to pay down to get it to work.</p>
<p>Although IE6 is a convenient example, we can see this happen in all parts of the software development world.  This program compiles when linked to an older version of the library but not this new one, I don&#8217;t have the time to figure it out, well just link in the old one.  This is all well and fine to meet the deadline but you have just accrued some technical debt.  Later when that library gets some great new speed-up or killer new feature, there you will be plodding along with version 0.91 because you can&#8217;t get it to work with the new hawtness.  The problem is that these debts are not additive, they compound on one another and make what would be a simple conversion to 0.92 a nearly impossible conversion to 3.76.</p>
<p>Keep your tools up to date, keep an eye on what&#8217;s up and coming, you don&#8217;t have to be the first to jump on the latest and greatest but when a new version has proven itself and become the new standard move to it.  Technology doesn&#8217;t stand still, if you don&#8217;t keep up with the latest stable releases you will find yourself in a tight spot trying to do an overnight re-engineer of your product.  Take the easy baby steps from version to version so you don&#8217;t find yourself having to take a technological leap down the road.</p>
]]></content:encoded>
			<wfw:commentRss>http://ihumanable.com/blog/2010/02/10/baby-steps/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>toolmaker</title>
		<link>http://ihumanable.com/blog/2010/01/06/toolmaker/</link>
		<comments>http://ihumanable.com/blog/2010/01/06/toolmaker/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 14:50:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web dev]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://ihumanable.com/blog/?p=534</guid>
		<description><![CDATA[For about a year I had the unique experience of working at Abercrombie &#38; Fitch&#8217;s world headquarters in New Albany, Ohio as a Java Developer. It was a really interesting place to work, very stylish, loud music all the time, complex problems of incredible scale, and some of the best developers I&#8217;ve ever worked with. [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_535" class="wp-caption alignright" style="width: 272px"><img src="http://ihumanable.com/blog/wp-content/uploads/2010/01/monkey-toolmaker.jpg" alt="monkey using rock as a hammer" title="monkey-toolmaker" width="262" height="290" class="size-full wp-image-535" /><p class="wp-caption-text">Pictured Above: Programming</p></div>
<p>For about a year I had the unique experience of working at Abercrombie &amp; Fitch&#8217;s world headquarters in New Albany, Ohio as a Java Developer.  It was a really interesting place to work, very stylish, loud music all the time, complex problems of incredible scale, and some of the best developers I&#8217;ve ever worked with.  I was lucky enough to get placed into one of the most successful development teams, Planning.  This team had developed a tool that was hugely popular and well regarded, and I was coming on board to maintain and improve this tool.  The beautiful people and board-short dress code was just icing on the cake.</p>
<p>As a software developer this is a fairly basic scenario, there is some task that is complicated, business users want it to be less complicated, they give me some money, I make them some program, and everyone is happy.  The odd thing though is that while programmers are completely used to making tools for others, they often forget that they can leverage this amazing skill for their own benefit.  I distinctly remember a conversation I had with one of my colleagues there, Steve.  It centered around the idea that most developers are happy to just get their assigned tasks done, but there are some that are toolmakers, and being a toolmaker is more valuable to a company than being a developer.</p>
<p>Fast forward to after my stint at A&amp;F, I was on a new project and given the task of translating 80,000 lines of PL/SQL into T-SQL.  The idea was to use&#8230;um&#8230;find and replace&#8230;or&#8230;.something&#8230;and&#8230;um&#8230;get this to work.  With such a fine technical specification and a mountain of PL/SQL staring at me, Steve&#8217;s words bubbled up to my brain, &#8220;Make a tool.&#8221;  I had a time window of a some number of weeks to do the translation, it was a bit of a gamble, but I decided to spend a week writing a tool.</p>
<p>After remembering how C# worked after a year in the trenches with Java I had a program that took in the PL/SQL parsed each line and translated it to T-SQL.  The task was made easier by the fact that I didn&#8217;t have to write a generalized parser for PL/SQL as the 80,000 lines were written in a fairly consistent style, which greatly simpified the translation tool.  After running the tool a few times, fixing some bugs, I had finished the task in a fraction of the projected time. Triumphantly, I went to my PM to show how I had just saved weeks of manual laborious work.  &#8220;Great, now here is your next task&#8230;.&#8221;</p>
<table style="margin-left: 55px;">
<tr>
<td>
<div id="attachment_538" class="wp-caption alignnone" style="width: 160px"><a href="http://ihumanable.com/blog/wp-content/uploads/2010/01/parade.jpg"><img src="http://ihumanable.com/blog/wp-content/uploads/2010/01/parade-150x150.jpg" alt="ticker tape parad" title="parade" width="150" height="150" class="size-thumbnail wp-image-538" /></a><p class="wp-caption-text">Expected Reaction</p></div>
    </td>
<td>
<div id="attachment_539" class="wp-caption alignnone" style="width: 160px"><a href="http://ihumanable.com/blog/wp-content/uploads/2010/01/thumbs-up.jpg"><img src="http://ihumanable.com/blog/wp-content/uploads/2010/01/thumbs-up-150x150.jpg" alt="guy giving an overenthusiastic thumbs up" title="thumbs-up" width="150" height="150" class="size-thumbnail wp-image-539" /></a><p class="wp-caption-text">Actual Reaction</p></div>
    </td>
</tr>
</table>
<p>So I didn&#8217;t get the praise I was expecting, that&#8217;s fine, I&#8217;m not 4, I don&#8217;t need a cookie.  I continued on in my tasks quietly pleased with saving myself weeks of tedious work.  Then the day came when the database requirements changed, the hundred or so <tt>CREATE TABLE</tt> statements would need to be altered.  The task wheel was spun, and since only my name was on it at the time (thus defeating the need for the wheel) I was the lucky person to go through and change various aspects of each table.</p>
<p>I thought to myself, &#8220;Great, there goes a day or two down the grunt-work hole.&#8221;  Then the part of my brain that I put in charge of remembering important things woke up and slapped me.  &#8220;You haven&#8217;t altered the SQL yet, just alter your tool to do this too and re-translate, dumbass.&#8221;  After pondering the suggestion, and possibly more importantly the insult, leveled at me by my brain, I opened up my translation tool.  A few keystrokes later the change to the translation mappings was made and I fired off the program.  Bits flew, gears cranked, and out came the exact result I was looking for, the tool had just saved me another day or two.</p>
<p>Ultimately the project was a big hit, we delivered on-time and on-budget for what was a somewhat aggressive schedule.  The tool saved us a good amount of time, let us get the application bootstrapped and running, which allowed us to start iterating and get things working.  Over the course of that project I created tools here or there that ended up saving me, and some thankful members of my team, time and effort.</p>
<p>The lesson here is that you should look around you and see if you can make some tools.  Tools can be scary though, they are a bit of an upfront cost, and if it doesn&#8217;t work out then you&#8217;ve wasted even more time.  With time and experience it becomes easier to recognize when it&#8217;s a good time to make a tool and when it&#8217;s a waste.  Here are some good guidelines for tool making success.</p>
<ul>
<li>The best candidates are tasks with high amounts of repetition and little logic.</li>
<li>Check to see if a similar tool already exists, don&#8217;t reinvent the wheel.</li>
<li>YAGNI (You Ain&#8217;t Gonna Need It).  You should be intimately familiar with the problem you are going to solve, solve exactly that problem, you can scale it out later.  I didn&#8217;t bother writing a general purpose PL/SQL to T-SQL translator, I only had one PL/SQL file to translate, if it worked on that then it worked on 100% of its input.</li>
<li>If it would take less time to do the boring thing manually than to build a tool, just suck it up and do the boring manual task</li>
<li>Share your tools, even if you don&#8217;t think they will be useful to anyone else on your team, sometimes a tool can provide a surprising benefit to others</li>
<li>KISS (Keep It Simple, Stupid).  This is no time to become a highfalutin architect.  Tools are normally quick and dirty one-offs, normal concerns like efficiency, user-friendliness, etc. can be brushed aside.  If the tool is getting used often and by many people you can refactor it to make it more efficient or user-friendly, but don&#8217;t pay that cost upfront</li>
</ul>
<p>Developing software often requires a high degree of focus on the problem at hand, I <a href="http://ihumanable.com/blog/2010/01/simplify/">wrote the other day</a> about one approach to problem solving, simplifying the problem.  This strategy can be coupled with toolmaking to dramatic effect.  Once you realize the simpler actions you can automate those and write a tool to perform the task for you.  The next time you are facing some mountainous problem, consider the toolmaking route.</p>
]]></content:encoded>
			<wfw:commentRss>http://ihumanable.com/blog/2010/01/06/toolmaker/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>modeling</title>
		<link>http://ihumanable.com/blog/2009/12/28/modeling/</link>
		<comments>http://ihumanable.com/blog/2009/12/28/modeling/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 20:33:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[side project]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://ihumanable.com/blog/?p=478</guid>
		<description><![CDATA[When solving a problem the most difficult part should almost never be the implementation. Implementing a solution should be fairly straightforward from the solution itself, if it is not, then your solution is incomplete. That doesn&#8217;t mean that you need to sit down with pen and paper and completely solve a problem before coding, this [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_479" class="wp-caption alignright" style="width: 235px"><a href="http://ihumanable.com/blog/wp-content/uploads/2009/12/americas-next-top-model.jpg"><img src="http://ihumanable.com/blog/wp-content/uploads/2009/12/americas-next-top-model-225x300.jpg" alt="america&#039;s next top model" title="americas-next-top-model" width="225" height="300" class="size-medium wp-image-479" /></a><p class="wp-caption-text">Just like this, only less beautiful women and more boring data</p></div>
<p>When solving a problem the most difficult part should almost never be the implementation.  Implementing a solution should be fairly straightforward from the solution itself, if it is not, then your solution is incomplete.  That doesn&#8217;t mean that you need to sit down with pen and paper and completely solve a problem before coding, this is an approach taken by some books attempting to teach software development.  Some go as far to advocate for an even stricter approach, something along these lines.</p>
<ol>
<li>Model the problem domain with UML or some other modeling technique</li>
<li>Translate your modeling into pseudo-code</li>
<li>Translate pseudo-code into actual code</li>
<li>Realize 2 month project took 2 years to complete</li>
<li>Go to step 1 (the problem has radically changed since you took so long)</li>
</ol>
<p>Of course, I&#8217;m poking fun at the books that take such a structured route.  Here is a news flash for everyone <strong>Programmers are lazy</strong>.  Here is another news flash (and this might actually be news to some people) <strong>Being lazy is good</strong>.  Not all laziness is good, if it causes you to cut corners and fail to deliver a high quality product, than you fail at life.  If however your laziness drives you to find an easier way to do things then &#8220;Lazy FTW!&#8221;</p>
<p>I have the &#8220;joy&#8221; of programming Java in my 9 to 5, when you write Java for a living you get used to the absurd amount of verbosity in your code, you also have the joy of Eclipse (notice no quotes around joy) that will write most of your Java code for you.  Then there are things like <a href="http://projectlombok.org">Project Lombok</a> that strive to make Java easier and more fun to write.  C# got the memo, and let their programmers be lazy, let&#8217;s take a look at attributes in a few languages</p>
<p>Here is some C# code to make a class called <tt>Foo</tt> with a string member called <tt>Bar</tt> that can be read and written</p>
<pre class="brush: csharp; title: ;">
public class Foo {
  public string Bar { get; set; }
}
</pre>
<p>They realized people are lazy, let&#8217;s look at the same thing in ruby</p>
<pre class="brush: ruby; title: ;">
class Foo
  attr_accessor :bar
end
</pre>
<p>Again, concise and simple, let&#8217;s look at some Java</p>
<pre class="brush: java; title: ;">
public class Foo {
  private string bar;

  public string getBar() {
    return this.bar;
  }

  public void setBar(string bar) {
    this.bar = bar;
  }
}
</pre>
<p>Can you hear it? I can, it&#8217;s the language architect saying &#8220;Just don&#8217;t be so lazy, write those simple functions, it isn&#8217;t hard.&#8221;  The truth of the matter is that it isn&#8217;t hard, in fact Eclipse will happily write these functions for you, just hit CTRL-SHIFT-G.  I&#8217;m sure there is a point here that I&#8217;m getting to, and here it is.  I don&#8217;t want to disparage Java or start a language war, what I want to point out is that Java has a different conceptual model than C# or ruby.  C# has the concept of properties and ruby has the concept of attributes, Java doesn&#8217;t have anything like this, classes have members and functions, nothing more.</p>
<p>The point is that the conceptual models your solution adopts will have huge ramifications on the implementation of the solution.  There are many examples of unifying philosophies that make things simpler.  Unix&#8217;s concept that everything is a file, C++ concept of streams, Erlang&#8217;s pervasive share-nothing message passing, ruby&#8217;s duck typing.  These are core concepts that have profound and far reaching consequences.</p>
<p>Working on a new side project I recently was struck by a way to simplify a complex data structure by adopting a new conceptual model.  Creating an internally consistent, elegant conceptual model is the most important thing you can do for a project&#8217;s success.</p>
<p>Conceptual modeling is a hard thing to get right, go into too much detail and your model becomes rigid and brittle, go into too little and the model can be impossible to implement correctly.  Making a good conceptual model is like making a good analogy, there are a few hallmarks to a good conceptual model.</p>
<ul>
<li>The conceptual model should <strong>simplify</strong> the problem domain.  Files and folders greatly simplifies the concept of a hierarchical file system by relating it to something commonplace.</li>
<li>The conceptual model should not be overly complex to translate into an implementation</li>
<li>The conceptual model should be uniform and consistent, if you find parts of the problem domain falling outside the conceptual model or feeling &#8220;tacked on&#8221; you should rework the model</li>
</ul>
<p>The next time a project seems stuck or overly complex, instead of refactoring code or attempting to throw another library at it, take a step back, look at the big picture and refactor your conceptual mode.</p>
]]></content:encoded>
			<wfw:commentRss>http://ihumanable.com/blog/2009/12/28/modeling/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>impedance</title>
		<link>http://ihumanable.com/blog/2009/12/21/impedance/</link>
		<comments>http://ihumanable.com/blog/2009/12/21/impedance/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 18:32:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[philosophy]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web dev]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://ihumanable.com/blog/?p=454</guid>
		<description><![CDATA[There is a threat to good software, one that threatens the most promising of software projects. This threat is impedance mismatch. I use impedence mismatch in the sense that Object-relational impedance mismatch uses the term, but make no mistake, I&#8217;m not talking about the difficulties of writing an ORM. What I wish to discuss is [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_456" class="wp-caption alignleft" style="width: 310px"><a href="http://ihumanable.com/blog/wp-content/uploads/2009/12/impedance-mismatch.jpg"><img src="http://ihumanable.com/blog/wp-content/uploads/2009/12/impedance-mismatch-300x264.jpg" alt="you can find really cool images searching for impedance mismatch, this one has lazers (with a z)" title="impedance-mismatch" width="300" height="264" class="size-medium wp-image-456" /></a><p class="wp-caption-text">you can find really cool images searching for impedance mismatch, this one has lazers (with a z)</p></div>
<p>There is a threat to good software, one that threatens the most promising of software projects.  This threat is impedance mismatch.  I use impedence mismatch in the sense that <a href="http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch">Object-relational impedance mismatch</a> uses the term, but make no mistake, I&#8217;m not talking about the difficulties of writing an ORM.  What I wish to discuss is far more insidious, it is death by a thousand paper cuts, it can spell ruin for any project.  Impedance mismatch is born out of the confusing first steps of a project, it can also arise from multiple developers working over time on a large project or from internal disagreements over the optimal solution.</p>
<p>The major problem is that when we go about designing some new piece of software, some whiz-bang solution, we do not fully understand the problem domain.  Any good development team will spend days filling up whiteboards with the solution that models the problem domain, but anyone with experience will tell you that once you get into the guts of a problem you realize that things need to be changed.  This is fine, in fact this is a sign that you are solving the actual problem and not the ideal one you began with, don&#8217;t worry about changing your solution to meet the realities of the domain.  The problem though is making these changes first class citizens and not some weird third class monster thrown into the mix.</p>
<p>Have you ever been on a project and heard a conversation like this?</p>
<blockquote><p>
New Developer: What is X?<br />
Grizzled Veteran: X is what we refer to internally as Y<br />
New Developer: Why do we call it Y internally but X on the UI<br />
Grizzled Veteran: Time constraints&#8230; budgets&#8230;. other misc. bullshit<br />
New Developer: *mental note: X is called Y sometimes*
</p></blockquote>
<p>BAMMO!  There&#8217;s some nasty impedance mismatch there.  The problem is not so much in what we display to the user, or what our object properties are called, or what the database columns are named, the issue is that we have made our mental model convoluted.  At the heart of all these systems we build as software developers is some sort of mental model, at runtime this is expressed in system as an object graph, for persistence it is expressed as a collection of tables and relationships, but all of these things are just a <strong>representation</strong> of some mental model.</p>
<div id="attachment_455" class="wp-caption alignright" style="width: 310px"><a href="http://ihumanable.com/blog/wp-content/uploads/2009/12/unicorn-rainbow.jpg"><img src="http://ihumanable.com/blog/wp-content/uploads/2009/12/unicorn-rainbow-300x225.jpg" alt="artist depiction: working with an elegant mental model" title="unicorn-rainbow" width="300" height="225" class="size-medium wp-image-455" /></a><p class="wp-caption-text">artist depiction: working with an elegant mental model</p></div>
<p>When our mental model is internally consistent and simple and elegant, it makes life easy and happy and unicorns shoot out of our monitors and everything is sunshine and puppies.  When your mental model gets convoluted it can be an awful and bewildering experience.  The problem comes from an increased overhead, instead of the mapping from one representation to the next being clear-cut, the developer has to carry around a hashmap in their skull mapping various representations of their mental model.  The difficulty of carrying out even trivial tasks is increased as the mapping from X -> Y -> Z -> Q -> P takes place.</p>
<div id="attachment_459" class="wp-caption alignleft" style="width: 210px"><a href="http://ihumanable.com/blog/wp-content/uploads/2009/12/american-gladiators.jpg"><img src="http://ihumanable.com/blog/wp-content/uploads/2009/12/american-gladiators.jpg" alt="impedance mismatch vs. coupling: battle to the death" title="american-gladiators" width="200" height="194" class="size-full wp-image-459" /></a><p class="wp-caption-text">impedance mismatch vs. coupling: battle to the death</p></div>
<p>So let&#8217;s just name everything the same and go home, problem solved.  Oh, if it could only be so easy, the problem is that on the other end from impedance mismatch is a devilish little troll named coupling.  Coupling is the amount that two pieces of software are intertwined, they could be tightly-coupled wherein changing one requires changing the other, or they can be loosely-coupled all the way to the point of being considered decoupled or orthogonal.  Orthogonal pieces are nice to work with because you can change one and know that you won&#8217;t have side-effects on other pieces.  Orthogonality goes by some other names: encapsulation, modularity, and decoupled, it is generally considered a Good Thing&copy; and I make no argument against it.</p>
<p>We now have these two seemingly opposing forces, we want to decrease impedance mismatch without introducing coupling, what should we do?  There are many ways to deal with this issue, let&#8217;s look at a few.</p>
<p><strong>Adapters</strong> are nice little pieces of code (also called wrappers), that allow two different things to look the same.  Let&#8217;s assume we want to write some code to manage users, users have a name, an address, and an age.  The developer of the class decides that this object can be pretty simple.</p>
<pre class="brush: php; title: ;">
class User {
  public $name;
  public $address;
  public $age;
}
</pre>
<p>The database developer decides that he loves structured data and that this should be broken out into all kinds of columns and tables.</p>
<pre class="brush: sql; title: ;">
table user (
  user_id int autoincrement primary key,
  first_name varchar,
  last_name varchar,
  addr_street varchar,
  addr_number int,
  addr_city int foreign key,
  addr_zipcode int,
  age int
)

table city (
  city_id int autoincrement primary key,
  city_name varchar,
  state_id int foreign key,
)

table state (
  state_id int autoincrement primary key,
  state_name varchar,
  state_abbrev varchar
)
</pre>
<p>We could create an adapter class that bridges the difference, for brevity&#8217;s sake I won&#8217;t include the code for it, but it would basically translate strings into database fields, as the application developer I get to imagine the database as mirroring my object, even though it doesn&#8217;t.</p>
<p><strong>ORM</strong> &#8211; ORM&#8217;s are like automatic adapters.  They are not without their faults and some implementations are better than others, but they mask the complexity of marshaling data and reduce the impedance mismatch.</p>
<p><strong>Convention over Configuration</strong> &#8211; This was made famous by Ruby on Rails.  There is some strong convention that you follow that allows for a consistent mapping between domains, an example would be that tables are always named the pluralized version of the class name.</p>
<p>There is no silver bullet to solving the problem of impedance mismatch, but a combination of the above can help limit it.  The best thing you can do is be aware of the problem, don&#8217;t introduce impedance where it is unnecessary, and never be afraid to ruthlessly refactor out impedance mismatch when you find it.  Keeping impedance mismatch low increases developer productivity, lowers the bar for bringing on new people, and makes unicorns leap out of your monitor farting rainbows.</p>
]]></content:encoded>
			<wfw:commentRss>http://ihumanable.com/blog/2009/12/21/impedance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>murdering your baby</title>
		<link>http://ihumanable.com/blog/2009/12/08/murdering-your-baby/</link>
		<comments>http://ihumanable.com/blog/2009/12/08/murdering-your-baby/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 18:52:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[philosophy]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[side project]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://ihumanable.com/blog/?p=355</guid>
		<description><![CDATA[Yesterday my friend Ian sent me a tweet about prosper @ihumanable I&#8217;d be more interested in using Prosper if it provided support for true prepared statements instead of concatenating strings. 6:29 AM Dec 7th &#8211; pian0 With that my baby was born, the baby was a version of prosper that utilized prepared statements where appropriate. [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-left: 55px">
<div id="attachment_356" class="wp-caption alignnone" style="width: 380px"><img src="http://ihumanable.com/blog/wp-content/uploads/2009/12/baby.jpg" alt="don&#039;t worry, no babies were harmed" title="baby" width="370" height="301" class="size-full wp-image-356" /><p class="wp-caption-text">don't worry, no babies were harmed</p></div>
</div>
<p>Yesterday my friend Ian sent me a tweet about <a href="http://ihumanable.com/blog/prosper">prosper</a></p>
<blockquote><p>
<a href="http://twitter.com/ihumanable">@ihumanable</a> I&#8217;d be more interested in using Prosper if it provided support for true prepared statements instead of concatenating strings.<br />
<a href="http://twitter.com/pian0/status/6431820026">6:29 AM Dec 7th</a> &#8211; <a href="http://twitter.com/pian0">pian0</a>
</p></blockquote>
<p>With that my baby was born, the baby was a version of prosper that utilized prepared statements where appropriate.  Prosper&#8217;s main functionality has been coded for a while and the bulk of the work I&#8217;ve been doing as of late has been testing, improving backend support, and adding new functionality.  The nice thing about this kind of work is that you don&#8217;t have to go mucking around in working code, you are just fixing broken stuff and adding new functionality.  The idea of adding prepared statements made me a little queasy, I had briefly looked at it when I was starting prosper but decided that they were so varied that for the first attempt I would just avoid the headache.  What&#8217;s the problem you ask, let&#8217;s take a look at this feature table real quick.</p>
<table>
<tr>
<th>Database</th>
<th>Supported by Prosper</th>
<th>Can Support Prepared Statements</th>
</tr>
<tr>
<td>dBase</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
<tr>
<td>DB++</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
<tr>
<td>FrontBase</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
<tr>
<td>filePro</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
<tr>
<td>Firebird / Interbase</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>Informix</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>IBM DB2</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>Ingres</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>MaxDB</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>Mongo</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
<tr>
<td>mSQL</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
<tr>
<td>MS-SQL</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>MySQL</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>OCI8 (Oracle)</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>Ovrimos</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>Paradox</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
<tr>
<td>PostgreSQL</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #00FF88; color: #00773F">YES</td>
</tr>
<tr>
<td>SQLite</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
<tr>
<td>Sybase</td>
<td style="background: #00FF88; color: #00773F">YES</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
<tr>
<td>Tokyo Tyrant</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
<td style="background: #FF85B6; color: #FF0000">NO</td>
</tr>
</table>
<p>As you can see the support for prepared statements varies in the <a href="http://us2.php.net/manual/en/refs.database.vendors.php">Vendor Specific Database Extensions</a> of php.  There is also the fact that prepared statement support is poorly implemented in several extensions, they can be coded around but it adds a good deal of complexity.  Despite all the reasons not to implement prepared statements, safety, speed, and correctness dictate that I should at least give it a go.</p>
<p>Yesterday and today were my go, and I met with some success.  Prepared statements are not all that difficult to implement for a given backend, throw in some question marks, call the correct bind function, and you&#8217;re off and running.  The real difficulty is the cross-platform nature of prosper.  I wanted prepared statements to be a first class citizen, I didn&#8217;t want to decrease any existing functionality, I wanted to not overly complicate the way prosper works, and because there are 11 adapters that need to be upgraded, I wanted it to be simple to add this functionality to a given adapter.</p>
<p>I worked and toiled and toiled and worked, I tried hacking something up to make the MySQL adapter work, ran into the <tt>bind_results</tt> function and screamed at it for a while.  Then I got out some paper and drew out some diagrams, thought about sample code.  Then I went to sleep.  Then I woke up and in the shower pondered the proper syntax for passing around typing information and the division of labor for transformation.  Then I hacked on it some more and wrote a quick test. Then <strong>and this is the most important part</strong> I realized I had done it absolutely backwards.</p>
<p>I had some clues that stuff wasn&#8217;t working out right, I hit a point where I would either need to embed an if statement in every function of an adapter or have a duplicate function.  I thought that with some clever coding I could shove this down into the base class, it wasn&#8217;t great but it was working.  Then I saw another red flag when I realized that the processing in the where clause was identical to the processing in the values clause, and I applied some refactoring.  This is when I realized that there was a single function that I <strong>could</strong> have modified and had the whole thing work much more elegantly.</p>
<p>That is when I had to come to the decision to murder my baby.  I had painstakingly worked out the kinks for two days, traveling far down this road, touching a bunch of code, and now I realize the best way forward is back.  The best thing I can do right now is to revert my changes to Monday morning and lose 2 days of work, and that is great!</p>
<p>It&#8217;s not the best outcome, in an ideal world I would have seen this solution before and applied it and not wasted 2 days.  The thing is that I&#8217;ve learned a great deal, I&#8217;ve come up with a much better implementation, and I&#8217;ve been reminded of an important lesson, never be afraid to throw away code.  The code I wrote is adequate, it works well enough, but it is far from optimal.  I could keep going, head down, plowing away making as many problems as I solve trying to build a house on an unsound foundation.  The point here is to pay attention to those red flags.</p>
<p>The other important point is that sometimes you have to actually try something to find the thing that <strong>will</strong> work.  You may lose some time, but even after sitting down with pencil and paper, thinking long and hard, the optimal path didn&#8217;t come to me until I walked down the wrong road.  That&#8217;s just life sometimes as a software developer, you have to learn to live with it.</p>
<p>I will continue working on prepared statements for prosper, and I hope that by 0.7 or 0.8 they will be implemented and in there.  I still question the syntax and think that I can clean it up, right now the plan is for prosper to support unnamed parameters (?), named parameters (:name), unnamed typed parameters (%i), and named typed parameters (:name%s), but all this seems like a little much.  Good thing prosper hasn&#8217;t had a 1.0 release yet <img src='http://ihumanable.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ihumanable.com/blog/2009/12/08/murdering-your-baby/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>the power of nothing</title>
		<link>http://ihumanable.com/blog/2009/11/04/the-power-of-nothing/</link>
		<comments>http://ihumanable.com/blog/2009/11/04/the-power-of-nothing/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 19:16:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[philosophy]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://ihumanable.com/blog/?p=54</guid>
		<description><![CDATA[Sometimes you get a bright idea, or you are given a difficult task, and you want to start working on it. It&#8217;s intoxicatingly easy to dream up feature upon feature for a new project, or build a giant architecture to solve a problem, all of these things look powerful. The other problem that we run [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you get a bright idea, or you are given a difficult task, and you want to start working on it.  It&#8217;s intoxicatingly easy to dream up feature upon feature for a new project, or build a giant architecture to solve a problem, all of these things look powerful. The other problem that we run into is that with software <em>anything</em> is possible with enough code, and the people that write code like to work on interesting complex problems.  This leads to conversations like this.</p>
<ul>
<li><strong>First Dev:</strong> I want this new project to seamlessly integrate with eBay, digg, and amazon</li>
<li><strong>Second Dev:</strong> Those seem arbitrary, maybe we should define some sort of data import protocol</li>
<li><strong>First Dev:</strong> Yea, then we just need a scraper piece that uses the adapter pattern to translate various websites into the standard import protocol and feed the project</li>
<li><strong>Second Dev:</strong> I&#8217;ll start defining a dtd and you can start writing up some xslt for eBay and digg and amazon as a proof-of-concept</li>
<li><strong>First Dev:</strong> Great, then we just need to get the exchange support and the poor man&#8217;s cron jobs running, to send out the periodic updates</li>
<li><strong>Second Dev:</strong> Should we integrate with Twitter?</li>
<li><strong>First Dev:</strong> I don&#8217;t see why not</li>
<li><strong>Third Dev (interrupting):</strong> Wait, what are we developing?</li>
<li><strong>First Dev:</strong> Todo list</li>
<li><strong>Third Dev:</strong> Maybe we should get it to store and delete todo list items first</li>
<li><strong>Second Dev:</strong> That&#8217;s the easy part, the multitouch integration is going to be the hard part</li>
<li><strong>Third Dev:</strong> &#8230;</li>
</ul>
<div id="attachment_57" class="wp-caption alignright" style="width: 310px"><img src="http://ihumanable.com/blog/wp-content/uploads/2009/11/6a00d8354abaaa53ef0120a5c9ae84970c-800wi-300x225.jpg" alt="nothing todo list" title="nothing todo list" width="300" height="225" class="size-medium wp-image-57" /><p class="wp-caption-text">the dream</p></div>
<p>Before we get the product to do something simple, something any moron could code up, we want to start slapping on features and bells and whistles and whizbangs.  This is all fun, because whizbangs are fun things to think about and code and its all well and good until you realize you have coded up a great feed reader, but one hell of a lousy todo list.  Focusing on <em>least viable product</em> in the beginning gives you a concrete base to start applying whizbangs, based off of real world feedback and grounded in reality.  Incrementally building up value off of an existing product is easier and makes more sense than building a giant all-in-one application that can do everything but butter your toast that no one wants to use.</p>
<p>So this leads me to the best way forward in my estimation and experience, <strong>nothing</strong>.  Nothing is incredibly powerful, tremendously liberating, and allows you to get something up and running in least viability mode or to solve a complex issue.</p>
<p>I can hear it already, what the hell are you talking about you mentally unstable person?!  Let&#8217;s look at some tools that exemplify nothing and how you can go from nothing to something quickly and incrementally, but only if you start with nothing.</p>
<p>Mock-ups. What is a mock-up, nothing really, just a fancy picture of what you want an interface to look like.  There are many great tools for making mock-ups, a new one that just hit beta is <a href="http://gomockingbird.com/">mockingbird</a>, a more seasoned veteran in this game is the excellent <a href="http://www.balsamiq.com/">Balsamiq</a>.  These shouldn&#8217;t help, we all know what a todo-list looks like, why would mocking one up help us?  Because, even though we are capable of abstract thinking it is much easier if we have a concrete model to wrap our heads around.  Like I said in <a href="http://ihumanable.com/blog/2009/10/tool-roundup/">tool roundup</a></p>
<blockquote><p>
[talking about a sweet visualization I made] &#8230;but it is a much better reference when working with this particular part of the system than looking at the database table and trying to assemble parts of it in my brain as the situation demands.
</p></blockquote>
<p>If we don&#8217;t have a concrete model we force our brains to construct one on the fly, taking us out of our work and into a conceptualization, having a concrete model frees up precious processor cycles in our brain.  A mock-up is also great because it allows us to take nothing, a simple functionless mockup, and quickly turn it into an actual interface.  What does that button do? Nothing!  What about that one? Nothing!!!  Then we can slowly but surely add functionality to our interface until we have a functional least viable product.  The way we got there was by understanding that we start with nothing and work our way gradually to something.  Sure we could have sat down at the keyboard and pounded away code for a day or two and then run the thing, but the faster we can get it on the screen and start iterating over it, the better.</p>
<p>The second way that nothing can be useful is when tackling a huge problem, lets look at the contrived feed reader problem from up above.  How in the world do we go about solving that?!  Well we employ are good friend nothing, and we build from there.  What&#8217;s would the simplest possible solution be?</p>
<pre class="brush: php; title: ;">
$feed = FeedReader::read(&amp;quot;http://www.digg.com&amp;quot;);
</pre>
<p>We can throw that in our program, now we need to deal with the FeedReader class</p>
<pre class="brush: php; title: ;">
class FeedReader {
  static function read($url) {
    return '';
  }
}
</pre>
<p>Nothing to the rescue, we just defined our super simple API, but we aren&#8217;t quite to functional yet, but we have a foothold now to iterate from.</p>
<pre class="brush: php; title: ;">
class FeedReader {
  static $readers = array('http://www.ebay.com' =&amp;gt; new EbayReader(),
    'http://www.digg.com' =&amp;gt; new DiggReader(),
    'http://www.amazon.com' =&amp;gt; new AmazonReader)); 

  static function read($url) {
    $reader = self::get_reader($url);
    if($reader) {
      return $reader-&amp;gt;process();
    }
  }

  static function get_reader($url) {
    return self::$readers[$url];
  }
}
</pre>
<p>Wow look we are almost all the way to functionality, amazing!!!  Thank you nothing (that&#8217;s what EbayReader, DiggReader, and AmazonReader do).  Now its the simple task of implementing those, which each by themselves is a somewhat complicated task and outside the scope of this blog post.</p>
<p>This sort of top down design though can be very helpful, you need to solve a problem, just pretend that you have an API that already solves it and start calling it, stub out those functions (stub is a fancy computer science term for &#8220;make it do nothing&#8221;), and watch the power of nothing first hand.  Then you fill in the blanks, allowing yourself to have more nothing functions, you successfully break up your huge monster task into simple solvable tasks.</p>
<p>When we combine the first technique with the second we can get truly awesome results, we normally call this Rapid Application Development (or the much cooler 1980&#8242;s name, RAD).  RAD can get us to something faster than almost anything, using the power of nothing.</p>
]]></content:encoded>
			<wfw:commentRss>http://ihumanable.com/blog/2009/11/04/the-power-of-nothing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

