<?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-5928382587048606920</atom:id><lastBuildDate>Sat, 28 Jun 2008 13:49:21 +0000</lastBuildDate><title>Pete Bevin: Live From the Software Factory</title><description/><link>http://www.uptimesoftware.com/blog/pete-bevin/</link><managingEditor>noreply@blogger.com (Uptime WebDev)</managingEditor><generator>Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-810874754960678079</guid><pubDate>Sat, 28 Jun 2008 13:14:00 +0000</pubDate><atom:updated>2008-06-28T06:49:21.307-07:00</atom:updated><title>Santizing HTML with regular expressions</title><description>&lt;a href="http://www.codinghorror.com/blog/archives/001016.html"&gt;Jeff Atwood argues for the sanity of this regular expression&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;code&gt;var whitelist =&lt;br /&gt;
@"&amp;lt;/?p&amp;gt;|&amp;lt;br\s?/?&amp;gt;|&amp;lt;/?b&amp;gt;|&amp;lt;/?strong&amp;gt;|&amp;lt;/?i&amp;gt;|&amp;lt;/?em&amp;gt;|&lt;br /&gt;
&amp;lt;/?s&amp;gt;|&amp;lt;/?strike&amp;gt;|&amp;lt;/?blockquote&amp;gt;|&amp;lt;/?sub&amp;gt;|&amp;lt;/?super&amp;gt;|&lt;br /&gt;
&amp;lt;/?h(1|2|3)&amp;gt;|&amp;lt;/?pre&amp;gt;|&amp;lt;hr\s?/?&amp;gt;|&amp;lt;/?code&amp;gt;|&amp;lt;/?ul&amp;gt;|&lt;br /&gt;
&amp;lt;/?ol&amp;gt;|&amp;lt;/?li&amp;gt;|&amp;lt;/a&amp;gt;|&amp;lt;a[^&amp;gt;]+&amp;gt;|&amp;lt;img[^&amp;gt;]+/?&amp;gt;";&lt;br /&gt;
&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
This is perfectly good "dumb code"; as long as there are unit tests for the containing method that make it clear what the intent is, I'd accept this as production code. It's unlikely that the list of allowable tags will change much over time, so maintenance of the regex isn't really an issue.&lt;br /&gt;
&lt;br /&gt;
That said, if the whitelist is expected to change, I'd point out that the regexp has a strong smell of code duplication: nearly all the tags listed have the same form: &lt;!--?tag--&gt;&lt;!--?tag--&gt;.  I'd probably start with an array of allowable tags, and construct the regexp from those:&lt;br /&gt;
&lt;blockquote&gt;&lt;code&gt;String constructRegex() {&lt;br /&gt;
String[] containers = { "p", "b", "strong", "i", "em", "s", "strike", "blockquote", "sub", "super", "h1", "h2", "h3", "pre", "code", "ul", "ol", "li" };&lt;br /&gt;
String[] emptyTags = { "br", "hr" };&lt;br /&gt;
&lt;br /&gt;
List&lt;string&gt; components = new ArrayList&lt;string&gt;();&lt;br /&gt;
for (String tag : containers) {&lt;br /&gt;
 components.add("&amp;lt;/?" + tag + "&amp;gt;");&lt;br /&gt;
}&lt;br /&gt;
for (String tag : emptyTags) {&lt;br /&gt;
 components.add("&amp;lt;" + tag + "\\s?/?&amp;gt;");&lt;br /&gt;
}&lt;br /&gt;
components.add("&amp;lt;/a&amp;gt;");&lt;br /&gt;
components.add("&amp;lt;a[^&amp;gt;]+&amp;gt;");&lt;br /&gt;
components.add("&amp;lt;img[^&amp;gt;]+/?&amp;gt;");&lt;br /&gt;
&lt;br /&gt;
return StringUtils.join("|", components);&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
The advantage of this is that is says things &lt;a href="http://c2.com/xp/OnceAndOnlyOnce.html"&gt;Once And Only Once&lt;/a&gt;.  The disadvantage is that it's a bit less readable for people who are already fluent in regular expression syntax.&lt;br /&gt;
&lt;br /&gt;
Where does this all leave us?  That there isn't a single right answer.  A lot of decisions in programming come down to taste, and knowing your audience.&lt;br /&gt;
&lt;br /&gt;
I'll be saying more about this in a future post, especially as it relates to unit testing.</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/06/santizing-html-with-regular-expressions.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-4033622473924589347</guid><pubDate>Thu, 26 Jun 2008 16:13:00 +0000</pubDate><atom:updated>2008-06-26T09:13:46.371-07:00</atom:updated><title>Not ready for Agile</title><description>&lt;a href="http://blog.toolshed.com/2008/06/stage-0-not-rea.html"&gt;Some companies just aren't ready for Agile&lt;/a&gt;.</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/06/not-ready-for-agile.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-7958340100786737841</guid><pubDate>Mon, 23 Jun 2008 14:21:00 +0000</pubDate><atom:updated>2008-06-23T07:23:01.473-07:00</atom:updated><title>How to get better at programming</title><description>A great article from Jeff Atwood called &lt;a href="http://www.codinghorror.com/blog/archives/001138.html"&gt;The Ultimate Code Kata&lt;/a&gt;.  If you're at all interested in getting better at programming (rather than getting better at Java/C++/PHP/whatever), read and act.</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/06/how-to-get-better-at-programming.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-2767392930804654190</guid><pubDate>Fri, 23 May 2008 19:55:00 +0000</pubDate><atom:updated>2008-05-23T13:41:04.163-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>programming</category><category domain='http://www.blogger.com/atom/ns#'>personal development</category><title>Learning C is important, but you can still get a job without it</title><description>In the &lt;a href="http://blog.stackoverflow.com/index.php/2008/04/podcast-2/"&gt;second Stackoverflow podcast&lt;/a&gt;, &lt;a href="http://www.joelonsoftware.com/"&gt;Joel Spolsky&lt;/a&gt; argues that all developers should know C, and &lt;a href="http://www.codinghorror.com/"&gt;Jeff Atwood&lt;/a&gt; disagrees.  Bloggers are up in arms; most of them &lt;a href="http://blog.darrenstokes.com/2008/05/22/do-you-really-need-to-know-c-i-think-so/"&gt;agree with Joel&lt;/a&gt;, and &lt;a href="http://girtby.net/archives/2008/5/22/blogging-horror"&gt;Alastair Rankine&lt;/a&gt; even uses it to argue that Jeff has &lt;a href="http://www.jumptheshark.com/"&gt;jumped the shark&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Here's my take: No, Virginia, you don't have to know C to be a professional programmer, but it definitely helps.  You don't have to know Ruby, Java, Prolog, C# or Lisp either, but they will all teach you things that you can apply to whatever you happen to be doing for your day job.&lt;br /&gt;
&lt;br /&gt;
Here's a random list of things a well rounded programmer should be comfortable with:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Macros (C- and Lisp-style) and their pros and cons.&lt;/li&gt;&lt;li&gt;At least two assembly languages (x86 and SPARC for preference): pipelines, caches, scheduling and calling conventions.&lt;/li&gt;&lt;li&gt;At least one dynamic language such as Ruby or Lisp&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Data structures: hash tables, red-black trees, B-trees, graphs, linked lists.&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Complexity theory: O(n) notations and how to reason about algorithmic efficiency.&lt;/li&gt;&lt;li&gt;NP-complete problems and methods for solving them (branch-and-bound search; simulated annealing; genetic algorithms)&lt;/li&gt;&lt;li&gt;Memory management: C-style (malloc/free), garbage collection (mark and sweep, and generational)&lt;/li&gt;&lt;li&gt;Running a business - if you've founded a startup, even if it failed, you'll have learned a lot from it.&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Compilers (to machine code and to bytecode).  You should definitely implement an optimizing compiler at least once.  Extra points if you &lt;a href="http://en.wikipedia.org/wiki/Bootstrapping_%28compilers%29"&gt;bootstrap it&lt;/a&gt;.&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Efficient bytecode interpretation and &lt;a href="http://en.wikipedia.org/wiki/Just-in-time_compilation"&gt;Just-in-time compilation&lt;/a&gt; (plus specific bytecode languages for at least 2 languages).&lt;/li&gt;&lt;li&gt;Relational database theory and practice: data normalization, optimizers and &lt;a href="http://en.wikipedia.org/wiki/Object-relational_mapping"&gt;ORM&lt;/a&gt;.&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Threads in Java and in C; patterns for synchronization and locking.&lt;/li&gt;&lt;li&gt;Game development - sprites, 3D rendering; maze generation and search; game AI.  A good place to start is &lt;a href="http://www.gamedev.net/reference/articles/article892.asp"&gt;Geoff Howland's article on GameDev.net&lt;/a&gt;.&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Web site development: HTML, HTTP and forms of RPC such as SOAP, REST, XML-RPC.&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Server-side web frameworks such as Ruby on Rails, Django, PHP and Struts, and their pros and cons.&lt;br /&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Data presentation and techniques for communicating trends.  &lt;a href="http://www.edwardtufte.com/tufte/"&gt;Edward Tufte&lt;/a&gt; is the undisputed king of the realm.&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Unix internals: inodes, memory management, disk management, kernel-space versus user-space.  Ideally, you should &lt;a href="http://linuxgazette.net/issue85/mahoney.html"&gt;implement a miniature operating system&lt;/a&gt; at least once in your life.&lt;/li&gt;&lt;li&gt;Linux: at least make your own &lt;a href="http://www-128.ibm.com/developerworks/linux/library/os-lfs/?ca=dgr-lnxw01BuildLinux"&gt;distro from scratch&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Network protocols: SMTP, HTTP, and &lt;a href="http://www.bittorrent.org/beps/bep_0003.html"&gt;Bittorrent &lt;/a&gt;at minimum.&lt;br /&gt;
&lt;/li&gt;&lt;/ul&gt;Is anything above necessary for being a professional programmer?  Absolutely not.  But the insights you get from learning them are important in ways you won't appreciate until you try.</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/05/learning-c-is-important-but-you-can.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-4238983417021095647</guid><pubDate>Fri, 23 May 2008 17:59:00 +0000</pubDate><atom:updated>2008-05-23T11:21:16.598-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>agile</category><category domain='http://www.blogger.com/atom/ns#'>tdd</category><title>Unit testing: not just for testing</title><description>I've said it before and I'll say it again: &lt;span style="font-weight: bold;"&gt;unit testing is not a testing technique; it's a design technique&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Got that?  The point of the technique is to reduce coupling between modules, which promotes code reuse and means you don't get nasty surprises when you come to make changes to it later.  The fact that it also inoculates your code against future breakage is mostly incidental.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.hokstad.com/reducing-coupling-through-unit-tests.html"&gt;Vikar Hokstad gets it&lt;/a&gt;.  If you can't instantiate business objects without connecting to a database, your code is too tightly coupled and it's going to drag you down.&lt;br /&gt;
&lt;br /&gt;
Over the years, I've heard a lot of excuses for why code isn't unit tested, and nearly all of them boil down to "it's too hard".  Michael Feathers &lt;a href="http://www.amazon.com/Working-Effectively-Legacy-Robert-Martin/dp/0131177052"&gt;wrote a whole book&lt;/a&gt; on this, which turned out to be a 450-page euphemism for "try harder then".  There's always a way, and your code will be better for you spending the time to find it.</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/05/unit-testing-not-just-for-testing.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-801933461648577917</guid><pubDate>Fri, 16 May 2008 13:21:00 +0000</pubDate><atom:updated>2008-05-16T07:21:30.692-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>agile</category><category domain='http://www.blogger.com/atom/ns#'>code</category><title>Gordon Ramsay and programmers' egos</title><description>If you've never watched &lt;a href="http://en.wikipedia.org/wiki/Ramsay%27s_Kitchen_Nightmares"&gt;Ramsay's Kitchen Nightmares&lt;/a&gt; (the British version, not the Fox travesty), you should.  Gordon Ramsay visits troubled restaurants and tries to turn them around - sometimes succeeding, sometimes not.&lt;br /&gt;
&lt;br /&gt;
As you watch the episodes, you start to see a few common themes:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Chefs cooking for an imagined audience that doesn't really exist&lt;/li&gt;&lt;li&gt;Overcomplicated food&lt;/li&gt;&lt;li&gt;Egos getting in the way of a quality product&lt;/li&gt;&lt;/ul&gt;All of this can be translated pretty easily into software:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Programmers adding features that make the product harder to use&lt;/li&gt;&lt;li&gt;Software that is so over-designed that it has lost its flexibility&lt;/li&gt;&lt;li&gt;Beloved design patterns that don't apply to the task at hand.&lt;/li&gt;&lt;/ul&gt;Today we're getting ready to release up.time 5.  I started here at uptime when it was back at version 3, and quickly realised that my first priority had to be simplifying the code base. As the product had evolved over the years, techniques that people had thought were really cool at the time were just getting in the way; if they had used the direct, obvious methods, it would have been much easier to change them with the product's needs.  A few months and a lot of hair-tearing later, we'd managed to simplify most of the main areas, and by now, though I say it myself, the code base is really quite good.&lt;br /&gt;
&lt;br /&gt;
Ramsay's advice for pretty much all the restaurants he visits is this: &lt;span style="font-style: italic;"&gt;Stick to simple dishes with good, fresh ingredients&lt;/span&gt;.  He applies this rule to small "hole in the wall" places right up to French restaurants with Michelin stars.  And the software equivalent of this looks something like:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Keep the design obvious so that it can change later on;&lt;/li&gt;&lt;li&gt;Focus on end-user features ("ingredients"), not programming techniques.&lt;/li&gt;&lt;/ul&gt;That is: if you're building a whizzy new database library before there's an easy way for customers to get your product up and running, there's something wrong - and that something is that your ego is getting in the way.  Don't let it happen to you!</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/05/gordon-ramsay-and-programmers-egos.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-4095458602544644180</guid><pubDate>Fri, 09 May 2008 18:58:00 +0000</pubDate><atom:updated>2008-05-09T12:02:58.338-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>monitoring</category><title>Monitor This!</title><description>In case you were wondering what the inside of &lt;a href="http://www.rackable.com/products/icecube.aspx?nid=datacenter_5"&gt;one of these&lt;/a&gt; looks like:&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.uptimesoftware.com/blog/pete-bevin/uploaded_images/2478389846_33aacbe22f_o-783066.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: left; cursor: pointer;" src="http://www.uptimesoftware.com/blog/pete-bevin/uploaded_images/2478389846_33aacbe22f_o-782789.jpg" alt="" border="0" /&gt;&lt;/a&gt;There are pictures over at &lt;a href="http://royal.pingdom.com/?p=291"&gt;Royal Pingdom&lt;/a&gt;.  Very tasty.</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/05/monitor-this.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-8384315564973300073</guid><pubDate>Sat, 12 Apr 2008 16:26:00 +0000</pubDate><atom:updated>2008-04-12T09:30:49.433-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>language</category><title>Perl is here to stay</title><description>It's ugly, it's dated, and only its mother could love it, but &lt;a href="http://contentment.org/2008/04/perl-is-not-going-away.html"&gt;Perl isn't going away&lt;/a&gt;.  Actually, I have a soft spot for the language; it's the fastest and easiest way to do a lot of small jobs on the command line, and the library support is great.</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/04/perl-is-here-to-stay.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-3422751067092378135</guid><pubDate>Sat, 12 Apr 2008 16:18:00 +0000</pubDate><atom:updated>2008-04-12T09:25:20.855-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>java</category><title>Java 6 update 10</title><description>The upcoming Java 6 update 10 isn't just a point release - it &lt;a href="http://java.sun.com/developer/technicalArticles/javase/java6u10/index.html"&gt;adds a lot of new features&lt;/a&gt;:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;More modular JRE downloads: if you don't need the entire JRE feature set in your app, you can break it down to just the pieces you need.&lt;/li&gt;&lt;li&gt;A new Look&amp;amp;Feel module called &lt;a href="http://galbraiths.org/blog/2007/03/13/update-on-nimbus/"&gt;Nimbus&lt;/a&gt;.  Unlike Metal, it looks nice.&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Much, much better startup performance, which has been my longest standing complaint about the platform.&lt;/li&gt;&lt;/ul&gt;More analysis at &lt;a href="http://ajaxian.com/archives/java-plugin-the-kernel-is-back"&gt;Ajaxian&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Finally, a release to get excited about!</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/04/java-6-update-10.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-2422683189480121314</guid><pubDate>Tue, 01 Apr 2008 20:43:00 +0000</pubDate><atom:updated>2008-04-01T13:58:19.818-07:00</atom:updated><title>If there are epigrams, there must be meta-epigrams</title><description>In 1982, &lt;a href="http://en.wikipedia.org/wiki/Alan_Perlis"&gt;Alan Perlis&lt;/a&gt; distilled what he had learned from a lifetime of programming into &lt;a href="http://www-pu.informatik.uni-tuebingen.de/users/klaeren/epigrams.html"&gt;130 pithy quotes&lt;/a&gt;.  TWENTY FIVE YEARS AGO.  And most of them are still relevant.&lt;br /&gt;
&lt;br /&gt;
Some of the best:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt; Syntactic sugar causes cancer of the semi-colon.&lt;/li&gt;&lt;li&gt; It is easier to write an incorrect program than understand a correct one.&lt;/li&gt;&lt;li&gt; If  you have a procedure with 10 parameters, you probably missed some.&lt;/li&gt;&lt;li&gt; If a listener nods his head when you're explaining your program, wake him up.&lt;/li&gt;&lt;li&gt; Everyone can be taught to sculpt: Michelangelo would have had to be taught how not to. So it is  with the great programmers.&lt;/li&gt;&lt;li&gt; There are two ways to write error-free programs; only the third one works.&lt;/li&gt;&lt;li&gt; In English every word can be verbed. Would that it were so in our programming languages.&lt;/li&gt;&lt;li&gt; Making something variable is easy. Controlling duration of constancy is the trick.&lt;/li&gt;&lt;li&gt;  If there are epigrams, there must be meta-epigrams.&lt;/li&gt;&lt;/ul&gt;</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/04/if-there-are.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-4004915447728314349</guid><pubDate>Fri, 28 Mar 2008 20:41:00 +0000</pubDate><atom:updated>2008-03-28T13:49:38.536-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux agile</category><title>How to undelete files on Linux</title><description>Carlo Wood &lt;a href="http://www.xs4all.nl/%7Ecarlo17/howto/undelete_ext3.html"&gt;explains how to undelete files on Linux ext3 file systems&lt;/a&gt;.  The really cool thing is not that you can do it, but that Carlo decided not to believe the received wisdom that it was impossible, and went and figured out how to do it anyway.&lt;br /&gt;
&lt;br /&gt;
One of my mantras is "I don't mind you complaining that it can't be done, as long as you don't bother the people who are doing it".</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/03/how-to-undelete-files-on-linux.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-748014540190469986</guid><pubDate>Fri, 28 Mar 2008 15:13:00 +0000</pubDate><atom:updated>2008-04-04T17:38:27.864-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>sla</category><title>SLA Inversion</title><description>&lt;div class="entry"&gt;      &lt;p&gt;So you’ve launched your new enterprise web site, and you’re so confident with your fully redundant web architecture that you figure you can provide a five-nines SLA - 99.999% uptime, or 5 minutes downtime a year. After all, what can possibly go wrong?&lt;/p&gt; &lt;p&gt;Welcome to SLA inversion, where a 99.999% available web service depends on a 95% available DNS server. Or a 98% available Internet connection. If your users can’t do work, &lt;em&gt;it doesn’t matter why&lt;/em&gt; - they don’t care that your web application is still able to process transactions; they don’t appreciate the difference between application failure and DNS failure.&lt;/p&gt; &lt;p&gt;As it happens, this topic is close to my heart: I run a few cancer support mailing lists, and one day I decided to switch the domain name hosting provider. What I didn’t realise was that the new registrar wouldn’t let me edit the zone file until the domain transfer had completed, and that left me dead in the water for several hours: requests to the web site were going to the registrar’s default page. No matter that the web site and mailing lists were just fine; the point was that nobody could reach them.&lt;/p&gt; &lt;p&gt;Whenever you’re monitoring for a service level agreement, you need to follow a few important rules.&lt;/p&gt; &lt;ol&gt;&lt;li&gt;Measure as close as you possibly can to what end users will see. That generally means running synthetic transactions at a minimum: HTTP for web applications and test emails for email services.&lt;/li&gt;&lt;li&gt;Take time to think through all the services your users rely on, and make sure they’re monitored, implicitly or explicitly. For example, are there routers outside your control on the path between you and your users? If so, find out what SLA, if any, is in effect. You can’t provide a better target than the weakest link in the chain.&lt;/li&gt;&lt;li&gt;If there is a weak link controlled by your customer, make sure it’s explicit in the SLA contract.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Service level agreements are all about avoiding nasty surprises: taking a bit of time up front to think through how you might be caught off guard will benefit you, and more importantly, your users.&lt;/p&gt;     &lt;/div&gt;</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/03/sla-inversion.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-2399564884003333161</guid><pubDate>Fri, 28 Mar 2008 15:00:00 +0000</pubDate><atom:updated>2008-03-28T08:01:15.631-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>management</category><title>Worth 80 programmers</title><description>As soon as you tell management that the changes they want will delay the release date, their first question (in most companies at least) is how many extra people you want. Brooks's Law, that &lt;a href="http://en.wikipedia.org/wiki/Brooks%27s_law"&gt;adding manpower to a late project makes it later&lt;/a&gt;, is not well understood outside the programming field.&lt;br /&gt;
&lt;br /&gt;
Steve McConnell has &lt;a href="http://forums.construx.com/blogs/stevemcc/archive/2008/03/27/productivity-variations-among-software-developers-and-teams-the-origin-of-quot-10x-quot.aspx"&gt;a great anecdote about a late project&lt;/a&gt; where they took all 80 developers off the project and replaced them with one highly competent guy, who finished on time. The point is not that you should do this, but that the story is believable.&lt;br /&gt;
&lt;br /&gt;
A good rule if you're in a large organization and someone offers you a horde of developers to improve productivity is to take them, find out which of them are any good, and assign the rest to tasks that don't touch production code (e.g., test case automation). A good programmer is at least 10 times as productive as a mediocre one, so keep the quality of your actual production team as high as you possibly can.&lt;br /&gt;
&lt;br /&gt;
Filed under "thoughts that make me happy not to work for a bank any more..."</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/03/worth-80-programmers.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-7310287448323510762</guid><pubDate>Thu, 27 Mar 2008 14:13:00 +0000</pubDate><atom:updated>2008-03-27T11:06:42.863-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>research</category><category domain='http://www.blogger.com/atom/ns#'>code</category><category domain='http://www.blogger.com/atom/ns#'>security</category><title>Issues of Trust</title><description>One of the big draws of open source software is that because you can examine the source code, you can, at least in theory, find bugs in the software and correct them.  The idea that "with enough eyes, all bugs are shallow" reflects this.  But Ken Thompson, one of the creators of Unix, gave a beautiful talk in 1984 called &lt;a target="_blank" href="http://cm.bell-labs.com/who/ken/trust.html"&gt;Reflections on Trusting Trust&lt;/a&gt;, which describes an ingenious method for introducing a security back door that would even work when you have all the source code available.&lt;br /&gt;
&lt;br /&gt;
Let's say you wanted to modify the SSH daemon to remember the username and password of anyone who logs in, and send you the results.  It would be a reasonably small change to the software to allow this, and assuming you had root access, you could easily drop in a modified version.  But next time someone recompiled sshd, the change would be lost.  How might you make your change more permanent?&lt;br /&gt;
&lt;br /&gt;
Ken's attack uses the C compiler itself as the weak spot.  First, he introduces code in the compiler to detect when it's compiling sshd and output the hacked version:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family:courier new;"&gt;if (compiling_sshd()) {&lt;br /&gt;
 output_hacked_sshd();&lt;br /&gt;
} else {&lt;br /&gt;
 compile_normally();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family:georgia;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;But again, if you recompile the C compiler, the change gets lost.  So let's add another check, this time for the C compiler:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family:courier new;"&gt;if (compiling_gcc()) {&lt;br /&gt;
 output_hacked_compiler();&lt;br /&gt;
} else if (compiling_sshd()) {&lt;br /&gt;
 output_hacked_sshd();&lt;br /&gt;
} else {&lt;br /&gt;
 compile_normally();&lt;br /&gt;
}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
But here's the key idea: &lt;span style="font-style: italic;"&gt;I can now remove this code from the compiler&lt;/span&gt; because the binary version will take care of it.  Future compilations of gcc will re-insert the block, and so invisibly infect the binaries.&lt;br /&gt;
&lt;br /&gt;
So if you could make this change on, say a Debian maintainer's machine, it could take quite a while before it gets noticed.  &lt;span style="font-style: italic;"&gt;Caveat Emptor...&lt;/span&gt;</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/03/issues-of-trust.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-1757083615017411055</guid><pubDate>Wed, 13 Feb 2008 16:09:00 +0000</pubDate><atom:updated>2008-03-27T11:07:56.602-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>uptime</category><category domain='http://www.blogger.com/atom/ns#'>fun</category><category domain='http://www.blogger.com/atom/ns#'>v5</category><title>Server monitoring is child's play!</title><description>May I present the world's first photograph of an &lt;span&gt;&lt;a title="One Laptop Per Child" target="_blank" href="http://laptop.org/laptop/"&gt;OLPC&lt;/a&gt; &lt;/span&gt;doing performance monitoring:&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.uptimesoftware.com/blog/pete-bevin/uploaded_images/olpc-727211.jpg"&gt;&lt;img style="cursor: pointer;" src="http://www.uptimesoftware.com/blog/pete-bevin/uploaded_images/olpc-727200.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
If the UI looks unfamiliar, it's because we're running a development version of the forthcoming up.time 5 codebase, which has a (IMHO much nicer) new look.</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/02/may-i-present-worlds-first-photograph.html</link><author>noreply@blogger.com (Pete Bevin)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-5928382587048606920.post-1829703011257372140</guid><pubDate>Thu, 17 Jan 2008 19:32:00 +0000</pubDate><atom:updated>2008-03-27T07:08:09.849-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>agile</category><category domain='http://www.blogger.com/atom/ns#'>tdd</category><title>How to improve software</title><description>&lt;p&gt;I was talking to someone recently about how to improve the quality of his software. He’s reached the point where he can see there is a problem, but he doesn’t yet know how to solve it.&lt;/p&gt;Here at uptime, we have a beautifully disciplined software development process that does everything from &lt;a href="http://www.extremeprogramming.org/rules/unittests.html"&gt;test-driven development&lt;/a&gt; to continuous integration and fast feedback using &lt;a href="http://cruisecontrol.sourceforge.net/"&gt;Cruise Control&lt;/a&gt;.  Our code is mostly well factored, reliable, and easy to work with, mostly because we haven’t skimped on process. The temptation to take shortcuts in the face of looming deadlines is always there, but we also know that doing that would lead to long term pain.&lt;br /&gt;
&lt;p&gt;As I talked to my friend, I realised that you don’t have to do everything at once; in fact, it’s better to do a bit at a time. So here’s my N-step process for getting your software under control.&lt;/p&gt;&lt;strong&gt;Step 1: Make a code-level regression test suite&lt;/strong&gt;. Your software keeps breaking in weird ways, and you can’t possibly predict everything. But you can certainly do &lt;em&gt;something&lt;/em&gt;. For example, if you are building a web-based application, you could check that the front page of the app has a login form on it. And once you’ve done that, you could check that a login works OK and the username is displayed on the resulting page. These tests could be as simple as using grepping the output of &lt;a href="http://www.gnu.org/software/wget/"&gt;wget&lt;/a&gt;, or you could use a more sophisticated tool like &lt;a href="http://www.openqa.org/selenium/"&gt;Selenium&lt;/a&gt;. Either way, you have &lt;em&gt;something&lt;/em&gt; that can tell you if something is badly broken. And what if you added one test a day to the suite? After three months, you’d be testing for sixty possible failure conditions every time you ran the suite.&lt;br /&gt;
&lt;p&gt;&lt;strong&gt;Step 2: Automate the build process&lt;/strong&gt;. You can almost certainly find a way to script a software build, database reset and regression test run automatically. Maybe you have to commandeer a physical machine; maybe you can set up a vmware instance. The important thing is that it can run unattended. This is called a &lt;a href="http://www.stevemcconnell.com/ieeesoftware/bp04.htm"&gt;Smoke Test&lt;/a&gt;  because you are checking to see if anything “catches fire” when you run it.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;If you’re using a language like PHP that doesn’t require compilation, you will probably want to at least do a syntax check against all your PHP files. On Unix, PHP comes with a command-line program and you can run “php -l”. Other languages generally have similar syntax for doing a syntax check on a script without running it (Perl, Python and Ruby all use the -c flag).&lt;/p&gt;What you’ll probably find once you’ve done this is that (a) the suite fails more often than you’d expect, (b) there are random bugs that keep slipping through (but you can add tests for at least some of them), and (c) your team often forgets to run the tests before checking in code. Which leads to...&lt;br /&gt;
&lt;p&gt;&lt;strong&gt;Step 3: Run the tests automatically&lt;/strong&gt;. In the old days, we used to run build scripts from cron once a day, and then look at the output in the morning. Nowadays, we have &lt;a href="http://martinfowler.com/articles/continuousIntegration.html"&gt;continuous integration (CI) tools&lt;/a&gt; such as &lt;a href="http://cruisecontrol.sourceforge.net/"&gt;Cruise Control&lt;/a&gt; that wake up every few minutes, check CVS for new checkins, run a build and unit+regression test, and notify the developers that broke the build.&lt;/p&gt;CI tools have a reputation for being hard to set up, but mostly because it’s hard to get a repeatable build process.  If you’ve followed steps 1 and 2 already, you’ll have that working and the rest of the setup will be a breeze.&lt;br /&gt;
&lt;p&gt;&lt;strong&gt;Other advice&lt;/strong&gt;: Don’t try to do all this at once. Build a couple of tests, and get used to running them.  Then start automating parts of the build and run it every day until you’re comfortable.  Only once you can run a single command to build and test should you take the final step to running Cruise Control.&lt;/p&gt;</description><link>http://www.uptimesoftware.com/blog/pete-bevin/2008/03/i-was-talking-to-someone-recently-about.html</link><author>noreply@blogger.com (Pete Bevin)</author></item></channel></rss>