<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-34108582</atom:id><lastBuildDate>Fri, 17 Nov 2006 15:17:16 +0000</lastBuildDate><title>Software development cogitations</title><description></description><link>http://www.softwareunity.com/blog/default.htm</link><managingEditor>George</managingEditor><generator>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34108582.post-7389908462596462753</guid><pubDate>Wed, 15 Nov 2006 13:25:00 +0000</pubDate><atom:updated>2006-11-15T20:44:18.470Z</atom:updated><category domain='http://www.blogger.com/atom/ns#'>web</category><category domain='http://www.blogger.com/atom/ns#'>well written code</category><category domain='http://www.blogger.com/atom/ns#'>best practice</category><category domain='http://www.blogger.com/atom/ns#'>development</category><category domain='http://www.blogger.com/atom/ns#'>build</category><category domain='http://www.blogger.com/atom/ns#'>software</category><title>Tssh.. which cowboy put that in?!</title><description>&lt;div align="left"&gt;&lt;strong&gt;Sloppy code costs the Customer more...&lt;/strong&gt; Customers don't really give a monkey's how speedy your algorithm is or how cunning your quirk-workaround is. They see their application doing its stuff and that is pretty much all that needs to matter from where they're standing. Quite right too, they're experts at what they do so why should they care about how fab your code is anyway. They shouldn't have to really, but sloppy code will cost them more down the line when they get the next guy to tinker with the code. &lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;Every software developer has, at some time or another, had to take on someone else's old code to fix bugs or add features etc. We'll take one look at it, rub our chin and suck air through our teeth, like some plumber that has just emerged from inpecting pipes under the sink.&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;Understanding old code can be a painful and time consuming process. Plenty of programmers out there will have thoughts along the lines of "&lt;em&gt;Other peoples'&lt;/em&gt; old code just isn't a patch on the beautifully crafted masterpieces that &lt;em&gt;I&lt;/em&gt; produce, surely anyone can see that?" Well er, no, too many programmers are as guilty as the next at producing sloppy code. Sure it might work ok, but some day another poor sucker has to work out what the heck you've done.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;Well written software code is not just about churning out code that works. Surely us programmers have a responsibility to think about who else is going to read our masterpiece? Our code must make no secret of what it is up to and why, so that it is easy to follow and supportable.&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;strong&gt;&lt;em&gt;Ooh, you mean you want more comments?&lt;/em&gt;&lt;/strong&gt; Definately not. Light commenting is ok, but if you find yourself explaining your every move then you probably need to think of a better way to write your code. "Self-documenting code" is not about the number of comments you jam in there but about making your code self describing.&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;Some simple examples please...&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div align="left"&gt;Why use a variable called &lt;em&gt;j&lt;/em&gt; when you could call it &lt;em&gt;customerID&lt;/em&gt;. All of a sudden we know what you're on about.&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="left"&gt;Building a cryptic multi-command expression might make you feel like a programming god but splitting it into a few different lines with some choice variable names etc could stop the next guy from cursing your very existence.&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="left"&gt;Can your fantastic algorithm be moved to a separate function with a nice chummy name and expanded onto a few more lines of code?&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p align="left"&gt;There will always be some cryptic bits that we can't improve, things like Regular Expressions for instance are good candidates for a comment or two.&lt;/p&gt;&lt;p align="left"&gt;When we think about how someone else will view our code it changes everything. Well written code is a joy to read and maintain because it really is self-describing.&lt;/p&gt;&lt;p align="left"&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;/p&gt;</description><link>http://www.softwareunity.com/blog/2006/11/tssh-which-cowboy-put-that-in.html</link><author>George</author></item></channel></rss>