<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Hacker Boss</title>
	
	<link>http://hackerboss.com</link>
	<description>Developing software and managing development teams.  Frequently at the same time.</description>
	<lastBuildDate>Wed, 11 Nov 2009 20:23:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/HashedBits" type="application/rss+xml" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">HashedBits</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>The Three Doors of Type Systems</title>
		<link>http://hackerboss.com/the-three-doors-of-type-systems/</link>
		<comments>http://hackerboss.com/the-three-doors-of-type-systems/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 09:00:23 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1349</guid>
		<description><![CDATA[
Every so often, I get drawn into a discussion about the merits of static typing (Java, C, C#, ML) versus dynamic typing (JavaScript, Python, Ruby, Scheme).  Many programmers seem to be firmly in one camp or the other.  But somewhere in between, there&#8217;s a third door.  Let me explain&#8230;
I hate dynamic typing.
Dynamic [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://hackerboss.com/the-three-doors-of-type-systems/" title="Permanent link to The Three Doors of Type Systems"><img class="post_image alignnone" src="http://hackerboss.com/pics/false-choice.jpg" width="425" height="282" alt="Post image for The Three Doors of Type Systems" /></a>
</p><p>Every so often, I get drawn into a discussion about the merits of static typing (Java, C, C#, ML) versus dynamic typing (JavaScript, Python, Ruby, Scheme).  Many programmers seem to be firmly in one camp or the other.  But somewhere in between, there&#8217;s a third door.  Let me explain&#8230;</p>
<p>I hate dynamic typing.</p>
<p>Dynamic typing leaves too much room to leave mistakes in your code. Stupid ones, too, the kind where you try to subtract apples from golf clubs.  And the kinds where you sort of forgot to implement the &#8220;else&#8221; part.</p>
<p>These are typical mistakes which could be proved, by the compiler, to never possibly work.  Only it&#8217;s not even trying, and it&#8217;s leaving it all up to me, a dodgy forgetful emotional interrupted tired inferior human, to stare at it long enough to assure myself that it will work correctly in all possible situations.  It won&#8217;t, of course.</p>
<p>I hate static typing.</p>
<p>Static typing makes you think about types when you want to think about your program.  Before you can run anything, the compiler insists that everything is <i>perfect</i>, but you&#8217;re only just starting to build the shape of your code.  You probably don&#8217;t know what it&#8217;s going to look like when it&#8217;s finished.  Perfect is for later.</p>
<p>I hate lack of type inference.</p>
<p>Spelling out the types for each variable and parameter and return type and field makes your programs ugly.  Most of that type information is implicitly clear to you, so it makes no sense that you have to always explicitly mention every type in the actual code.  The compiler and IDE should do some of that for you.</p>
<p>I hate type inference.</p>
<p>Full-blown type inference makes type errors insanely difficult to locate.  The compiler figures out that the types in your code aren&#8217;t adding up, but it has no idea where the error actually is.  The problem is that often you have no idea, either.</p>
<p>The point I want to make is that <strong>the choice between dynamic and static typing is a false dichotomy.</strong>  You don&#8217;t need to choose between showering and brushing your teeth.  You do both.  In the same way, you shouldn&#8217;t have to choose between static typing or dynamic typing.  You should be able to use the appropriate tools in the appropriate places at the appropriate time.  The right kind of static typing is <strong>discretionary static typing</strong>.</p>
<p>Luckily, programming languages are already moving in this direction.  Yesterday, Google published <a href="http://golang.org">a new programming language called Go</a>:</p>
<blockquote><p>
Go is an attempt to combine the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language
</p></blockquote>
<p>That sounds like just what the doctor ordered.  C# from Microsoft is also steadily gaining some type inference and dynamic typing features.  Both C# and Go are actively trying to fix some of the biggest pain points in the working programmers&#8217; lives.</p>
<p>I for one will be taking a good look of what&#8217;s behind the third door.  Will you?</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=EEaw6FmWy-8:vuB_U-2tqTk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=EEaw6FmWy-8:vuB_U-2tqTk:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=EEaw6FmWy-8:vuB_U-2tqTk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=EEaw6FmWy-8:vuB_U-2tqTk:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/EEaw6FmWy-8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/the-three-doors-of-type-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hashed Bits becomes Hacker Boss</title>
		<link>http://hackerboss.com/hashed-bits-becomes-hacker-boss/</link>
		<comments>http://hackerboss.com/hashed-bits-becomes-hacker-boss/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 07:33:30 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1342</guid>
		<description><![CDATA[I decided to change the name of this blog to something more descriptive and less &#8220;meh&#8221;.   This blog is about developing software and managing development teams.  That is, about hacking, and about being a boss.  Frequently at the same time.
It is likely that RSS subscribers will see old posts coming up [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I decided to change the name of this blog to something more descriptive and less &#8220;meh&#8221;.   This blog is about developing software and managing development teams.  That is, about hacking, and about being a boss.  Frequently at the same time.</p>
<p>It is likely that RSS subscribers will see old posts coming up as new.  I apologize for the inconvenience.</p>
<p>And now, back to our regular program.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=LuX85cGrHik:yPStr94FiMI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=LuX85cGrHik:yPStr94FiMI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=LuX85cGrHik:yPStr94FiMI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=LuX85cGrHik:yPStr94FiMI:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/LuX85cGrHik" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/hashed-bits-becomes-hacker-boss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Essence of Lambda</title>
		<link>http://hackerboss.com/the-essence-of-lambda/</link>
		<comments>http://hackerboss.com/the-essence-of-lambda/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 20:59:27 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1287</guid>
		<description><![CDATA[
When I was studying Scheme on a programming course at HUT, I remember I was a bit baffled of first-class functions.  My previous experiences were with C, Pascal, Basic, and other languges which didn&#8217;t have first-class functions.  Data is data, code is code.  You don&#8217;t go mixing those two.  Why would [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://hackerboss.com/the-essence-of-lambda/" title="Permanent link to The Essence of Lambda"><img class="post_image alignnone" src="http://hackerboss.com/pics/lambda.jpg" width="425" height="282" alt="Post image for The Essence of Lambda" /></a>
</p><p><span class="drop_cap">W</span>hen I was studying Scheme on a programming course at <a href="http://www.hut.fi/en/">HUT</a>, I remember I was a bit baffled of first-class functions.  My previous experiences were with C, Pascal, Basic, and other languges which didn&#8217;t have first-class functions.  Data is data, code is code.  You don&#8217;t go mixing those two.  Why would you want to create new functions on the fly and pass them around as values?  Crazy talk!</p>
<p>What really made me understand was the following homework exercise:</p>
<blockquote><p>
Define cons, car, and cdr without using any built-in data structures.  Hint: Use first-class functions.
</p></blockquote>
<p>As you may know, cons is a function which takes two arguments and returns a single value which contains the two argument values inside. This single value is called a pair (or sometimes a cons cell). The car and cdr functions extract the left and right parts of a pair, respectively.</p>
<p>Without further ado, here&#8217;s the solution.  I suppose most readers aren&#8217;t necessarily familiar with Scheme, so I&#8217;m including both JavaScript and Scheme code. </p>
<table class="archivetbl">
<tr>
<td>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> cons<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> a
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> b
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> car<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> p<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> cdr<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> p<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</td>
<td>

<div class="wp_syntax"><div class="code"><pre class="scheme" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> a b<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>x<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> x a b<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> p<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>p #t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> p<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>p #f<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

</td>
</tr>
</table>
<p>This really helped my understand what this lambda business is all about.  It&#8217;s more than a function without a name.  It&#8217;s less magical than generating code on the fly, which was what I first believed must be happening.  A first-class function is a way to bind together some values (a and b) together with some code operating on those values (the if).  The result is a function you can call like a regular function.</p>
<p>Sometimes, I&#8217;m a bottom-up kind of guy, so the final missing piece of understanding had to come from figuring out how lambda could be implemented by the compiler or interpreter.  Here&#8217;s how:</p>
<table class="archivetbl">
<tr>
<td>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> cons_f<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #339933;">,</span> x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> a
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> b
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> cons<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#91;</span>cons_f<span style="color: #339933;">,</span> a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> car<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> p<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> p<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> cdr<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> p<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> p<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</td>
</tr>
</table>
<p>So when the compiler encounters a function body which refers to variables outside the body, it kind of lifts the lambda into a top-level function.  Any open variables are made into new explicit parameters for the function.  The function value is basically a vector with a reference to this &#8220;normal&#8221; function, plus the values of the open variables at the time.</p>
<p>Technically this is not exactly how things happen, but hopefully you get the point.  The point being that <strong>deep down, lambda is really not that much more special than allocating a vector</strong>.</p>
<p>As for the solution itself, we can actually do a bit better. We don&#8217;t really need to use a conditional:</p>
<table class="archivetbl">
<tr>
<td>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> cons<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> f<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> car<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> p<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> a <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> cdr<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> p<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> b <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</td>
<td>

<div class="wp_syntax"><div class="code"><pre class="scheme" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> a b<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">f</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">f</span> a b<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> p<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>p <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>a b<span style="color: #66cc66;">&#41;</span> a<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> p<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>p <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>a b<span style="color: #66cc66;">&#41;</span> b<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

</td>
</tr>
</table>
<p>We can go even more basic than this.  The above code uses functions with two arguments.  Let&#8217;s make it <a href="http://en.wikipedia.org/wiki/Currying"><i>curried</i></a>, and only use functions with one argument.  It&#8217;ll change the API, though, so instead of <code>cons(a, b)</code> you call <code>cons(a)(b)</code>.</p>
<table class="archivetbl">
<tr>
<td>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> cons <span style="color: #339933;">=</span>
  <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> f<span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> 
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> car<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> p<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> a <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> cdr<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> p<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> b
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</td>
<td>

<div class="wp_syntax"><div class="code"><pre class="scheme" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #b1b100;">cons</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">f</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">f</span> a<span style="color: #66cc66;">&#41;</span> b<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> p<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>p <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&#41;</span> a<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> p<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>p <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&#41;</span> b<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

</td>
</tr>
</table>
<p>This is arguably as basic as it gets.  We&#8217;ve defined cons, car, and cdr using nothing but function definitions and function calls.</p>
<p>Hopefully this little exercise helped you as much as it helped me.  They say you don&#8217;t really know a programming language until you&#8217;ve learned to hate it with a passion.  I&#8217;d say <strong>you don&#8217;t really know a programming language until you&#8217;ve implemented a compiler for it.</strong> </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=JAJ6HkFUR3g:rKHu41Qx_pk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=JAJ6HkFUR3g:rKHu41Qx_pk:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=JAJ6HkFUR3g:rKHu41Qx_pk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=JAJ6HkFUR3g:rKHu41Qx_pk:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/JAJ6HkFUR3g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/the-essence-of-lambda/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A Developer’s Most Important Interface</title>
		<link>http://hackerboss.com/a-developers-most-important-interface/</link>
		<comments>http://hackerboss.com/a-developers-most-important-interface/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 17:45:00 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1252</guid>
		<description><![CDATA[
A long time ago, I was actively playing a MUD.  A MUD is like World of Warcraft, only on a much smaller scale, and there are no graphics.  It&#8217;s all text based. To make your character do anything, you have to type commands at the prompt.
The thing with this MUD was that fights [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://hackerboss.com/a-developers-most-important-interface/" title="Permanent link to A Developer&#8217;s Most Important Interface"><img class="post_image alignnone" src="http://hackerboss.com/pics/keyboard-love.jpg" width="283" height="424" alt="Post image for A Developer&#8217;s Most Important Interface" /></a>
</p><p><span class="drop_cap">A</span> long time ago, I was actively playing a MUD.  A MUD is like World of Warcraft, only on a much smaller scale, and there are no graphics.  It&#8217;s all text based. To make your character do anything, you have to type commands at the prompt.</p>
<p>The thing with this MUD was that fights were not strictly turn based.  If you were too slow to cast your next spell, your wizard would be standing there with a vacant look in his eyes while some troll is bashing him to bits with a morning star.  The faster you type, the faster you cast the next spell.</p>
<p>After a few hundred hours of playing, typing no longer exists as a separate activity.  It&#8217;s automatic. You think &#8220;fireball&#8221; and the words appear on screen. Technically, your fingers are still pressing keys, but for all practical purposes your mind is now directly linked with the game.</p>
<p><img class="alignright" src="http://hackerboss.com/pics/matrix-sockets.jpg" alt="" width="309" height="210" /><br />
The same kind of mind-to-machine link forms after enough practice with your programming language and IDE, or <a href="http://hackerboss.com/the-shell-is-like-a-dish-washer/">shell</a>. You don&#8217;t need a sci-fi socket on the back of the skull for that.  All you need is enough practice.</p>
<p>You also need a good keyboard.</p>
<p>A good keyboard is one which you forget is there.  A good keyboard doesn&#8217;t jam the Enter key when you press it on the upper right corner.  A good keyboard has zero packet loss from your brain to the computer.</p>
<p>My new favorite keyboard is the Apple aluminium keyboard. The tactile feedback is just right. It&#8217;s small, so there&#8217;s more room for other stuff on my desk.  It&#8217;s thin, so I don&#8217;t need a separate wrist rest at all. It looks beautiful, and is obviously the result of a great deal of design work. This keyboard even <em>sounds</em> good.</p>
<p><a href="http://www.apple.com/keyboard/"><img class="alignnone" src="http://hackerboss.com/pics/apple-keyboard.jpg" alt="" width="490" height="229" /></a></p>
<p>I would be very interested to hear what you have to say about keyboards. What is your favorite keyboard?  Give your opinion in <a href="http://hackerboss.com/a-developers-most-important-interface/#comments">the comments section</a>!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=oy27SuEf4OM:aX6fzLrTp1A:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=oy27SuEf4OM:aX6fzLrTp1A:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=oy27SuEf4OM:aX6fzLrTp1A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=oy27SuEf4OM:aX6fzLrTp1A:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/oy27SuEf4OM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/a-developers-most-important-interface/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Do You Speak Binary?</title>
		<link>http://hackerboss.com/do-you-speak-binary/</link>
		<comments>http://hackerboss.com/do-you-speak-binary/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 08:29:39 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1225</guid>
		<description><![CDATA[How well do you know the fundamental unit of information, communication, computation?
When interviewing coders, I often like to ask them to explain how they would implement a function which counts the number of bits set in an integer.  In Beautiful Code: Leading Programmers Explain How They Think, Henry S. Warren, Jr. gives a wonderful [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><span class="drop_cap">H</span>ow well do you know the fundamental unit of information, communication, computation?</p>
<p>When interviewing coders, I often like to ask them to explain how they would implement a function which counts the number of bits set in an integer.  In <a href="http://www.amazon.com/dp/0596510047?tag=hashedbits-20">Beautiful Code: Leading Programmers Explain How They Think</a>, Henry S. Warren, Jr. gives a wonderful treatment of the population count problem.  This C code implements a clever algorithm to compute number of set bits in one 32-bit word:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* Counts 1-bits in a word. */</span>
<span style="color: #993333;">int</span> pop<span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span> x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  x <span style="color: #339933;">=</span> x <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x55555555</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  x <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x33333333</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x33333333</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  x <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x0F0F0F0F</span><span style="color: #339933;">;</span>
  x <span style="color: #339933;">=</span> x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  x <span style="color: #339933;">=</span> x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">16</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> x <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x0000003F</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Can you figure out how it works?</p>
<p>For a really hard-core puzzle, try to figure out this piece of code from the Quake code.  It computes the inverse square root of a floating point number:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">float</span> InvSqrt<span style="color: #009900;">&#40;</span><span style="color: #993333;">float</span> x<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #993333;">float</span> xhalf <span style="color: #339933;">=</span> <span style="color:#800080;">0.5f</span> <span style="color: #339933;">*</span> x<span style="color: #339933;">;</span>
   <span style="color: #993333;">int</span> i <span style="color: #339933;">=</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;</span>x<span style="color: #339933;">;</span>
   i <span style="color: #339933;">=</span> <span style="color: #208080;">0x5f3759d5</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   x <span style="color: #339933;">=</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">float</span><span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;</span>i<span style="color: #339933;">;</span>
   x <span style="color: #339933;">=</span> x<span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color:#800080;">1.5f</span> <span style="color: #339933;">-</span> xhalf<span style="color: #339933;">*</span>x<span style="color: #339933;">*</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">return</span> x<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Wow.  If you need to cheat (I did), the <a href="http://www.google.com/search?q=quake+invsqrt">web is full of explanations</a>.  The one that really helped me understand was <a href="http://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/">by Kalid Azad at BetterExplained</a>.</p>
<p><strong>I firmly believe that every programmer should try to build a good working understanding of the bit world</strong>.  It&#8217;s not that you have to know that stuff to be able to write (most) programs.  But look at it this way.  That computer on your desk has a CPU in it.  That CPU is executing billions of instructions per second to execute your code.  Are you really not interested at all on what&#8217;s going on in there?  Don&#8217;t you want to know <a href="http://www.codinghorror.com/blog/archives/001266.html">why computers suck at math?</a></p>
<p><strike>If the next coder you interview has trouble answering more than a couple of the following, that should be a no hire:</strike><br />
The next time you are interviewing a coder, here are some questions you could ask to probe their understanding of the binary system:</p>
<ul>
<li>What are the first ten powers of two?</li>
<li>What is 0&#215;7F in binary? In decimal?</li>
<li>What does two&#8217;s complement mean?</li>
<li>How would you extract the 8 low-order bits from a word?</li>
<li>How would you count the number of bits in a word?</li>
<li>What arithmetic operation does shifting right by one bit correspond to?</li>
</ul>
<p>To me, <strong>total lack of understanding in this area is a big red flag</strong> and should cause a no hire.  It means that you either haven&#8217;t been programming long enough to encounter these bit-level problems, or worse, you did encounter them but gave up for one reason or another.  It&#8217;s a real confidence booster to know that you can, if need be, go all the way down to the bit level to solve a problem or understand a bug.</p>
<p>It&#8217;s all ones and zeroes, right?  The bits are your friends.  How well do you know them?</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=_ChjS2Dg0x8:OlwrkfJw0ls:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=_ChjS2Dg0x8:OlwrkfJw0ls:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=_ChjS2Dg0x8:OlwrkfJw0ls:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=_ChjS2Dg0x8:OlwrkfJw0ls:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/_ChjS2Dg0x8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/do-you-speak-binary/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>5 Favorite Excuses to Avoid Fixing Your Architecture</title>
		<link>http://hackerboss.com/5-favorite-techniques-to-avoid-fixing-your-architecture/</link>
		<comments>http://hackerboss.com/5-favorite-techniques-to-avoid-fixing-your-architecture/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 20:05:20 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1191</guid>
		<description><![CDATA[
Do you remember your last quarrel over whether the current architecture of your software is a good one?  Were you defending or attacking?
I&#8217;m sure some parts of that discussion weren&#8217;t completely rational.  Here&#8217;s a list of some of my favorite irrational arguments against fixing a broken architecture.  Maybe the list helps you [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://hackerboss.com/5-favorite-techniques-to-avoid-fixing-your-architecture/" title="Permanent link to 5 Favorite Excuses to Avoid Fixing Your Architecture"><img class="post_image alignnone" src="http://hackerboss.com/pics/denial.jpg" width="424" height="283" alt="Post image for 5 Favorite Excuses to Avoid Fixing Your Architecture" /></a>
</p><p><span class="drop_cap">D</span>o you remember your last quarrel over whether the current architecture of your software is a good one?  Were you defending or attacking?</p>
<p>I&#8217;m sure some parts of that discussion weren&#8217;t completely rational.  Here&#8217;s a list of some of my favorite irrational arguments against fixing a broken architecture.  Maybe the list helps you recognize them as irrational the next time you hear them or use them yourself.</p>
<h3>1. It&#8217;ll be fine after these fixes</h3>
<p>This one is popular among people who have never really written a lot of code, at least not of the high quality kind.  They view software quality as something than can be added later.  <strong>They think quality is something which can be poured in later, in controlled doses, carefully avoiding adding too much</strong> to avoid spending too much time on quality which is above the market expectation.</p>
<p><strong>High software quality has to be built in right from the start.</strong> You can&#8217;t pour it in afterwards.  If the design is poor, no amount of bug fixing will get you to rock solid.  If you keep fixing it long enough, you might get to &#8220;works most of the time&#8221;, but you will never reach rock solid.</p>
<h3>2. There is no problem</h3>
<p>Flat-out denying that there is any problem is a powerful trick.<strong> Deny all evidence. </strong> If there is evidence, place the blame on third parties, the operating system, the users, whatever.   If you have to, shoot the messenger.</p>
<p>The tendency to employ this technique seems to be stronger in people who have spent considerable amounts of time designing and creating the broken architecture.  You probably define yourself through the work you have done, at least to some extent.  What was the last thing you created which you are proud of? <strong> How hard would it be to admit that your creation is, in fact, a load of crap? </strong> I bet it would be easier for you to find fault somewhere else, or simply deny that there is anything wrong in the first place.</p>
<h3>3. Developers always want to rewrite everything anyway</h3>
<p>The power of this technique lies in the fact that there is a grain of truth in it.  <strong>Many developers have this built-in tendency to build new stuff instead of patching up the old stuff.</strong> For me, I think it has something to do with <a href="http://hackerboss.com/the-programming-high/">how I was introduced to programming</a>.  I fell in love with creating new impressive things, and that&#8217;s what I want to do again and again.</p>
<p><strong>However, that grain of truth is not a logical argument against fixing your architecture.</strong> If you know that the smelly guy down the hall always eats at Burger King and never at McDonalds,  you still have no information about which is the better choice for lunch.  All you know is that the smelly guy likes his whoppers.</p>
<h3>4. It was built by our best engineers</h3>
<p>The architecture was designed by your very best engineers, so it cannot possibly be a bad architecture, right?  Besides, those engineers are too important to risk making them mad.  If we can&#8217;t trust our best engineers, who can we trust?</p>
<p><strong>S</strong><strong>mart people do stupid things all the time.</strong> It&#8217;s often impossible to know beforehand how something turns out to work in real life.  The smart thing to do is to adjust, refactor, redesign, and rewrite as necessary.  It&#8217;s not very smart to keep going with the first thing that kinda worked.</p>
<h3>5. This architecture will give us benefits in the future</h3>
<p>This technique works best if you are vague.  Things such as scalability and flexibility sound good, as do promises about how the architecture can be leveraged in the future to rapidly build new and innovative applications.  Being very specific and concrete will probably reveal that the architecture is not, in fact, superior to the alternatives.</p>
<p>So, that was my list of favorite techniques to bury your head in the sand.   When was the last time you used them yourself?  What would you add to the list?</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=qM5NYAzoV7g:0ZbuB50b2YU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=qM5NYAzoV7g:0ZbuB50b2YU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=qM5NYAzoV7g:0ZbuB50b2YU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=qM5NYAzoV7g:0ZbuB50b2YU:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/qM5NYAzoV7g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/5-favorite-techniques-to-avoid-fixing-your-architecture/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Platforms Come With a Culture</title>
		<link>http://hackerboss.com/platforms-come-with-a-culture/</link>
		<comments>http://hackerboss.com/platforms-come-with-a-culture/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 19:56:05 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1159</guid>
		<description><![CDATA[
Porting software to another platform is tricky business.  Take the first version of Safari for Windows as an example.  It was not a great success, because Safari 3 on Windows did not quite fit in:
Other grumbles were more because Safari seems like a Mac-application, making it seem out of place on a Windows [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://hackerboss.com/platforms-come-with-a-culture/" title="Permanent link to Platforms Come With a Culture"><img class="post_image alignnone" src="http://hackerboss.com/pics/mismatch.jpg" width="425" height="282" alt="Post image for Platforms Come With a Culture" /></a>
</p><p><span class="drop_cap">P</span>orting software to another platform is tricky business.  Take the first version of Safari for Windows as an example.  It was not a great success, because Safari 3 on Windows <a href="http://lowendmac.com/mac2win/07/0619.html">did not quite fit in</a>:</p>
<blockquote><p>Other grumbles were more because Safari seems like a Mac-application, making it seem out of place on a Windows desktop.</p>
<p>Mac-users, firmly convinced of the superiority of the Mac platform may assume that a Mac-app running on Windows should &#8220;obviously&#8221; appear superior to Windows users. That&#8217;s not the case.</p></blockquote>
<p>Even if you were to accept that the font rendering in Safari 3 is superior to Windows standard font rendering, the <strong>difference sticks out like a sore thumb</strong>.  In Safari 4 for Windows <a href="http://www.appletell.com/apple/comment/safari-4-beta-for-windows-first-impressions/">Apple fixed most of the issues</a>:</p>
<blockquote><p>Safari now looks more like a standard Windows app.  Previous versions stuck with the iTunes/OS X brushed metal interface, which stood out for several reasons: the buttons and scroll bars were standard OS X Aqua elements, rather than standard Windows items.</p></blockquote>
<p>So, when porting to a new operating system simply getting it to run is nowhere near enough. <strong>Operating systems come with a culture</strong>, complete with their own installers, GUI style, jargon, and soft drink preferences.  <strong>Your port has to match the culture</strong>.</p>
<p>Sometimes you need to port between platforms which aren&#8217;t operating systems. You might feel the need to support two or more different RDBMS&#8217;s, for example. SQL is a standard, right?  What could go wrong?   Jim Melton, the editor of the SQL standard for 20 years, said in <a href="http://www.se-radio.net/podcast/2009-06/episode-137-sql-jim-melton">SE Radio Episode 137: SQL with Jim Melton</a>:</p>
<blockquote><p>&#8220;It&#8217;s unclear exactly what the driving factors were for most of the organizations [for standardizing SQL].  I know for some of the vendors who eventually became dominant, ones like Oracle, IBM, and Sybase, the driving motivation was the ability to have the <em>illusion</em> of portability.  Yes, I&#8217;m being honest here &#8211; so that you could sell your system to a customer and allow him to believe that there was some chance he would be able to port his programs, and that there wouldn&#8217;t be vendor lock-in.</p></blockquote>
<p>Not all standards were born alike, huh?</p>
<p>So, all this is evidence that you shouldn&#8217;t take porting lightly.  It&#8217;s easy to underestimate the cost or downplay the importance of porting the culture.  And the technical side ain&#8217;t always a walk in the park, either.</p>
<p>After the initial port, you&#8217;ll need to develop, test, support, and maintain the software on two platforms instead of just the one.  <strong>Introducing a second platform can effectively double the surface area for bugs to attach to.</strong>   Also, once you&#8217;ve opened that door, why not add a third platform?  A fourth?  <strong>Are you sure it&#8217;s going to be worth it?</strong></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=-D3YWzGC2fo:ymdEP7ztriA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=-D3YWzGC2fo:ymdEP7ztriA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=-D3YWzGC2fo:ymdEP7ztriA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=-D3YWzGC2fo:ymdEP7ztriA:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/-D3YWzGC2fo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/platforms-come-with-a-culture/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Thinking Forth: the Unsung Classic</title>
		<link>http://hackerboss.com/thinking-forth-the-unsung-classic/</link>
		<comments>http://hackerboss.com/thinking-forth-the-unsung-classic/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 20:27:36 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1139</guid>
		<description><![CDATA[
A colleague recently pointed me to the book Thinking Forth by Leo Brodie.
While it is heavily a book about Forth (the programming language), it&#8217;s even more a book about programming and problem solving in general. I don&#8217;t know Forth, and have no intention of learning it, but I found this book to be chock full [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://hackerboss.com/thinking-forth-the-unsung-classic/" title="Permanent link to Thinking Forth: the Unsung Classic"><img class="post_image alignleft" src="http://thinking-forth.sourceforge.net/cover.jpg" width="158" height="238" alt="Post image for Thinking Forth: the Unsung Classic" /></a>
</p><p><span class="drop_cap">A</span> colleague recently pointed me to the book Thinking Forth by Leo Brodie.</p>
<p>While it is heavily a book about Forth (the programming language), it&#8217;s even more a book about programming and problem solving in general. I don&#8217;t know Forth, and have no intention of learning it, but I found this book to be chock full of insight and humor which apply today just as well as they did when Thinking Forth was first published.</p>
<p>Among the fun parts are gems like this:</p>
<p><img class="alignnone" src="http://hackerboss.com/pics/universal-processor.jpg" alt="" width="399" height="516" /></p>
<p>Among the pearls of wisdom, of which there are many, you can find this:</p>
<blockquote><p>&#8220;You don&#8217;t understand a problem until you can simplify it.&#8221;</p></blockquote>
<p>And this:</p>
<blockquote><p>&#8220;Start simple. Get it running. Learn what you’re trying to do. Add complexity gradually, as needed to fit the requirements and constraints. Don’t be afraid to restart from scratch.&#8221;</p></blockquote>
<p>Today, this would probably be called some sort of an agile method.  I&#8217;m kind of thinking it&#8217;s just common sense.</p>
<p>Especially the first half of the book concentrates on universal concepts like analysis and planning, conceptual modeling, problem-solving techniques, and refactoring.  This is how Brodie describes the book himself:</p>
<blockquote><p>&#8220;We need a consistent and practical methodology for thinking about software problems. That is what I have tried to capture in this book. Thinking Forth is meant for anyone interested in writing software to solve problems. It focuses on design and implementation; deciding what you want to accomplish, designing the components of the system, and finally building the program.&#8221;</p></blockquote>
<p>If you&#8217;re old-fashioned like me, you&#8217;ll want a <a href="http://www.amazon.com/dp/0976458705?tag=hashedbits-20">dead-tree version</a>.  The book is published under the Creative Commons license, so you can download the PDFs for free from the <a href="http://thinking-forth.sourceforge.net">Thinking Forth Project</a> website.</p>
<p>Thinking Forth was first published in 1984. It was around that time when <a href="http://hackerboss.com/the-programming-high/">I wrote my first computer program</a>.  This is certainly one of the books I wish I had read sooner.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=iIOf4J-6Q4s:UDcX0RaZt_Y:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=iIOf4J-6Q4s:UDcX0RaZt_Y:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=iIOf4J-6Q4s:UDcX0RaZt_Y:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=iIOf4J-6Q4s:UDcX0RaZt_Y:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/iIOf4J-6Q4s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/thinking-forth-the-unsung-classic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Birth of the Grumpy Asshole Programmer</title>
		<link>http://hackerboss.com/the-birth-of-the-grumpy-asshole-programmer/</link>
		<comments>http://hackerboss.com/the-birth-of-the-grumpy-asshole-programmer/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 20:26:26 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1114</guid>
		<description><![CDATA[
This is a story, based on true life, on how you turn from a happy programmer into something sinister.
Stage 1: The happy creative programmer
You&#8217;re developing a new exciting product.  You&#8217;re the senior programmer in a small and talented team.  You&#8217;re responsible for a lot of the core functionalities - you get to write a lot [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://hackerboss.com/the-birth-of-the-grumpy-asshole-programmer/" title="Permanent link to The Birth of the Grumpy Asshole Programmer"><img class="post_image alignnone" src="http://hackerboss.com/pics/jekyll-hyde.jpg" width="350" height="394" alt="Post image for The Birth of the Grumpy Asshole Programmer" /></a>
</p><p><span class="drop_cap">T</span>his is a story, based on true life, on how you turn from a happy programmer into something sinister.</p>
<h3>Stage 1: The happy creative programmer</h3>
<p>You&#8217;re developing a new exciting product.  You&#8217;re the senior programmer in a small and talented team.  You&#8217;re responsible for a lot of the core functionalities <strong>- you get to write a lot of code and make a lot of the important design decisions. </strong> Things go swimmingly, and you&#8217;re having the time of your life.</p>
<h3>Stage 2: The proud father</h3>
<p>You and your team ship the first version of the product.  Despite the highly embarrassing bug in the installer, someone buys it.  You&#8217;re now spending most of your time on improvements, bug fixing, and polishing the existing features.  It&#8217;s not quite as fun as implementing all that new stuff, but still very rewarding. <strong> It&#8217;s your baby, and you want to take care of it.</strong></p>
<h3>Stage 3: The product guru</h3>
<p>You&#8217;ve ironed out the biggest kinks, and the product is selling well.  Your user base is growing, and you&#8217;re busy planning what cool features to put in the next big release.<strong> However, with the growing number of users, the support requests start rolling in. </strong> The support engineers don&#8217;t yet quite know the product, but you&#8217;re happy to help (your baby).  By now, there&#8217;s enough questions and inquiries coming your way to be a bit of a distraction, but you can still find stretches of a couple of hours or even a full afternoon here and there to work on the next version.</p>
<h3>Stage 4: The grumpy asshole programmer</h3>
<p>The next big version ships.  The customer base keeps growing still, and together with it, the volume of tricky problems grows fast.  The support staff is competent enough to take care of all the easy cases, so<strong> you&#8217;re left with the hairiest problems</strong>.  Since you&#8217;ve been so helpful in the past (your baby), many people have developed a habit of just coming to you when they encounter a problem they can&#8217;t immediately handle themselves.  You try to counter by producing documentation, and it helps a little.  Still, you spend an increasing fraction of afternoons with a <strong>queue outside your door.</strong></p>
<p>Finally, you develop a fatalistic attitude about getting anything done.  You&#8217;re still the lead developer.  How in the hell are you supposed to get anything done when there&#8217;s someone constantly bothering you about how this-or-that works, requesting help in troubleshooting customer issues, and demanding estimates on how long it would take to add this-and-that feature?  Before, you got almost no email.  Now, you&#8217;re afraid to open your email.  In fact, you avoid opening your email before lunch just so you could get something done.  In response, people begin calling your mobile and checking by your office if you don&#8217;t answer their email in 10 minutes.  <strong>You stop even trying to code, because you would be interrupted anyway.</strong></p>
<p><strong>You stop being nice to people</strong>, hoping that they would in turn stop asking you things.  It doesn&#8217;t help, since you&#8217;re the resident expert on the product.  You throw empty Pepsi cans at people coming to your door, and fantasize about throwing full ones. You hide in meeting rooms and turn off your phone.  In the evenings, you fashion tiny phallic figurines out of Blu-Tack and stick them on product managers&#8217; doors.   None of this helps much, but it kind of makes you feel better.</p>
<p>No matter what you try, you are trapped and there is no escape.  <strong>You have become the grumpy asshole programmer.</strong></p>
<p><script type="text/javascript">var dzone_url = 'http://hackerboss.com/the-birth-of-the-grumpy-asshole-programmer/';</script><br />
<script type="text/javascript">var dzone_title = '[title]';</script><br />
<script type="text/javascript">var dzone_blurb = '[description]';</script><br />
<script type="text/javascript">var dzone_style = '2';</script><br />
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script> </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=wlYd1_QLYvA:HN0jGGGXnno:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=wlYd1_QLYvA:HN0jGGGXnno:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=wlYd1_QLYvA:HN0jGGGXnno:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=wlYd1_QLYvA:HN0jGGGXnno:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/wlYd1_QLYvA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/the-birth-of-the-grumpy-asshole-programmer/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Putting Things in Perspective: What is Expensive, What is Cheap?</title>
		<link>http://hackerboss.com/putting-things-in-perspective/</link>
		<comments>http://hackerboss.com/putting-things-in-perspective/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 20:50:54 +0000</pubDate>
		<dc:creator>Ville Laurikari</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hackerboss.com/?p=1077</guid>
		<description><![CDATA[
This is a breakdown of yearly expenses for one software developer (in USD), highly irresponsibly gathered from various sources on the internet.  For illustrative purposes only, parts may be missing, your mileage will vary, batteries not included.  But, I think it&#8217;s not that far from the truth.
So, what does this picture tell me?  Lots of [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img class="alignnone" src="http://hackerboss.com/pics/perspective.png" alt="" width="362" height="408" /></p>
<p><span class="drop_cap">T</span>his is a breakdown of yearly expenses for one software developer (in USD), highly irresponsibly gathered from various sources on the internet.  For illustrative purposes only, parts may be missing, your mileage will vary, batteries not included.  But, I think it&#8217;s not <em>that</em> far from the truth.</p>
<p>So, what does this picture tell me?  Lots of things.</p>
<p>The opportunity to save on, say, office chairs is <em>extremely limited.</em></p>
<p>You really really don&#8217;t want high turnover.  Any extra salaries you have to pay <em>really hurts.</em></p>
<p>Spending an extra 20% on an extra nice office is worth it, if you get an extra 2% of productivity from your developers that way.  That&#8217;s about 9 minutes per day.</p>
<p>You want to maximize the bang for the buck you get from the big fat red blob.  If you don&#8217;t give your software developers proper tools, such as two good monitors, plenty of RAM, and a proper chair, <em>you are a raving lunatic.</em></p>
<p>What does the picture tell you?  What does it tell to your boss?  Your CFO?</p>
<p><strong>Update:</strong> The references for this data:<br />
<a href="http://www.payscale.com/research/US/Job=Software_Engineer_%2F_Developer_%2F_Programmer/Salary">PayScale &#8211; Software Developer Salary, Average Salaries</a><br />
<a href="http://web.mit.edu/e-club/hadzima/how-much-does-an-employee-cost.html">How much does an employee cost?</a><br />
<a href="http://www.bdcnetwork.com/article/CA6663828.html">IFMA workplace study: Average space per employee</a><br />
<a href="http://www.informit.com/articles/article.aspx?p=1393497">InformIT: The Cost of Managing Paper: A Great Incentive to Go Paperless!</a><br />
<a href="http://www.towersperrin.com/tp/showdctmdoc.jsp?url=Master_Brand_2/USA/News/Spotlights/2009/Jan/2009_01_15_spotlight_2009_HCCS.htm">2009 Health Care Cost Survey Reveals High-Performing Companies Gain Health Dividend</a><br />
<a href="http://www.bizrate.com/office-furniture/herman-miller-chairs-for-sale/">Herman Miller chairs prices</a> (assumed to last 10 years)<br />
Prices for monitors and RAM you can check e.g. at <a href="http://www.newegg.com">newegg</a>.   Assumed to last a year or two.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/HashedBits?a=byBerCI8LbA:fNC0QZxaORU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=byBerCI8LbA:fNC0QZxaORU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/HashedBits?a=byBerCI8LbA:fNC0QZxaORU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/HashedBits?i=byBerCI8LbA:fNC0QZxaORU:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/HashedBits/~4/byBerCI8LbA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hackerboss.com/putting-things-in-perspective/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 3.941 seconds. --><!-- Cached page generated by WP-Super-Cache on 2009-11-11 23:24:43 --><!-- Compression = gzip -->
