<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom">

 <title>mheroin</title>
 
 <link href="http://mheroin.com/" />
 <updated>2012-02-17T13:07:18-08:00</updated>
 <id>http://mheroin.com/</id>
 <author>
   <name>Federico Builes</name>
   <email>federico@mheroin.com</email>
 </author>

 
 <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/mheroin" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="mheroin" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
   <title>The Unavoidable Hack</title>
   <link href="http://mheroin.com/blog/blog/the-unavoidable-hack/" />
   <updated>2012-01-21T00:00:00-08:00</updated>
   <id>http://mheroin.com.com/blog/the-unavoidable-hack</id>
   <content type="html">&lt;p&gt;I start working on a new project. I spend the first couple of days thinking about how
everything&amp;rsquo;s going to work. I draw an architecture of sorts &lt;a href="#footnotes" class="footnote"&gt;[1]&lt;/a&gt; and I get to coding the most problematic
stories. During the initial of weeks I feel like I&amp;rsquo;m progressing a lot and I&amp;rsquo;m quite
happy with how everything&amp;rsquo;s turning out. I skip some tests because the methods I&amp;rsquo;m writing are
so self contained and trivial that everything feels obvious. There are no edge cases in my code and
to an outsider, this piece of fine work I wrote resembles art. Everything is where you&amp;rsquo;d expect it
to be and you can start hacking right away on any class without spending too much wondering what&amp;rsquo;s
going on.&lt;/p&gt;

&lt;p&gt;At the end of the first month I start noticing that some of the code I&amp;rsquo;m writing can be
refactored into something more elegant. Most of the times I&amp;rsquo;ll just stop developing new features
and I&amp;rsquo;ll change the code that&amp;rsquo;s not up to my standards. It usually doesn&amp;rsquo;t feel
perfect but I think it&amp;rsquo;s &lt;em&gt;above good&lt;/em&gt;. Any serious programmer could read this and think &amp;ldquo;Hey, this
is pretty nice&amp;rdquo;, and so I keep working, writing new features and refactoring on my free time.&lt;/p&gt;

&lt;p&gt;By the end of the second month I notice that things have gotten a lot more complicated. Features that at first would&amp;rsquo;ve taken 20 minutes are now taking me an hour to
write. In the process of growing the software I feel that something&amp;rsquo;s broken, I fucked it
somewhere and now I&amp;rsquo;m paying for it every time I have to write new code. Edge cases are creeping
into every feature and the nice 2-line methods I initially had are now 8 or 10
lines, testing for weird input and breaking &lt;a href="http://en.wikipedia.org/wiki/Law_of_Demeter"&gt;Demeter&lt;/a&gt; in every imaginable way.&lt;/p&gt;

&lt;p&gt;Don&amp;rsquo;t get me wrong, the code&amp;rsquo;s still &lt;em&gt;production-ready&lt;/em&gt; and I don&amp;rsquo;t feel too bad about it. It&amp;rsquo;s code
that I can show to any other programmer and not be ashamed, but I&amp;rsquo;m convinced that at some point
either my system out-grew its &amp;ldquo;architecture&amp;rdquo; or my motivations are just not as sharp as they were
in the beginning.&lt;/p&gt;

&lt;p&gt;An interesting point to note here is that this breaking point, what I call &amp;ldquo;The Unavoidable Hack&amp;rdquo;,
is getting delayed more and more every time I write new software. I&amp;rsquo;ve worked profesionally as a
developer for the last 7 years and if I take a look at what I wrote at the beginning, the
unavoidable hack would come up during the first day of coding.&lt;/p&gt;

&lt;p&gt;Still, every single project I&amp;rsquo;ve worked on in the past has gone through this threshold, a point of no
return where I just say &amp;ldquo;Fuck it, it can&amp;rsquo;t be perfect if I ever want to finish it&amp;rdquo;. I initially
thought that this was related to time constraints, but after having worked on &lt;a href="https://github.com/febuiles/"&gt;a lot&lt;/a&gt; of personal
open source projects, I&amp;rsquo;ve realized that I eventually hit the same problem even if I don&amp;rsquo;t have any kind of
timeline imposed on myself.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve also noticed that none of the big projects that I admire are resilient to this problem. The
Rails codebase, inspected daily by hundreds or thousands of developers, still has some really dark
corners that after many years still don&amp;rsquo;t make sense to me. The &lt;a href="https://github.com/ryanb/railscasts/blob/master/app/controllers/comments_controller.rb"&gt;code for Railscasts&lt;/a&gt;,
written by someone I deeply admire, has some code that could&amp;rsquo;ve been written in a clearer way a long
time ago. It looks like not even my programming heroes can overcome this problem.&lt;/p&gt;

&lt;p&gt;After thinking about this I started wondering: is it possible to write excellent code for a
non-trivial piece of software? I use the word excellent instead of perfect because I don&amp;rsquo;t think
there&amp;rsquo;s such thing as &amp;ldquo;the perfect code&amp;rdquo;.&lt;/p&gt;

&lt;p&gt;Maybe the last question is unfair, and instead I should be asking myself: Is it worth it to spend
so much time on details that on the long run might not be so important? I&amp;rsquo;m not talking about
writing crappy, unmantenainble code that no one can read. I&amp;rsquo;m talking about code that serves it
purpose even if it can be rewritten in a clearer way.&lt;/p&gt;

&lt;p&gt;People comes up with excuses for why they do this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I&amp;rsquo;m a startup and I&amp;rsquo;m trying to build a huge product, if my code&amp;rsquo;s not great I can always fix it
later, when I have real users and it becomes a problem.&lt;/li&gt;
&lt;li&gt;I&amp;rsquo;m a big enterprise company and I have to connect to some crappy old systems, wether I like it or
not this will be filled with edge cases and I have to work around them.&lt;/li&gt;
&lt;li&gt;I&amp;rsquo;m a consultancy and I get paid for writing new features, not by making a piece of code that I
can showcase in a museum.&lt;/li&gt;
&lt;li&gt;I&amp;rsquo;m just a guy trying to write a tool to make my life easier, I&amp;rsquo;m not here to achieve glory.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Some of those reasons are pefectly valid, but I still have
a voice somwhere in my head telling me that it didn&amp;rsquo;t have to be this way.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m interested then in finding out if there&amp;rsquo;s such thing as an excellent code base for non-trivial
stuff. I want to know if that voice in the back of my brain even matters. I wonder if this is just
the nature of software. I question my assumptions about architectures &lt;a href="#footnotes" class="footnote"&gt;[1]&lt;/a&gt;. I want to believe that if I
write more software the event of the unavoidable hack will be deferred to a point so far in
the future that it won&amp;rsquo;t matter. Are the Kent Becks, Russ Coxes and Uncle Bobs of the
world writing systems that don&amp;rsquo;t suffer from these problems? Is this even a problem?&lt;/p&gt;

&lt;p&gt;&lt;a class="footnotes" name="footnotes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="footnotes"&gt;
&lt;a class="footnote"&gt;[1]&lt;/a&gt; I don't believe in software architects. I don't believe in people spending 3 months
writing a specification of how everything should be implemented. When I talk about architecture I'm
usually referring to the act of picking the hardest problems of the system and then thinking of how to
solve them in the context of this program, leaving a note, a drawing or even tests for future
reference.
&lt;/div&gt;


&lt;p&gt;You can discuss this article at &lt;a href="http://news.ycombinator.com/item?id=3497512"&gt;Hacker News&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Can I tell you about my projects?</title>
   <link href="http://mheroin.com/blog/blog/can-i-tell-you-about-my-projects/" />
   <updated>2012-01-05T00:00:00-08:00</updated>
   <id>http://mheroin.com.com/blog/can-i-tell-you-about-my-projects</id>
   <content type="html">&lt;p&gt;A lot has happened during the last couple of months. I quit my job at
&lt;a href="http://stackbuilders.com"&gt;StackBuilders&lt;/a&gt;, got a YC interview (and blew it) and after a lot of
meditation, I finally decided what I want to do with my life.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve had a lot of free time so I&amp;rsquo;ve been pumping out code like a &lt;a href="http://calendaraboutnothing.com/~febuiles"&gt;mad
scientist&lt;/a&gt;. I want to share some of the useful stuff I&amp;rsquo;ve built.&lt;/p&gt;

&lt;h2&gt;EventualTweet&lt;/h2&gt;

&lt;p&gt;I like to schedule tweets for the future. A lot. I use &lt;a href="http://eventualtweet.com"&gt;EventualTweet&lt;/a&gt; almost daily to send
messages to other people, schedule link sharing-posts or just to &lt;a href="https://twitter.com/#!/febuiles/status/153718900977184770"&gt;remind myself&lt;/a&gt; to do stuff later in
the day.&lt;/p&gt;

&lt;h2&gt;makeitpersonal&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://makeitpersonal.co"&gt;makeitpersonal&lt;/a&gt; started as a service for a friend to share his Last.FM playlists with the
rest of his friends. If you go to that page right now you can enter your username and get a nicely
formatted list back that you can send to other people. Here&amp;rsquo;s &lt;a href="http://makeitpersonal.co/4f06240bc5fbf50001000003"&gt;what I&amp;rsquo;ve
listened&lt;/a&gt; to while writing this post.&lt;/p&gt;

&lt;p&gt;Something that I haven&amp;rsquo;t publicized about this project yet is that you can query a service for
fetching lyrics. A &lt;code&gt;GET&lt;/code&gt; request to http://makeitpersonal.com/lyrics with the &lt;code&gt;artist&lt;/code&gt; and &lt;code&gt;title&lt;/code&gt;
params will give you the song lyrics. You can use it like this:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code class="bash"&gt;curl &lt;span class="s2"&gt;&amp;quot;makeitpersonal.co/lyrics?artist=Placebo&amp;amp;title=Days%20before%20you%20came&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;I also published a Gist with instructions for fetching lyrics in Unix that uses this service: &lt;a href="https://gist.github.com/1549991"&gt;https://gist.github.com/1549991&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Right now I&amp;rsquo;m working on a feature to share annotated song lyrics with other people. It currently
looks &lt;a href="http://cl.ly/2J2g2r3Y1O2A400g1g3X"&gt;like this&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;mdify&lt;/h2&gt;

&lt;p&gt;This is probably my favorite personal tool right now. It&amp;rsquo;s a simple command line utility to preview
Markdown pages. I&amp;rsquo;m using it to preview this blog post, the gist I linked previously and even some
of the emails I send. Using it inside Emacs is &lt;span class="pink"&gt;&lt;3 &lt;3 &lt;3&lt;/span&gt;. You can read more
about it at &lt;a href="https://github.com/febuiles/mdify"&gt;https://github.com/febuiles/mdify&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;All of these projects are open source, you can find the code at my &lt;a href="http://github.com/febuiles"&gt;Github&lt;/a&gt; account. Let me know
if you find them useful.&lt;/p&gt;
</content>
 </entry>
 

</feed>

