<?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>The Code Dump &#187; tips</title>
	<atom:link href="http://www.codelord.net/tag/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codelord.net</link>
	<description>A place a coder rants at...</description>
	<lastBuildDate>Fri, 27 Aug 2010 17:14:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Avoid the perils of coder customers</title>
		<link>http://www.codelord.net/2010/02/20/avoid-the-perils-of-coder-customers/</link>
		<comments>http://www.codelord.net/2010/02/20/avoid-the-perils-of-coder-customers/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 19:44:29 +0000</pubDate>
		<dc:creator>abyx</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=132</guid>
		<description><![CDATA[﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿Coders are the worst customers ever. The sooner you wrap your head around that, the better. Actually, any customer that&#8217;s technical is a bad customer, but nothing trumps coders. That fact is not intuitive, or at least wasn&#8217;t for me, but it can be really painful to find it out by yourself. So here, I [...]]]></description>
			<content:encoded><![CDATA[<p>﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿Coders are the worst customers ever. The sooner you wrap your head around that, the better. Actually, any customer that&#8217;s technical is a bad customer, but nothing trumps coders. That fact is not intuitive, or at least wasn&#8217;t for me, but it can be really painful to find it out by yourself. So here, I just saved you some agony.</p>
<p>Why are coders bad customers? First, let me say that even though coder-customers are a hard group to work with, they usually have really interesting problems to solve. After all, if it was simple they&#8217;d usually do it themselves. But, being coders, they think it&#8217;s acceptable to tell you how to do your job.</p>
<p>When you work with coders, the usual ticket/email/water-cooler chat will be of the form &#8220;you need to add an option for specifying X of type Y instead of the current options&#8221;. At this point they&#8217;ll usually start telling you how to implement that and how easy it is. If you&#8217;re like me, at this point your instinct will be to crank out the code and make your customer happy. Resist that urge like the plague!</p>
<p>Whenever I receive such a ticket, I dismiss everything in it. What I do next is come up to whoever suggested it, and ask &#8220;<strong>What is it that you&#8217;re trying to do?</strong>&#8221; Usually, this will result in exactly the same technical do-this-and-that explanation. Take a deep breath and ask the question again. This will usually be enough, but sometimes may require a couple more tries. That&#8217;s how you&#8217;re supposed to gather requirements &#8211; <strong>understand the problem at hand</strong>.</p>
<p>The main advantage of being a pain-in-the-ass and making sure you understand what it is you&#8217;re supposed to implement is because every coder should know exactly what his code is doing. A lot has been said about understanding the domain you&#8217;re working in, and simply implementing things handed to you is not the way to become knowledgeable in your domain.</p>
<p>Furthermore, once you hear what people are trying to do you might think of a better way of doing it, you being fully immersed in the existing code. Actually, more often than not you&#8217;ll see it&#8217;s actually already possible to do it! And best of all, you might simply decide that&#8217;s not a fair use of your code, and reject the ticket. How could you have made such a decision without knowing the actual problem you were asked to solve? No way.</p>
<p>Saying &#8220;no&#8221; to features is one of the most important design skills to master, and a tricky one. After all, turning to your keyboard, hacking the code and saying &#8220;presto!&#8221; is more fun at first. But that way of working leads to a code-base that you don&#8217;t really know. I&#8217;ve seen systems that were driven this way by technical users. 3 years later, there were rogue database fields that no one knew why there were being updated, and weird log files in awkward formats. Whenever someone tried removing one of those he found out it broke some dusty cron-job that seemed to use it instead of doing something sane (and do I really need to mention the code was a tangled, convoluted mess?).</p>
<p>Ask why, mindfully consider and then decide. There&#8217;s no really other way, unless you&#8217;d like to meet Code Cthulhu.</p>
<p>You should follow me on <a href="http://bit.ly/aU2CaB">twitter</a>.
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F02%2F20%2Favoid-the-perils-of-coder-customers%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F02%2F20%2Favoid-the-perils-of-coder-customers%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2010/02/20/avoid-the-perils-of-coder-customers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Stop Coding in the Middle Ages</title>
		<link>http://www.codelord.net/2010/02/16/stop-coding-in-the-middle-ages/</link>
		<comments>http://www.codelord.net/2010/02/16/stop-coding-in-the-middle-ages/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 06:41:35 +0000</pubDate>
		<dc:creator>abyx</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=126</guid>
		<description><![CDATA[Aren&#8217;t you sick of wasting your time, your team&#8217;s time and precious build cycles for finding the stupidest mistakes ever? I know I&#8217;m far more interested in solving the real problems at hand than chasing stupid syntax errors. And even if you don&#8217;t mind, you really shouldn&#8217;t let your teammates substitute for a decent tool. [...]]]></description>
			<content:encoded><![CDATA[<p>Aren&#8217;t you sick of wasting your time, your team&#8217;s time and precious build cycles for finding the stupidest mistakes ever? I know I&#8217;m far more interested in solving the real problems at hand than chasing stupid syntax errors. And even if you don&#8217;t mind, you really shouldn&#8217;t let your teammates substitute for a decent tool.</p>
<p>Up until 15 years ago, I think it was very common for people to hack away at code for a good length of time, and once they got enough done, they&#8217;d try and compile the damn thing and start correcting the syntax errors, import things they forgot to, etc. This probably was because 15 years ago is the middle ages in computer-land, and compiling constantly was something people couldn&#8217;t even dream about on the little PCs we used to code on.</p>
<p>Nowadays, you can&#8217;t find more than a handful of static-language coders that won&#8217;t use a full featured IDE. C, Java, C# &#8211; other than a few freaky kernel hackers, I doubt anyone does real development outside an IDE in those languages. Today&#8217;s IDEs will tell you that you made a mistake about 2 seconds before you did. I never stop being amazed at how smart Eclipse is &#8211; and the first time I had to whip up some Java code in Vim, I felt handicapped.</p>
<p>What I find puzzling, is that people that are using the best available languages today, have suddenly decided that using the proper tool isn&#8217;t that important. Dynamic languages like Python and Ruby are not as easy to write awesome IDEs for, and therefore there aren&#8217;t many around that are mature enough, which is why it&#8217;s very common to see people use Emacs/Vim for coding them. Now don&#8217;t get me wrong, I&#8217;ve tried a few Python IDEs, but I&#8217;m still sticking with my Emacs. But when you use dynamic languages, you have to keep in mind you are even more prone of errors that will slip by. Even if you TDD, and your test coverage is extremely high, a typo might still get past your tests. Do you really want a production failure because you forgot to import an exception? (And do you really want to <a href="http://bit.ly/cKRZAK">upset Agnes</a>?)</p>
<p>About 2 weeks into my decision to stick with Emacs I started searching for simple tools that will protect me from my stupidity. It takes 10 minutes to find and install flymake with pyflakes (Python tool) support. Presto! No more typos in variable names, no more useless imports lying around. What surprised me is that a lot of my teammates, which I have respect for and are good programmers, did not use any of these. Time and time again our continuous integration system will report an error on a file and once I opened the file Emacs would show me the bad line marked with red, with no way of not noticing it.</p>
<p>I don&#8217;t like wasting my time, and I&#8217;m sure you don&#8217;t either. Stop being lazy (in the bad way). Stop making me angry. Get out of the middle ages. Yesterday we got everyone on my team to add pyflakes to their vim. Took 3 minutes to install. The problem is that it took more time to get them to install. &#8220;Nah, Vim already highlights syntax, there&#8217;s no need for more&#8221;. Oh really? After 10 minutes of searching I found a file that pyflakes showed a real problem in, and another, and another. &#8220;Hmmm, where do I download that plugin?&#8221; Win!</p>
<p>Do yourself, your team and your build slaves a favor, and start using some modern tools. I promise it will be worth it, money-back-guarantee. And remember, if your team is still churning butter, <a href="http://www.codelord.net/2009/04/04/sometimes-all-it-takes-is-a-little-push/">sometimes all it takes is a little push</a> (and sometimes you can plant bugs in their files).</p>
<p>You should follow me on <a href="http://bit.ly/aU2CaB">twitter</a>.
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F02%2F16%2Fstop-coding-in-the-middle-ages%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F02%2F16%2Fstop-coding-in-the-middle-ages%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2010/02/16/stop-coding-in-the-middle-ages/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Less Code is More</title>
		<link>http://www.codelord.net/2010/02/13/less-is-more/</link>
		<comments>http://www.codelord.net/2010/02/13/less-is-more/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 21:42:02 +0000</pubDate>
		<dc:creator>abyx</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=118</guid>
		<description><![CDATA[As coders, we should always strive to get as much feedback as soon as possible. Agile tells us we should get frequent feedback from our customers in order to make sure we&#8217;re always on track. Unit testing and the green-bar loving are all about knowing exactly when your code breaks and when you&#8217;re safe. A [...]]]></description>
			<content:encoded><![CDATA[<p>As coders, we should always strive to get as much feedback as soon as possible. Agile tells us we should get frequent feedback from our customers in order to make sure we&#8217;re always on track. Unit testing and the green-bar loving are all about knowing exactly when your code breaks and when you&#8217;re safe.</p>
<p>A kind of activity for which feedback is harder to get is our design. A big part of TDD is refactoring frequently. Refactoring often allows us to smooth out the design continuously as we work. The problem is, how can you tell you&#8217;ve done something good? On the one hand, creating abstractions is something good programmers do. On the other hand, taking that too far will usually cause more problems.</p>
<p>When making bigger changes, the best feedback will be from getting another pair of eyeballs go over the change. Pairing is the best way for getting a second opinion. Code reviews can be effective too. Problem is, a lot of people don&#8217;t get to pair or review most of their code (and yeah, I know that <a href="http://bit.ly/aSClmK">makes Corey Haines a sad panda</a>).</p>
<p>When I work by myself about the bigger things, there&#8217;s a handful of things I try to keep in mind, like the <a href="http://bit.ly/bs003B">SOLID principles</a>. But, the measure I like the most of how much shorter am I making the code. I&#8217;m not talking about obfuscating code. Readability is a must. I&#8217;m talking about abstractions that are really useful right now &#8211; they already make the code base smaller. Refactorings that make the code <a href="http://bit.ly/dizkHM">DRY</a> and thus shorter.</p>
<p><a href="http://www.codelord.net/wp-content/uploads/2010/02/67396-delete-key.jpg"><img class="aligncenter size-thumbnail wp-image-123" src="http://www.codelord.net/wp-content/uploads/2010/02/67396-delete-key-150x150.jpg" alt="delete key" width="150" height="150" /></a></p>
<p>Whenever I commit and git tells me I deleted more code than I inserted I get this fuzzy warm feeling. One of the <a href="http://bit.ly/cPw2Nr">agile manifesto principles</a> says &#8220;Simplicity &#8211; the art of maximizing the amount of work not done &#8211; is essential&#8221;. Problem is I&#8217;m not a perfect coder, and because of that I often perform more work than necessary. But I try to simplify my code when I notice this.</p>
<p>Paul Graham has an <a href="http://bit.ly/ae8RfK">essay</a> where he once showed a way for him to know he&#8217;s making good progress with Arc, the language he created. He kept track of the number of lines it took him to implement an application (Hacker News) and whenever he made some changes he checked to see if they made the application simpler.</p>
<p>Of course, as any rule, this one has exceptions. Eventually, you will need to add code! But, it always helps me see that what I thought was really good just adds clutter. Try and take a look at the output of <font style='color:#000000;background:#ffffff;'>git log <span style='color:#808030; '>-</span><span style='color:#808030; '>-</span>shortstat</font> &#8211; do you tend to add more lines whenever you clean up?</p>
<p>You should follow me on <a href="http://bit.ly/aU2CaB">twitter</a>!
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F02%2F13%2Fless-is-more%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F02%2F13%2Fless-is-more%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2010/02/13/less-is-more/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
