<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Noah Sussman · Archives · Twitter · GitHub

Noah Sussman has been building Web sites since 1999.  For the most part he works with bricks-and-mortar businesses in New York, helping them to provide the same high level of customer experience online as in real life.</description><title>Infinite Undo</title><generator>Tumblr (3.0; @infiniteundo)</generator><link>http://infiniteundo.com/</link><item><title>The Commit Mutex Problem</title><description>&lt;p&gt;When I worked at &lt;a href="http://www.quora.com/Why-does-Etsy-care-so-much-about-automated-software-testing" title="from Quora: Why does Etsy care so much about automated software testing?"&gt;Etsy,&lt;/a&gt; the problem of many developers committing to trunk at once was colloquially known as the &lt;strong&gt;“commit mutex”&lt;/strong&gt; problem.&lt;/p&gt;

&lt;p&gt;A CI system can effectively become &lt;strong&gt;“blocked”&lt;/strong&gt; if too many people commit and trigger too many builds within a relatively short time period. All nodes in the CI cluster are busy but new builds keep getting queued. The resulting &lt;strong&gt;&amp;#8220;build queue&amp;#8221;&lt;/strong&gt; means that it takes progressively longer to get feedback from CI. &lt;em&gt;The longer it takes to get feedback, the less useful the CI system.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.slideshare.net/noahsussman/continuous-improvement-16013422/100"&gt;&lt;img src="https://farm9.staticflickr.com/8494/8432392004_39d1505f6c.jpg" alt="keep the feedback loop short" title="keep the feedback loop short"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Throwing hardware at the problem is a reasonable solution, as long as you can afford it. In fact almost every time we had to add hardware to the CI cluster, it was because of the commit mutex. There are a very few cases where we added a new tool that made the build slower &amp;lt;cough&amp;gt;code coverage &amp;lt;/cough&amp;gt; but the far more common case for adding hardware was: more people want to commit more often, and they all want to run all the tests.&lt;/p&gt;

&lt;p&gt;Everyone committing small chunks of code all the time is a Very Good Thing.  &lt;strong&gt;&amp;#8220;Everyone commits to trunk every day&amp;#8221;&lt;/strong&gt; is &lt;a href="http://martinfowler.com/articles/continuousIntegration.html#EveryoneCommitsToTheMainlineEveryDay"&gt;one of the tenets of continuous integration&lt;/a&gt;. &lt;em&gt;Yet there&amp;#8217;s still an upper limit on how fast and how concurrently everyone can (or should) deploy.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Avoiding the commit mutex and preventing build queues are in my humble opinion two of the hard problems in continuous deployment.&lt;/p&gt;</description><link>http://infiniteundo.com/post/41935409621</link><guid>http://infiniteundo.com/post/41935409621</guid><pubDate>Thu, 31 Jan 2013 03:48:00 -0500</pubDate><category>testing</category><category>infrastructure</category><category>bit rot</category></item><item><title>Hiring Programmers in New York, 2013</title><description>&lt;p&gt;It seems like every week I have a long conversation with someone on
the topic of &lt;a href="http://www.joelonsoftware.com/articles/SortingResumes.html" title="The general process for screening programmer resumes is structured around the assumption that 80% of people applying cannot write any code whatsoever."&gt;hiring programmers.&lt;/a&gt; &lt;acronym title="too long;  did not read"&gt;tl;dr:&lt;/acronym&gt; &lt;strong&gt;there are no programmers for hire in
New York in 2013.&lt;/strong&gt; The job market is such that all decent programmers
are gainfully employed. In order to hire a developers it is necessary
to convince them to &lt;em&gt;leave&lt;/em&gt; their current job. This will be true for
the &lt;a href="http://techcrunch.com/2012/10/27/write-code-get-paid/" title="Skilled programmers will continue to be in short supply for the foreseeable future, says Jon Evans of HappyFunCorp"&gt;foreseeable future.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://harrisallied.com/Hiring_Survey.html"&gt;&lt;img src="https://farm9.staticflickr.com/8355/8421331706_8ae339aa09.jpg" alt="42% of hiring managers cited finding good people as their primary concern, as of 2012." title="source: Harris Allied"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Personally I have observed that the number of contacts I receive from
recruiters has now surpassed the number of contacts I used to receive
during the &lt;em&gt;dot-com boom.&lt;/em&gt; Which makes sense. In the late 90s the
Internet had potential but &lt;a href="http://www.google.com/publicdata/explore?ds=wb-wdi&amp;amp;ctype=l&amp;amp;strail=false&amp;amp;bcs=d&amp;amp;nselm=h&amp;amp;met_y=it_net_user&amp;amp;scale_y=lin&amp;amp;ind_y=false&amp;amp;rdim=country&amp;amp;idim=country:USA:CHN&amp;amp;ifdim=country&amp;amp;tdim=true&amp;amp;hl=en&amp;amp;dl=en&amp;amp;ind=false&amp;amp;icfg" title="Global internet usage trends."&gt;only a few million people&lt;/a&gt; used
it. Today the Internet has become an essential household appliance,
like cable TV or the washing machine. And in the intervening ten
years, &lt;a href="http://www.glassdoor.com/blog/15-tech-companies-software-engineer-salary-revealed-glassdoor-report/" title="Salaries at 15 tech companies in 2012. From Glass Door."&gt;the number of qualified software engineers has not risen to meet demand.&lt;/a&gt;
It may take a &lt;em&gt;generation&lt;/em&gt; before we once again see a reasonable ratio
of job opportunities to &lt;a href="http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html" title="Why Can't Programmers... Program? by Jeff Atwood"&gt;competent software engineers.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;There aren&amp;#8217;t enough software engineers to fill all the roles&lt;/h3&gt;

&lt;p&gt;The most poignant question recruiters ask me lately is: &lt;strong&gt;do you know
someone else who would be interested in this role?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. The &lt;em&gt;last&lt;/em&gt; time I knew a programmer who was &lt;em&gt;unemployed,&lt;/em&gt; was
in 2010. And they were only out of work for three months. And that
was basically because they were being super picky about what kind of
early-stage startup they wanted to join.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.glassdoor.com/Salaries/new-york-city-web-developer-salary-SRCH_IL.0,13_IM615_KO14,27.htm"&gt;&lt;img src="https://farm9.staticflickr.com/8048/8424205308_f266b70a0d.jpg" alt="Web Developer salaries in New York 2012" title="Median salary for a Web Developer is $65k vs $85k for a Software Engineer or a whopping $110k median salary for a SENIOR software engineer. (source: GlassDoor)"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.glassdoor.com/Salaries/new-york-city-software-engineer-salary-SRCH_IL.0,13_IM615_KO14,31.htm"&gt;&lt;img src="https://farm9.staticflickr.com/8228/8420118829_fb68b6cd92.jpg" alt="Software Engineer salaries in New York 2012" title="Median salary for a Web Developer is $65k vs $85k for a Software Engineer or a whopping $110k median salary for a SENIOR software engineer. (source: GlassDoor)"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.glassdoor.com/Salaries/new-york-city-senior-web-developer-salary-SRCH_IL.0,13_IM615_KO14,34.htm"&gt;&lt;img src="https://farm9.staticflickr.com/8499/8423132827_6bcc578a32.jpg" alt="Senior Web Developer salaries in New York 2012" title="Median salary for a Web Developer is $65k vs $85k for a Software Engineer or a whopping $110k median salary for a SENIOR software engineer. (source: GlassDoor)"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.glassdoor.com/Salaries/new-york-city-senior-software-engineer-salary-SRCH_IL.0,13_IM615_KO14,38.htm"&gt;&lt;img src="https://farm9.staticflickr.com/8050/8420129641_f95f53cf69.jpg" alt="Senior Software Engineer salaries in New York 2012" title="Median salary for a Web Developer is $65k vs $85k for a Software Engineer or a whopping $110k median salary for a SENIOR software engineer. (source: GlassDoor)"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;So no. No I don&amp;#8217;t know any programmers who are looking for work.&lt;/h3&gt;

&lt;p&gt;And I don&amp;#8217;t expect to meet an unemployed programmer again. Unless the
Internet stops being a thing. Or unless the American school system
starts turning out class after class of qualified,
&lt;a href="http://www.codinghorror.com/blog/2006/07/separating-programming-sheep-from-non-programming-goats.html" title="Separating the programming sheep from the non-programming goats by Jeff Atwood"&gt;passionate journeyman software engineers.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://swz.salary.com/salarywizard/Software-Engineer-I-Salary-Details-New-York-NY.aspx?&amp;amp;hdcbxbonuse=on"&gt;&lt;img src="https://farm9.staticflickr.com/8333/8421348742_060714ae15_o.png" alt="Software Engineer I salaries in New York 2012" title="source: Salary.com"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;All the good programmers I know are gainfully employed&lt;/h3&gt;

&lt;p&gt;I get a lot of recruiter contacts and I read &lt;em&gt;every single one.&lt;/em&gt; I am
always looking for people&amp;#8217;s thoughts as to me why I would &lt;em&gt;leave my
current job&lt;/em&gt; and come to their office to work on &lt;em&gt;their&lt;/em&gt; project
every day for the next 2-3 years. Unfortunately most job postings are
little more than a list of keywords and a salary range.&lt;/p&gt;

&lt;p&gt;Still, keywords and salary ranges are interesting. I always take
note of which languages are trending among tech recruiters. And did
you know that a &lt;em&gt;Web Developer&lt;/em&gt; makes less money than a &lt;em&gt;Software
Engineer?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://swz.salary.com/SalaryWizard/Web-Software-Developer-Sr-Salary-Details-New-York-NY.aspx?&amp;amp;hdcbxbonuse=on" title="source: Salary.com"&gt;&lt;img src="https://farm9.staticflickr.com/8093/8420259479_7232cdcb6f_o.png" alt="image"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since 2005 I&amp;#8217;ve used &lt;a href="http://salary.com" title="Salary.com"&gt;Salary.com&lt;/a&gt; (and more recently
&lt;a href="http://glassdoor.com" title="Glass Door"&gt;GlassDoor&lt;/a&gt;) to get a general sense of what various job
titles were worth around New York. Combining that with the actual
salaries for roles I&amp;#8217;ve seen mentioned in recruiter emails gives a
pretty accurate picture of real salary ranges.&lt;/p&gt;

&lt;p&gt;Let&amp;#8217;s take it as read that any decent programmer performs that kind of
analysis on a regular basis.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://swz.salary.com/salarywizard/Software-Engineer-V-Salary-Details-New-York-NY.aspx?&amp;amp;hdcbxbonuse=on" title="source: Salary.com"&gt;&lt;img src="https://farm9.staticflickr.com/8221/8421363926_99a980705b_o.png" alt="image"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My own &lt;a href="http://online.wsj.com/article/SB10001424052748704596504575272613628586760.html" title="Etsy was one of the first small companies to offer free lunch in the office on a regular basis. They went all out on the effort!"&gt;personal experience&lt;/a&gt; and all available data
&lt;a href="http://www.businessinsider.com/the-best-perks-in-tech-2012-7?op=1" title="Standard tech company perks include free food, dog-friendly offices and standing desks"&gt;seems to indicate&lt;/a&gt; that recruiting must take place under
the assumption that &lt;strong&gt;&lt;em&gt;all&lt;/em&gt; good programmers are already getting paid
what they want, and working in
&lt;a href="http://boingboing.net/2012/04/22/valve-employee-manual-describe.html" title="Valve has a completely flat organizational structure. Desks are on wheels and teams are self-organizing."&gt;an environment that is relatively awesome.&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To recruit decent developers it&amp;#8217;s always necessary to have a
reasonably interesting narrative about &lt;a href="http://www.paulgraham.com/procrastination.html" title="What are the hard problems in your field and why aren't you working on them? ~Paul Graham"&gt;solving problems.&lt;/a&gt; In the current &lt;a href="http://www.quora.com/Career-Advice/Which-companies-are-hiring-software-engineers-in-New-York" title="Quora thread on who is hiring engineers in NYC. tl;dr: everyone."&gt;job market,&lt;/a&gt; it also takes competitive pay &lt;em&gt;and&lt;/em&gt; a work
environment that is &lt;a href="http://www.joelonsoftware.com/articles/fog0000000022.html" title="Simple stuff like: give hackers a quiet environment, let them work on one thing at a time and don't interrupt them by adding requirements or pointing out bugs in the middle of coding session. And keep your hackers safe from the Furniture Police. Simple stuff, but if your organization isn't following these guidelines, then best of luck hiring and keeping engineering talent."&gt;conducive to writing a lot of code.&lt;/a&gt; Job postings
that fail to communicate those qualities will not be successful.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.glassdoor.com/Salary/Google-Software-Engineer-New-York-City-Salaries-EJI_IE9079.0,6_KO7,24_IL.25,38_IM615.htm"&gt;&lt;img src="https://farm9.staticflickr.com/8047/8421308074_6dec46029f_z.jpg" alt="Software Engineer salaries at Google New York in 2012" title="source: GlassDoor"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Salary ranges from Salary.com and GlassDoor were retrieved on January 27&amp;#160;2013. When reviewing these graphs, keep in mind that demand is &lt;strong&gt;high&lt;/strong&gt; and therefore salaries in the median range are unlikely to draw qualified candidates. Anecdotal evidence suggests that engineers are willing to consider a new role at salaries closer to the &lt;strong&gt;80th percentile.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;</description><link>http://infiniteundo.com/post/41637755688</link><guid>http://infiniteundo.com/post/41637755688</guid><pubDate>Sun, 27 Jan 2013 15:58:00 -0500</pubDate><category>hiring</category><category>interview</category><category>statistical data</category></item><item><title>How to write a bug report</title><description>&lt;p&gt;In writing bug reports, I have found it helpful to take the attitude
that I am engaged in scientific inquiry in the relatively
&lt;a href="http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1036.html" title="By evoking the need for deep conceptual hierarchies, the automatic computer confronts us with a radically new intellectual challenge that has no precedent in our history... a program is, as a mechanism, totally different from all the familiar analogue devices we grew up with. Like all digitally encoded information, it has unavoidably the uncomfortable property that the smallest possible perturbations —i.e. changes of a single bit— can have the most drastic consequences. ~Edsger Dijkstra"&gt;new field that is software.&lt;/a&gt; I&amp;#8217;ve gotten the best results when
I constructed my communications around bugs in a way that lent itself
to application of &lt;a href="http://en.wikipedia.org/wiki/Scientific_method#Elements_of_the_scientific_method" title="The Oxford English Dictionary says that the scientific method is: a method or procedure that has characterized natural science since the 17th century, consisting in systematic observation, measurement, and experiment, and the formulation, testing, and modification of hypotheses."&gt;the Scientific Method&lt;/a&gt; (or a
rough approximation thereof).&lt;/p&gt;

&lt;h3&gt;Description Of Problem, Steps To Reproduce, and Expected Resolution&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Extraordinary claims require extraordinary proof. 
  &lt;cite&gt;&lt;a href="http://en.wikipedia.org/wiki/Marcello_Truzzi"&gt;Marcello Truzzi&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Generally, a complete bug report consists of no less than three
sections containing the following information:&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Description&lt;/strong&gt; of &lt;a href="http://www.ts.mah.se/RUP/RationalUnifiedProcess/webtmpl/templates/req/rup_vision.htm#2.2%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Problem%20Statement" title="Here is a very good template for writing Problem Statements."&gt;the problem,&lt;/a&gt;
including at least one &lt;a href="http://take-a-screenshot.org/" title="Detailed instructions on how to take a screenshot, for Mac, iOS, Windows and Linux."&gt;screenshot.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Steps to reproduce&lt;/strong&gt; the problem, in the form of a numbered list.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Expected resolution&lt;/strong&gt; of the problem, described using at least
two &lt;a href="http://en.wikipedia.org/wiki/Simple_sentence" title="A complete English sentence typically contains at least a noun and a verb. Sentences start with a capital letter and end with a period (dot)."&gt;complete sentences.&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;In the rest of this post I&amp;#8217;m going to delve at length into some of the
techniques I&amp;#8217;ve learned for effective communication where bugs are
concerned. But even if you stop reading right here, you already know
the most important technique: &lt;strong&gt;write bug reports that consist of a
description of the problem, steps to reproduce, and an expected
resolution.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="callout"&gt;
&lt;p&gt;
&lt;img src="http://farm9.staticflickr.com/8210/8216417533_99fa23bde3_n.jpg" width="320" height="240" alt="A good bug report consists of three parts roughly corresponding to the beginning, middle and end of a narrative. These three parts are: a description of the problem followed by a numbered list of steps to reproduce and finally the desired resolution."/&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;Provide context, and lots of it.&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;The problem with communication is the illusion that it has taken
  place. &lt;cite&gt;George Bernard Shaw&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There&amp;#8217;s a phenomenon by which software that was working just fine,
comes to be seen over time as increasingly buggy. In fact this
phenomenon occurs so often that it has a name: &lt;strong&gt;&lt;a href="http://www.catb.org/jargon/html/B/bit-rot.html"&gt;bit rot.&lt;/a&gt;&lt;/strong&gt;
Very rarely, bit rot occurs due to actual changes in the software. But
much more often the apparent &amp;#8220;rot&amp;#8221; is actually due the software
&lt;em&gt;staying the same&lt;/em&gt; while the attitudes and habits of its users slowly
change and evolve.&lt;/p&gt;

&lt;p&gt;As the existence of bit rot demonstrates, it is not only possibly but
&lt;em&gt;very likely&lt;/em&gt; that, given two different people, one of them might
perceive a behavior as buggy while the other person might see the
system as working just fine. Not to mention the costs associated with
other consequences of miscommunication including:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;Fixing the wrong bug.&lt;/li&gt;
&lt;li&gt;&amp;#8220;Fixing&amp;#8221; a bug that was &lt;a href="http://www.catb.org/jargon/html/T/Thats-not-a-bug--thats-a-feature-.html" title="The difference between a bug and a feature is often more political than it is empirical."&gt;actually a feature.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The communication churn associated with figuring out just what was
meant by &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/bugs.html" title="How to Report Bugs Effectively, by Simon Tatham. This is a time-tested and informative screed on the art and science of reporting bugs found in the wild. Recommended reading for anyone who wishes to become excellent at getting problems fixed rapidly."&gt;vague phrases such as &amp;#8220;Feature X is wonky.&amp;#8221;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Overcoming such disconnects requires careful statement of the problem
at hand, with sensitivity to the different perspectives of one&amp;#8217;s
audience.&lt;/p&gt;

&lt;h4&gt;Describe the problem, using at least two complete sentences.&lt;/h4&gt;

&lt;p&gt;Usually it&amp;#8217;s enough to write two
&lt;a href="http://en.wikipedia.org/wiki/Simple_sentence" title="A complete English sentence typically contains at least a noun and a verb. Sentences start with a capital letter and end with a period (dot)."&gt;complete sentences&lt;/a&gt; that describe the problem in
detail. The first sentence should generally be of the form &lt;em&gt;&amp;#8220;Feature X
is exhibiting behavior Y, but it was expected to exhibit behavior Z.&amp;#8221;&lt;/em&gt;
The second sentence should expand upon or clarify the first.&lt;/p&gt;

&lt;p&gt;For example: &lt;em&gt;&amp;#8220;Feature X is redirecting signed-in users to the
cart, but it should be redirecting to the new holiday promotion. This
is happening in IE and Chrome.&amp;#8221;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When describing thornier or larger issues, it may be useful to use a
&lt;a href="http://www.ts.mah.se/RUP/RationalUnifiedProcess/webtmpl/templates/req/rup_vision.htm#2.2%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Problem%20Statement" title="Here is a very good template for writing Problem Statements."&gt;problem statement template&lt;/a&gt; as a starting
point.&lt;/p&gt;

&lt;h4&gt;Always include screenshots that illustrate the problem.&lt;/h4&gt;

&lt;p&gt;&lt;a href="http://take-a-screenshot.org/" title="Detailed instructions on how to take a screenshot, for Mac, iOS, Windows and Linux."&gt;Screenshots&lt;/a&gt; of errors in production are a
fundamentally important artifact in the reporting of bugs and the
specification of improvements to existing features.&lt;/p&gt;

&lt;p&gt;Having a visual picture of a problem, is of huge benefit to people who
weren&amp;#8217;t there to witness the issue firsthand. Because of the
&lt;a href="http://en.wikipedia.org/wiki/Picture_thinking#Non-verbal_thought" title="Certain problems are better solved in pictures than in words. See also Feynman Diagrams."&gt;deeply visual&lt;/a&gt; wiring of our brains, there are certain
aspects of most problems that are best communicated via a picture. This
tends to be true regardless the level of detail provided in writing.&lt;/p&gt;

&lt;p&gt;Thus most bug reports cannot be considered complete without at least
one screenshot.&lt;/p&gt;

&lt;h4&gt;Present the Steps To Reproduce as a numbered list of discrete actions.&lt;/h4&gt;

&lt;p&gt;More than any other factor, the ability to
&lt;a href="http://en.wikipedia.org/wiki/Reproducibility" title="According to Wikipedia, the ability of an experiment or study to be reproduced by someone else working independently, is one of the main principles of the scientific method."&gt;reproduce&lt;/a&gt; a problem will determine whether or not
the problem gets fixed. Failure to provide enough information to
reproduce an issue is one of the most insidious and frustrating things
that can go wrong with a bug report. In the worst case, everyone who
tries to reproduce the issue winds up feeling like they&amp;#8217;ve wasted time
over nothing while the original reporter of the bug feels like the
owner of a &lt;strong&gt;&lt;a href="http://en.wikipedia.org/wiki/One_Froggy_Evening#Plot"&gt;singing frog.&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;object width="400" height="300"&gt;&lt;param name="movie" value="http://www.youtube.com/v/NRnX4quv5W4?version=3&amp;amp;hl=en_US&amp;amp;rel=0"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/NRnX4quv5W4?version=3&amp;amp;hl=en_US&amp;amp;rel=0" type="application/x-shockwave-flash" width="400" height="300" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;

&lt;p&gt;Numbered lists are the ideal format for explaining how to reproduce a
bug because a list makes it immediately obvious how many steps there
are as well as where each step leaves off and the next step
begins. Confusion about &amp;#8220;minor&amp;#8221; distinctions like that can lead to
major headaches later on.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s an example of a reasonably detailed &amp;#8220;steps to reproduce&amp;#8221;
section:&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;Open a browser (latest version of any major browser is fine).&lt;/li&gt;
&lt;li&gt;Navigate to foo.example.com/my/awesome/thing&lt;/li&gt;
&lt;li&gt;Sign in as the user &amp;#8220;HomerJ&amp;#8221;&lt;/li&gt;
&lt;li&gt;Observe that the text of the menu item in the upper right corner,
runs off the right edge of the screen.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;And by counter example, here&amp;#8217;s the same set of steps with all the
helpful context removed.&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;Look at the dev site.&lt;/li&gt;
&lt;li&gt;The menu is wonky.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;In the best case, a developer who reads the second example is confused
but figures it out. In the worst case, she notices that the background
color of the menu in question is green, recalls (possibly wrongly)
that the background color was meant to be blue, and spends the rest of
the day &amp;#8220;fixing&amp;#8221; that before she realizes she was only meant to be
moving the menu a couple of pixels to the left. Or she signs in as a
user whose preferences specify a totally different menu
look-and-feel. Or she goes to the wrong &lt;em&gt;part&lt;/em&gt; of the dev site and
looks at the wrong menu. More misunderstandings are possible in this
situation but their enumeration is left as an exercise for the reader.&lt;/p&gt;

&lt;h4&gt;Describe the expected resolution, using at least two complete sentences.&lt;/h4&gt;

&lt;p&gt;This is where it all comes together. The reader has been informed of
the nature of the problem and has walked through the steps to reproduce
it. What remains now are the tasks of inventing a fix for the issue,
applying it to the production application without breaking anything
else, and finally verifying that the fix as implemented actually
solves the original problem.&lt;/p&gt;

&lt;p&gt;It is generally insufficient to describe the expected resolution of a
software bug in less than
&lt;a href="http://en.wikipedia.org/wiki/Simple_sentence" title="A complete English sentence typically contains at least a noun and a verb. Sentences start with a capital letter and end with a period (dot)."&gt;two complete sentences&lt;/a&gt;. Even a trivial bug
represents at best a failure to properly implement the software as
specified. Such failures inevitably stem from misunderstandings of one
sort or another. So it is reasonable to approach writing up the
desired state of a software feature, as an exercise in bridging a
pre-existing communication gap.&lt;/p&gt;

&lt;p&gt;To this end it&amp;#8217;s also best to avoid domain-specific jargon and
acronyms. Stating the desired outcome in plain English can be more
challenging than it might first appear. But it&amp;#8217;s worth the effort.&lt;/p&gt;

&lt;div class="callout"&gt;
&lt;p&gt;

&lt;a href="http://www.threadless.com/product/2076/They_re_Real" title="It is essential to provide as much context as possible when describing an apparent bug in a production system. Bugs are often subjective and the environment required to reproduce and investigate bugs may be very complex. Every ounce of detail helps."&gt;&lt;img src="http://farm9.staticflickr.com/8346/8217501672_fae6e45392_n.jpg" width="320" height="240" alt="It is essential to provide as much context as possible when describing an apparent bug in a production system. Bugs are often subjective and the environment required to reproduce and investigate bugs may be very complex. Every ounce of detail helps."/&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;Be quantitative. Engineers respond well to hard evidence.&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Most bugs, most of the time, are easily nailed given even an
  incomplete but suggestive characterization of their error conditions
  at source-code level. When someone among your beta-testers can point
  out, &amp;#8220;there&amp;#8217;s a boundary problem in line nnn&amp;#8221;, or even just &amp;#8220;under
  conditions X, Y, and Z, this variable rolls over&amp;#8221;, a quick look at
  the offending code often suffices to pin down the exact mode of
  failure and generate a fix. &lt;br/&gt;&lt;cite&gt;&lt;a href="http://www.catb.org/esr/writings/homesteading/cathedral-bazaar/ar01s05.html" title="From the essay: How Many Eyeballs Tame Complexity, 1999"&gt;Eric
  Raymond&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Screenshots are the basic currency of good bug reports. But there are
numerous other artifacts which could be helpful in diagnosing an
issue. These include but are not limited to:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;Web server or application log messages.&lt;/li&gt;
&lt;li&gt;Stack traces of all sorts.&lt;/li&gt;
&lt;li&gt;Network traffic captures, eg from &lt;a href="https://github.com/textarcana/snippets/blob/master/bash/tcpdump.sh" title="A tcpdump cheatsheet for people who debug Web applications."&gt;tcpdump&lt;/a&gt; or &lt;a href="http://www.charlesproxy.com/" title="Charles is a Web debugging proxy tool with a nice GUI."&gt;Charles.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.igvita.com/slides/2012/devtools-tips-and-tricks/#10" title="HTTP Archive Format log capture is an unbelievably badass feature of Chrome Inspector."&gt;HTTP Archive files&lt;/a&gt; captured with Chrome Inspector.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/" title="If it moves, graph it. If it doesn't move, graph it. Because it probably will move at some point in the future. ~Laurie Denness"&gt;Graphs&lt;/a&gt; from tools like Graphite, Ganglia,
Cacti, Cloudkick, Google Analytics, etc.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;In the case of a Web application it is also extremely helpful to
provide hyperlinks pointing directly to the page(s) in production
where an issue has been observed.&lt;/p&gt;

&lt;p&gt;As a general rule, the more &lt;em&gt;hard data&lt;/em&gt; provided, the
better. Anectdotes about frustrated users can be a useful tool for
understanding why a fixing a particular bug might be important. But
knowing there&amp;#8217;s an error at line 142 (for instance) is much more
likely to turn out to be key to &lt;em&gt;actually implementing&lt;/em&gt; the fix.&lt;/p&gt;

&lt;div class="callout"&gt;
&lt;p&gt;
&lt;a href="http://www.youtube.com/watch?v=LdOe18KhtT4#t=2m14s" title="Although bugs in the field are upsetting to users, the most direct route to fixing a bug is often through hard evidence and rigorous analysis of historical data."&gt;&lt;img src="http://farm9.staticflickr.com/8200/8217500068_8e92c4c791_n.jpg" width="320" height="240" alt="Although bugs in the field are upsetting to users, the most direct route to fixing a bug is often through hard evidence and rigorous analysis of historical data."/&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;A bug report is a &lt;em&gt;story&lt;/em&gt; about a &lt;em&gt;problem.&lt;/em&gt;&lt;/h3&gt;

&lt;p&gt;A good story has a beginning, middle and end. A good bug report has a
description of the problem, steps to reproduce a problem and concludes
by stating the expected resolution. These three parts of a bug report
map neatly to the &lt;a href="http://english.learnhub.com/lesson/4579-plot-structure" title="A brief introduction to plot structure and the canonical shape of a story."&gt;narrative arc&lt;/a&gt; that underlies &lt;a href="http://xkcd.com/657/" title="Movie Narrative Charts: xkcd by Randall Munroe"&gt;all good stories.&lt;/a&gt;&lt;/p&gt;

&lt;table class="narrative-arc"&gt;&lt;tr&gt;&lt;td&gt;description of problem&lt;/td&gt;
&lt;td&gt;→&lt;/td&gt;
&lt;td&gt;establishment of the setting and characters&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;steps to reproduce&lt;/td&gt;
&lt;td&gt;→&lt;/td&gt;
&lt;td&gt;rising action&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;expected resolution&lt;/td&gt;
&lt;td&gt;→&lt;/td&gt;
&lt;td&gt;climax and resolution&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;Stories are powerful tools for communication. The wetware of the human
brain is &lt;em&gt;heavily optimized&lt;/em&gt; for the processing of information that is
structured as a narrative.&lt;/p&gt;

&lt;p&gt;&lt;object width="400" height="300"&gt;&lt;param name="movie" value="http://www.youtube.com/v/kuKkmcN7QWs?version=3&amp;amp;hl=en_US&amp;amp;rel=0#t=4m40s"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/kuKkmcN7QWs?version=3&amp;amp;hl=en_US&amp;amp;rel=0" type="application/x-shockwave-flash" width="400" height="300" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;

&lt;p&gt;In her talk &amp;#8220;How To Test The Inside of Your Head,&amp;#8221; &lt;a href="https://twitter.com/lunivore"&gt;Liz Keogh&lt;/a&gt; discusses
confirmation bias, the Face on Mars at Cydonia, the Martian Canals of
Percival Lowell and how we as a species are sometimes predisposed to
believe obvious but incorrect explanations. I highly recommend
watching the whole talk but &lt;a href="http://www.youtube.com/watch?v=kuKkmcN7QWs#t=4m40s" title="Liz Keogh talks about confirmation bias, the Face on Mars at Cydonia, the Martian Canals of Percival Lowell and how we as a species are sometimes predisposed to believe obvious but incorrect explanations: How To Test The Inside of Your Head, Selenium Conf 2012."&gt;here is the really pertinent bit&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Writing bug reports as I&amp;#8217;ve described helps prevent misunderstandings
and wasted effort. But there&amp;#8217;s more to it than that. By providing a
complete narrative, a good bug report sets the stage for everyone
involved to act within a larger, cohesive context. Human beings feel
better and make better decisions when they feel like the world around
them makes sense. Stories help us to make sense of the world and a
good bug report can go a long way toward making a chaotic situation
suddenly feel manageable.&lt;/p&gt;

&lt;p&gt;Thus the larger benefit of including complete information in a bug
report can be to directly reduce stress and therefore indirectly to
increase the capability of the team to rapidly resolve production
issues.&lt;/p&gt;

&lt;div class="callout"&gt;
&lt;p&gt;
&lt;a href="http://xkcd.com/742/" title="100 years later, this story remains terrifying--not because it's the local network block, but because the killer is still on IPv4.: Campfire: xkcd.com by Randall Munroe"&gt;&lt;img src="http://imgs.xkcd.com/comics/campfire.png" alt="Campfire"/&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;This article was written as a general guide, with the
novice-to-intermediate practitioner in mind. The techniques described
above reflect what has worked well in my limited experience. For other
perspectives the reader is referred to the many other fine bug writing
guides available on the Internet, including:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.chromium.org/for-testers/bug-reporting-guidelines"&gt;Google Chrome&lt;/a&gt; bug life cycle and reporting guidelines&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Bug_writing_guidelines"&gt;Firefox&lt;/a&gt; bug writing guidelines&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.webkit.org/quality/bugwriting.html"&gt;WebKit&lt;/a&gt; bug reporting guidelines&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/bugreporter/bugbestpractices.html"&gt;Apple&lt;/a&gt; bug reporting best practices&lt;/li&gt;
&lt;li&gt;&lt;a href="http://us.battle.net/wow/en/forum/topic/932784199"&gt;World of Warcraft&lt;/a&gt; how to write a good bug report&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;If you enjoyed this article, you might also appreciate my slide deck
on the origin and nature of software bugs:
&lt;a href="http://www.slideshare.net/noahsussman/software-entomology-or-where-do-bugs-come-from" title="This is a presentation that Michelle DNetto and I used to give for new hires on the Etsy Customer Support team (customer support being the first responders to bugs reported by our users). We used it to introduce advanced software quality concepts such as the Halting Problem and the impossibility of complete testing."&gt;Software Entomology, or Where Do Bugs Come From?&lt;/a&gt;&lt;/p&gt;</description><link>http://infiniteundo.com/post/36678096413</link><guid>http://infiniteundo.com/post/36678096413</guid><pubDate>Tue, 27 Nov 2012 14:18:00 -0500</pubDate><category>bit rot</category><category>singing frogs</category></item><item><title>More falsehoods programmers believe about time; "wisdom of the crowd" edition</title><description>&lt;p&gt;A couple of days ago I decided to
&lt;a href="http://infiniteundo.com/post/25230828820/things-you-should-test"&gt;write down some of the things I&amp;#8217;ve learned about testing&lt;/a&gt;
over the course of the last &lt;a href="http://codeascraft.etsy.com/2011/04/20/divide-and-concur/" title="I am the designer of Etsy's CI system, as described in this post on Code As Craft, the Etsy Engineering Blog."&gt;several years.&lt;/a&gt; In the
course of enumerating the areas that benefit most from testing, I
realized that I had accumulated a lot of specific thoughts about how
we as programmers tend to abuse the concept of &lt;em&gt;time.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So I wrote another post called
&lt;strong&gt;&amp;#8220;&lt;a href="http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time"&gt;falsehoods programmers believe about time&lt;/a&gt;,&amp;#8221;&lt;/strong&gt; where
I included 34 misconceptions and mistakes having to do with both
calendar and system time.  Most of these were drawn from my immediate
experience with code that needed to be debugged (both in production
and in test).&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/justaslice/3730148357/" title="Sub 5 Seconds by █ Slices of Light █▀ ▀ ▀, on Flickr"&gt;&lt;img src="http://farm3.staticflickr.com/2477/3730148357_4bae6040b1.jpg" width="500" height="281" alt="Sub 5 Seconds"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A great many of the false assumptions listed were my own.&lt;/strong&gt;  Especially &amp;#8220;time stamps are always in seconds since epoch&amp;#8221; and &amp;#8220;the duration of a system clock minute is always pretty close to the duration of a wall clock minute.&amp;#8221;  Whoa did I ever live to regret my ignorance in those two cases!  But hey, apparently I&amp;#8217;m not the only one who has run into (or inadvertently caused) such issues.  A lot of people responded and shared similar experiences.&lt;/p&gt;

&lt;div style="border: 2px solid #333; padding: 0 1em 1em 1em; margin-top: 1em;"&gt;
&lt;h2&gt;UPDATED: I&amp;#8217;d like to say a big thanks to &lt;a href="http://www.reddit.com/r/programming/comments/zckb2/more_falsehoods_programmers_believe_about_time/"&gt;all the Redditors&lt;/a&gt; who have been discussing &lt;em&gt;this&lt;/em&gt; post recently. I have read every single one of your comments :) and learned about fun stuff like &lt;a href="http://www.reddit.com/r/programming/comments/zckb2/more_falsehoods_programmers_believe_about_time/c63v01p"&gt;the year zero&lt;/a&gt; and &lt;a href="http://www.reddit.com/r/programming/comments/zckb2/more_falsehoods_programmers_believe_about_time/c63lwfq"&gt;International Atomic Time&lt;/a&gt;.&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;I&amp;#8217;d like to say an enormous thanks&lt;/strong&gt; to everyone who contributed to
the comment threads on &lt;a href="http://boingboing.net/2012/06/19/falsehoods-programmers-believe.html" title="Corey Doctorow called this post 'an eye-popping and mindbending riff on the malleability of time'"&gt;BoingBoing&lt;/a&gt; and
&lt;a href="http://news.ycombinator.com/item?id=4128208" title="Comment thread for this post on Hacker news"&gt;Hacker News&lt;/a&gt; as well as &lt;a href="http://www.reddit.com/r/programming/comments/v8s0y/falsehoods_programmers_believe_about_time/"&gt;Reddit&lt;/a&gt; and
&lt;a href="http://www.metafilter.com/117073/Falsehoods-Programmers-Believe"&gt;MetaFilter&lt;/a&gt; and to &lt;a href="https://twitter.com/#!/search/realtime/falsehoods-programmers-believe-about-time"&gt;everyone on Twitter&lt;/a&gt; who
shared their strange experiences with time.  &lt;span title="~200 comments on Hacker News, ~200 on Reddit, ~150 on  Metafilter, ~30 comments on BoingBoing and about 350 tweets and  retweets, as of June 19 at 18:22 EDT"&gt;In those thousand or so comments
and tweets, there were a &lt;em&gt;lot&lt;/em&gt; of suggestions as to &amp;#8220;falsehoods 35 to 35+n.&amp;#8221;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;First and foremost was the omission of the false assumption that &amp;#8220;time
always moves forward,&amp;#8221; as pointed out by &lt;a href="http://technomancy.us/" title="Technomancy is a prolific hacker who has written helpful Emacs tools (which I use), along with many, many other things."&gt;Technomancy&lt;/a&gt; and many others.
I enjoyed reading all the suggested falsehoods.  When I was done
reading, I realized that taken as a whole,
these constitute a whole other blog post.  So I collected some of your suggested falsehoods
into a post and here it is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/JackieJack/status/215155789747326976" title="@JackieJack tweeted: 'I figured it out. My brain is a computer, running VMware &amp;amp; my spirit is a hapless programmer'"&gt;&lt;img src="http://25.media.tumblr.com/tumblr_m5x94daOWk1qzrb5lo1_500.png" alt="@JackieJack tweeted: 'I figured it out. My brain is a computer, running VMware &amp;amp; my spirit is a hapless programmer'"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;All of these assumptions are wrong&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;All of these falsehoods were suggested by people who commented on the
&lt;a href="http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time"&gt;original post&lt;/a&gt;.  Each contributor is credited below.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;The offsets between two time zones will remain constant.&lt;/li&gt;
&lt;li&gt;OK, historical oddities aside, the offsets between two time zones won&amp;#8217;t change in the future.&lt;/li&gt;
&lt;li&gt;Changes in the offsets between time zones will occur with plenty of advance notice.&lt;/li&gt;
&lt;li&gt;Daylight saving time happens at the same time every year.&lt;/li&gt;
&lt;li&gt;Daylight saving time happens at the same time in every time zone.&lt;/li&gt;
&lt;li&gt;Daylight saving time always adjusts by an hour.&lt;/li&gt;
&lt;li&gt;Months have either 28, 29, 30, or 31 days.&lt;/li&gt;
&lt;li&gt;The day of the month always advances contiguously from N to either N+1 or 1, with no discontinuities.&lt;/li&gt;
&lt;li&gt;There is only one calendar system in use at one time.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://support.microsoft.com/kb/214326" title="I like the honesty.  The decision to introduce the flawed logic was made because it was 'easier... and caused no harm to almost all' calculations"&gt;There is a leap year every year divisible by 4.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Non leap years will never contain a leap day.&lt;/li&gt;
&lt;li&gt;It will be easy to calculate the duration of x number of hours and minutes from a particular point in time.&lt;/li&gt;
&lt;li&gt;The same month has the same number of days in it everywhere!&lt;/li&gt;
&lt;li&gt;Unix time is completely ignorant about anything except seconds.&lt;/li&gt;
&lt;li&gt;Unix time is the number of seconds since Jan 1st 1970.&lt;/li&gt;
&lt;li&gt;The day before Saturday is always Friday.&lt;/li&gt;
&lt;li&gt;Contiguous timezones are no more than an hour apart. (aka we don&amp;#8217;t need to test what happens to the avionics when you fly over the International Date Line)&lt;/li&gt;
&lt;li&gt;Two timezones that differ will differ by an integer number of half hours.&lt;/li&gt;
&lt;li&gt;Okay, quarter hours.&lt;/li&gt;
&lt;li&gt;Okay, seconds, but it will be a consistent difference if we ignore DST.&lt;/li&gt;
&lt;li&gt;If you create two date objects right beside each other, they&amp;#8217;ll represent the same time. (a fantastic Heisenbug generator)&lt;/li&gt;
&lt;li&gt;You can wait for the clock to reach exactly HH:MM:SS by sampling once a second.&lt;/li&gt;
&lt;li&gt;If a process runs for n seconds and then terminates, approximately n seconds will have elapsed on the system clock at the time of termination.&lt;/li&gt;
&lt;li&gt;Weeks start on Monday.&lt;/li&gt;
&lt;li&gt;Days begin in the morning.&lt;/li&gt;
&lt;li&gt;Holidays span an integer number of whole days.&lt;/li&gt;
&lt;li&gt;The weekend consists of Saturday and Sunday.&lt;/li&gt;
&lt;li&gt;It&amp;#8217;s possible to establish a total ordering on timestamps that is useful outside your system.&lt;/li&gt;
&lt;li&gt;The local time offset (from UTC) will not change during office hours.&lt;/li&gt;
&lt;li&gt;Thread.sleep(1000) sleeps for 1000 milliseconds.&lt;/li&gt;
&lt;li&gt;Thread.sleep(1000) sleeps for &amp;gt;= 1000 milliseconds.&lt;/li&gt;
&lt;li&gt;There are 60 seconds in every minute. &lt;/li&gt;
&lt;li&gt;Timestamps &lt;a href="http://www.metafilter.com/117073/Falsehoods-Programmers-Believe#4405410" title="MetaFilter commenter jeffamaphone hints at one of the reasons Windows machines need to be rebooted once a month."&gt;always advance monotonically.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;GMT and UTC are the same timezone.&lt;/li&gt;
&lt;li&gt;Britain uses GMT.&lt;/li&gt;
&lt;li&gt;Time always goes forwards.&lt;/li&gt;
&lt;li&gt;The difference between the current time and one week from the current time is always 7 * 86400 seconds.&lt;/li&gt;
&lt;li&gt;The difference between two timestamps is an accurate measure of
the time that elapsed between them.&lt;/li&gt;
&lt;li&gt;24:12:34 is a invalid time&lt;/li&gt;
&lt;li&gt;Every integer is a theoretical possible year&lt;/li&gt;
&lt;li&gt;If you display a datetime, the displayed time has the same second part as the stored time&lt;/li&gt;
&lt;li&gt;Or the same year&lt;/li&gt;
&lt;li&gt;But at least the numerical difference between the displayed and stored year will be less than 2&lt;/li&gt;
&lt;li&gt;If you have a date in a correct YYYY-MM-DD format, the year consists of four characters&lt;/li&gt;
&lt;li&gt;If you merge two dates, by taking the month from the first and the day/year from the second, you get a valid date&lt;/li&gt;
&lt;li&gt;But it will work, if both years are leap years&lt;/li&gt;
&lt;li&gt;If you take a w3c published algorithm for adding durations to dates, it will work in all cases.&lt;/li&gt;
&lt;li&gt;The standard library supports negative years and years above 10000.&lt;/li&gt;
&lt;li&gt;Time zones always differ by a whole hour&lt;/li&gt;
&lt;li&gt;If you convert a timestamp with millisecond precision to a date time with second precision, you can safely ignore the millisecond fractions&lt;/li&gt;
&lt;li&gt;But you can ignore the millisecond fraction, if it is less than 0.5&lt;/li&gt;
&lt;li&gt;Two-digit years should be somewhere in the range 1900-2099&lt;/li&gt;
&lt;li&gt;If you parse a date time, you can read the numbers character for character, without needing to backtrack&lt;/li&gt;
&lt;li&gt;But if you print a date time, you can write the numbers character for character, without needing to backtrack&lt;/li&gt;
&lt;li&gt;You will never have to parse a format like &lt;code&gt;---12Z&lt;/code&gt; or &lt;code&gt;P12Y34M56DT78H90M12.345S&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;There are only 24 time zones&lt;/li&gt;
&lt;li&gt;Time zones are always whole hours away from UTC&lt;/li&gt;
&lt;li&gt;Daylight Saving Time (DST) starts/ends on the same date everywhere&lt;/li&gt;
&lt;li&gt;DST is always an advancement by 1 hour&lt;/li&gt;
&lt;li&gt;Reading the client&amp;#8217;s clock and comparing to UTC is a good way to determine their timezone&lt;/li&gt;
&lt;li&gt;The software stack will/won&amp;#8217;t try to automatically adjust for timezone/DST&lt;/li&gt;
&lt;li&gt;My software is only used internally/locally, so I don&amp;#8217;t have to worry about timezones&lt;/li&gt;
&lt;li&gt;My software stack will handle it without me needing to do anything special&lt;/li&gt;
&lt;li&gt;I can easily maintain a timezone list myself&lt;/li&gt;
&lt;li&gt;All measurements of time on a given clock will occur within the same &lt;a href="http://www.reddit.com/r/programming/comments/v8s0y/falsehoods_programmers_believe_about_time/c52kqpa"&gt;frame of reference.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The fact that a date-based function works now means it will work on any date.&lt;/li&gt;
&lt;li&gt;Years have 365 or 366 days.&lt;/li&gt;
&lt;li&gt;Each calendar date is followed by the next in sequence, without skipping.&lt;/li&gt;
&lt;li&gt;A given date and/or time unambiguously identifies a unique
moment.&lt;/li&gt;
&lt;li&gt;Leap years occur every 4 years.&lt;/li&gt;
&lt;li&gt;You can determine the time zone from the state/province.&lt;/li&gt;
&lt;li&gt;You can determine the time zone from the city/town.&lt;/li&gt;
&lt;li&gt;Time passes at the same speed on top of a mountain and at the bottom of a valley.&lt;/li&gt;
&lt;li&gt;One hour is as long as the next in all time systems.&lt;/li&gt;
&lt;li&gt;You can calculate when leap seconds will be added.&lt;/li&gt;
&lt;li&gt;The precision of the data type returned by a getCurrentTime() function is the same as the precision of that function.&lt;/li&gt;
&lt;li&gt;Two subsequent calls to a getCurrentTime() function will return distinct results.&lt;/li&gt;
&lt;li&gt;The second of two subsequent calls to a getCurrentTime() function will return a larger result.&lt;/li&gt;
&lt;li&gt;The software will never run on a space ship that is orbiting a black hole.&lt;/li&gt;
&lt;/ol&gt;&lt;h3&gt;Seriously? Black holes?&lt;/h3&gt;

&lt;p&gt;Hey, if
&lt;a href="http://www.wired.com/beyond_the_beyond/2012/06/falsehoods-programmers-believe-about-time/" title="Wired: Beyond the Beyond blog by Bruce Sterling"&gt;Bruce Sterling says that my software needs to be resilient against time distortions caused by black holes&lt;/a&gt;,
I&amp;#8217;m going to take him at his word.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/dandechiaro/4219474677/" title="Inexact Time by DanDeChiaro, on Flickr"&gt;&lt;img src="http://farm5.staticflickr.com/4042/4219474677_c67c3ff61a.jpg" width="500" height="279" alt="Inexact Time"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Corrections&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://twitter.com/danielmorrison/status/215644327198732288"&gt;Daniel Morrison pointed out&lt;/a&gt; that it&amp;#8217;s &lt;strong&gt;daylight saving time&lt;/strong&gt; and not &lt;strong&gt;daylight &lt;em&gt;savings&lt;/em&gt; time.&lt;/strong&gt;  Thanks, I&amp;#8217;ve been saying it wrong my whole life!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/RohanSJ/status/216936268217597952"&gt;Rohan Jayasekera&lt;/a&gt; suggested a couple of &lt;a href="https://twitter.com/RohanSJ/status/216937608138342400"&gt;corrections.&lt;/a&gt; Thanks!&lt;/p&gt;

&lt;h3&gt;Credits&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Thanks again to everyone who commented.  I read everything that you
  wrote, even if I didn&amp;#8217;t wind up including it above.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I made the list above by going through each of the comment threads on
Hacker News, Reddit, MetaFilter and BoingBoing (in that order) and
finding all(?) of the places where folks had broken out &amp;#8220;falsehood 35
to &lt;code&gt;35 + n&lt;/code&gt;&amp;#8221; as a bulleted list.  I then selectively copied those
lists &amp;#8212; &lt;em&gt;in the order that I found them&lt;/em&gt;.  I made small edits for
readability and occasionally I paraphrased (this is noted below).&lt;/p&gt;

&lt;h4&gt;&lt;a href="http://news.ycombinator.com/item?id=4128208" title="Comment thread for this post on Hacker news"&gt;From Hacker News&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;1-8: JoshTriplett, 9-10: lambda, 11: hc5, 12: chris_wot, 13: einhverfr,
14: masklinn, 15: rmc, 16: jimfl, 17: einhverfr, 18-20: aardvark179,
21-22: bazzargh, 23: my paraphrase of mikeash&amp;#8217;s comment, 24-26: edanm,
27: my paraphrase of Mvandenbergh&amp;#8217;s comment, 28: derleth, 29: finnw,
30: michaelochurch, 31: cpeterso, 32-33: dfranke, 34: arohner, 35:
TazeTSchnitzel, 36: technomancy, 37: sses, 38: DanWaterworth&lt;/p&gt;

&lt;h4&gt;&lt;a href="http://www.reddit.com/r/programming/comments/v8s0y/falsehoods_programmers_believe_about_time/"&gt;From Reddit&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;39-55: benibela2, 56-64: Darkhack, 65: ericanderton, 66: Taladar&lt;/p&gt;

&lt;h4&gt;&lt;a href="http://www.metafilter.com/117073/Falsehoods-Programmers-Believe"&gt;From MetaFilter&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;69-69&amp;#160;: Joe in Australia&lt;/p&gt;

&lt;h4&gt;&lt;a href="http://boingboing.net/2012/06/19/falsehoods-programmers-believe.html" title="Corey Doctorow called this post 'an eye-popping and mindbending riff on the malleability of time'"&gt;From BoingBoing&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;70-75: Paul&lt;/p&gt;

&lt;h4&gt;&lt;a href="http://twitter.com"&gt;From Twitter&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;76-79: cmchen&lt;/p&gt;

&lt;h2&gt;An acknowledgment&lt;/h2&gt;

&lt;p&gt;This post &amp;#8212; like the one before it &amp;#8212; owes a great debt to
&lt;a href="http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/" title="Falsehoods Programmers Believe About Names"&gt;Patrick McKenzie&amp;#8217;s canonical blog post about user names,&lt;/a&gt;
which I have read over and over throughout the years and from
which I have shamelessly cribbed both concept and style.  If you
haven&amp;#8217;t yet read this gem, go and do so right now.  I promise you&amp;#8217;ll
enjoy it.&lt;/p&gt;</description><link>http://infiniteundo.com/post/25509354022</link><guid>http://infiniteundo.com/post/25509354022</guid><pubDate>Wed, 20 Jun 2012 12:12:00 -0400</pubDate><category>testing</category><category>popular</category></item><item><title>Falsehoods programmers believe about time</title><description>&lt;p&gt;Over the past couple of years &lt;a href="http://infiniteundo.com/post/25230828820/things-you-should-test" title="I wrote a checklist of things that are worth testing in almost any software system. These are general areas where bugs and errors tend to cluster."&gt;I have spent a lot of time&lt;/a&gt; debugging
other engineers&amp;#8217; test code.  This was interesting work, occasionally
frustrating but always informative. One might not immediately think
that test code would have bugs, but of course &lt;em&gt;all&lt;/em&gt; code has bugs and
tests are no exception.&lt;/p&gt;

&lt;p&gt;I have repeatedly been confounded to discover just how
many mistakes in &lt;em&gt;both&lt;/em&gt; test &lt;em&gt;and&lt;/em&gt; application code stem from
misunderstandings or misconceptions about &lt;em&gt;time.&lt;/em&gt;  By this I mean both
the interesting way in which computers handle time, and the
fundamental gotchas inherent in how we humans have constructed our
calendar &amp;#8212; daylight savings being just the tip of the iceberg.&lt;/p&gt;

&lt;p&gt;In fact I have seen so many of these misconceptions crop up in other
people&amp;#8217;s (and my own) programs that I thought it would be worthwhile
to collect a list of the more common problems here.&lt;/p&gt;

&lt;h2&gt;All of these assumptions are wrong&lt;/h2&gt;

&lt;ol&gt;&lt;li&gt;There are always 24 hours in a day.&lt;/li&gt;
&lt;li&gt;Months have either 30 or 31 days.&lt;/li&gt;
&lt;li&gt;Years have 365 days.&lt;/li&gt;
&lt;li&gt;February is always 28 days long.&lt;/li&gt;
&lt;li&gt;Any 24-hour period will always begin and end in the same day (or week, or month).&lt;/li&gt;
&lt;li&gt;A week always begins and ends in the same month.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.reddit.com/r/programming/comments/v8s0y/falsehoods_programmers_believe_about_time/c52k8m9" title="This statement confused a lot of people. What I originally meant was that a month-long period may not end in the same year that it started. However, see the Reddit comment thread for discussion of several special cases where New Years Day falls in the middle of a month."&gt;A week (or a month) always begins and ends in the same &lt;em&gt;year.&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The machine that a program runs on will always be in the GMT time
zone.&lt;/li&gt;
&lt;li&gt;Ok, that&amp;#8217;s not true. But at least the time zone in which a
program has to run will never change.&lt;/li&gt;
&lt;li&gt;Well, surely there will never be a change to the time zone in which
a program hast to run &lt;em&gt;in production.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;The system clock will always be set to the correct local time.&lt;/li&gt;
&lt;li&gt;The system clock will always be set to a time that is not wildly
different from the correct local time.&lt;/li&gt;
&lt;li&gt;If the system clock is incorrect, it will at least always be off by
a consistent number of seconds.&lt;/li&gt;
&lt;li&gt;The server clock and the client clock will always be set to the
same time.&lt;/li&gt;
&lt;li&gt;The server clock and the client clock will always be set to
&lt;em&gt;around&lt;/em&gt; the same time.&lt;/li&gt;
&lt;li&gt;Ok, but the time on the server clock and time on the client clock
would never be different by a matter of &lt;em&gt;decades.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;If the server clock and the client clock are not in synch, they
will at least always be out of synch by a consistent number of
seconds.&lt;/li&gt;
&lt;li&gt;The server clock and the client clock will use the same time zone.&lt;/li&gt;
&lt;li&gt;The system clock will never be set to a time that is in the distant
past or the far future.&lt;/li&gt;
&lt;li&gt;Time has no beginning and &lt;a href="http://en.wikipedia.org/wiki/Year_2038_problem" title="the UNIX Apocalypse"&gt;no end.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;One minute on the system clock has exactly the same duration as one
minute on &lt;a href="http://en.wikipedia.org/wiki/Atomic_clock" title="Yes, there's a very rigorous standard for the duration of units of time such as seconds and minutes.  But no, your system clock probably doesn't have any *direct* knowledge of that standard."&gt;any other clock&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Ok, but the duration of one minute on the system clock will be
&lt;em&gt;pretty close&lt;/em&gt; to the duration of one minute on most other clocks.&lt;/li&gt;
&lt;li&gt;Fine, but the duration of one minute on the system clock would never
be more than an hour.&lt;/li&gt;
&lt;li&gt;You can&amp;#8217;t be serious.&lt;/li&gt;
&lt;li&gt;The smallest unit of time is one second.&lt;/li&gt;
&lt;li&gt;Ok, one millisecond.&lt;/li&gt;
&lt;li&gt;It will never be necessary to set the system time to any value
other than the correct local time.&lt;/li&gt;
&lt;li&gt;Ok, &lt;em&gt;testing&lt;/em&gt; might require setting the system time to a value
other than the correct local time but it will never be necessary
to do so &lt;em&gt;in production.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Time stamps will always be specified in a commonly-understood format
like 1339972628 or 133997262837.&lt;/li&gt;
&lt;li&gt;Time stamps will always be specified in the same format.   &lt;/li&gt;
&lt;li&gt;Time stamps will always have the same level of precision.&lt;/li&gt;
&lt;li&gt;A time stamp of sufficient precision can safely be considered
unique.&lt;/li&gt;
&lt;li&gt;A timestamp represents the time that an event actually occurred.&lt;/li&gt;
&lt;li&gt;Human-readable dates can be specified in universally understood
formats such as 05/07/11.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="border: 2px solid #333; padding: 0 1em 1em 1em; margin-top: 1em;"&gt;
&lt;h2&gt;UPDATED: There&amp;#8217;s more! &lt;a href="http://infiniteundo.com/post/25509354022/more-falsehoods-programmers-believe-about-time-wisdom" title="the Web's collective thoughts on More Falsehoods About Time!" style="font-weight: bold;"&gt;Read the rest of the falsehoods…&lt;/a&gt;&lt;/h2&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/nico-zeissig/4276164545/" title="Citizen Eco-Drive wrist watch by n.zeissig, on Flickr"&gt;&lt;img src="http://25.media.tumblr.com/tumblr_m5sd9jQrbH1qzrb5lo1_500.jpg" width="500" height="500" alt="Citizen Eco-Drive wrist watch"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;That thing about a minute being longer than an hour &lt;em&gt;was&lt;/em&gt; a joke, right?&lt;/h2&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;There was a fascinating bug in older versions of &lt;a href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine" title="KVM is a Linux tool for creating virtual machines."&gt;KVM&lt;/a&gt; on CentOS.
Specifically, a KVM virtual machine had no awareness that it was not
running on physical hardware.  This meant that if the host OS put the
VM into a suspended state, the virtualized system clock would retain
the time that it had had &lt;em&gt;when it was suspended.&lt;/em&gt;  E.g. if the VM was
suspended at 13:00 and then brought back to an active state two hours
later (at 15:00), the system clock on the VM would still reflect a
local time of 13:00.  The result was that every time a KVM VM went
idle, the host OS would put it into a suspended state and the VM&amp;#8217;s
system clock would start to drift away from reality, sometimes by a
large margin depending on how long the VM had remained idle.&lt;/p&gt;

&lt;p&gt;There was a cron job that could be installed to keep the virtualized
system clock in line with the host OS&amp;#8217;s hardware clock.  But it was
easy to forget to do this on new VMs and failure to do so led to much
hilarity.  The bug has been fixed in more recent versions.&lt;/p&gt;

&lt;h2&gt;An acknowledgment&lt;/h2&gt;

&lt;p&gt;This post owes a great debt to
&lt;a href="http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/" title="Falsehoods Programmers Believe About Names"&gt;Patrick McKenzie&amp;#8217;s canonical blog post about user names,&lt;/a&gt;
which I have read over and over throughout the years and from
which I have shamelessly cribbed both concept and style.  If you
haven&amp;#8217;t yet read this gem, go and do so right now.  I promise you&amp;#8217;ll
enjoy it.&lt;/p&gt;

&lt;div style="border: 2px solid #333; padding: 0 1em 1em 1em; margin-top: 1em;"&gt;
&lt;h2&gt;UPDATED: Thanks for your comments and anecdotes!&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;I&amp;#8217;d like to say thanks&lt;/strong&gt; to everyone who contributed to the comment threads about this post on &lt;a href="http://boingboing.net/2012/06/19/falsehoods-programmers-believe.html" title="Corey Doctorow called this post 'an eye-popping and mindbending riff on the malleability of time'"&gt;BoingBoing&lt;/a&gt; and &lt;a href="http://news.ycombinator.com/item?id=4128208"&gt;Hacker News&lt;/a&gt; as well as &lt;a href="http://www.reddit.com/r/programming/comments/v8s0y/falsehoods_programmers_believe_about_time/"&gt;Reddit&lt;/a&gt; and &lt;a href="http://www.metafilter.com/117073/Falsehoods-Programmers-Believe"&gt;MetaFilter&lt;/a&gt; and to &lt;a href="https://twitter.com/#!/search/realtime/falsehoods-programmers-believe-about-time"&gt;everyone on Twitter&lt;/a&gt; who shared their strange experiences with time.&lt;/p&gt;

&lt;p&gt;You have provided so many interesting edge cases I had &lt;a href="https://twitter.com/PaulAlexWilson/status/215029360778940416" title="A date calculation error concerning leap years led to a recent Windows Azure outage."&gt;forgotten about&lt;/a&gt; as well as &lt;em&gt;many&lt;/em&gt; oddities of which I wasn&amp;#8217;t aware.  For instance: in the Jewish calendar,  days &lt;a href="http://news.ycombinator.com/item?id=4130904"&gt;start at sunset not midnight&lt;/a&gt;.  And as &lt;a href="http://www.wired.com/beyond_the_beyond/2012/06/falsehoods-programmers-believe-about-time/" title="Wired: Beyond the Beyond blog by Bruce Sterling"&gt;Bruce Sterling pointed out&lt;/a&gt;, I didn&amp;#8217;t even &lt;em&gt;think&lt;/em&gt; about what happens when the computer is on a spaceship orbiting a black hole.&lt;/p&gt;

&lt;p&gt;There&amp;#8217;s more than enough material for another (longer!) post about this topic.  But first I&amp;#8217;ll have to finish reading all &amp;gt;500 of your comments as well as the wealth of &lt;a href="http://naggum.no/lugm-time.html" title="Thanks to HN user snprbob86 for pointing me to 'The Long, Painful History of Time' by Erik Naggum.  Looks great, can't wait to read it!"&gt;awesome research material&lt;/a&gt; that has been linked.&lt;/p&gt;

&lt;div style="border: 2px solid #333; padding: 0 1em 1em 1em; margin-top: 1em;"&gt;
&lt;h2&gt;UPDATED AGAIN: Read &lt;a href="http://infiniteundo.com/post/25509354022/more-falsehoods-programmers-believe-about-time-wisdom" title="More falsehoods programmers believe about time: 'wisdom of the crowd' edition"&gt;the Web&amp;#8217;s collective thoughts on More Falsehoods About Time!&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;I&amp;#8217;ve written &lt;a href="http://infiniteundo.com/post/25509354022/more-falsehoods-programmers-believe-about-time-wisdom" title="More falsehoods programmers believe about time: 'wisdom of the crowd' edition"&gt;another post collecting the &lt;em&gt;many&lt;/em&gt; other falsehoods that were suggested&lt;/a&gt; by your comments at &lt;a href="http://boingboing.net/2012/06/19/falsehoods-programmers-believe.html" title="Corey Doctorow called this post 'an eye-popping and mindbending riff on the malleability of time'"&gt;BoingBoing&lt;/a&gt; and &lt;a href="http://news.ycombinator.com/item?id=4128208"&gt;Hacker News&lt;/a&gt; as well as &lt;a href="http://www.reddit.com/r/programming/comments/v8s0y/falsehoods_programmers_believe_about_time/"&gt;Reddit&lt;/a&gt; and &lt;a href="http://www.metafilter.com/117073/Falsehoods-Programmers-Believe"&gt;MetaFilter&lt;/a&gt; and also &lt;a href="https://twitter.com/#!/search/realtime/falsehoods-programmers-believe-about-time"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks again for your enthusiasm and for the mind-boggling level of detail.  I learned a &lt;em&gt;lot&lt;/em&gt; about time in the last 24 hours.  &lt;strong&gt;Fellow nerds, I salute you.&lt;/strong&gt;&lt;/p&gt;</description><link>http://infiniteundo.com/post/25326999628</link><guid>http://infiniteundo.com/post/25326999628</guid><pubDate>Sun, 17 Jun 2012 20:09:00 -0400</pubDate><category>testing</category><category>popular</category></item><item><title>Things you should test</title><description>&lt;h2&gt;A checklist of things that are worth testing in pretty much any software system.&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;…trailing his fingers along the edge of an incomprehensible
  computer bank, he reached out and pressed an invitingly large red
  button on a nearby panel. The panel lit up with the words &amp;#8220;Please do
  not press this button again.&amp;#8221;&lt;br/&gt;&lt;cite&gt;        ~ Douglas Adams&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Software systems are complex and as such exhibit non-deterministic
behavior.  This is true of any non-trivial system. The behaviors of
even a small software product are so varied and unpredictable as to
defy complete testing.&lt;/p&gt;

&lt;p&gt;However there are general five general areas of interest that are &lt;em&gt;always&lt;/em&gt;
worth examining because they reveal mistakes with such surprising
regularity.  Specifically it&amp;#8217;s worthwhile to find out how any system
handles &lt;strong&gt;&lt;a href="http://en.wikipedia.org/wiki/Equivalence_class" title="Equivalence Classes are a concept from Set Theory that is directly applicable to software testing, especially with regard to figuring out how many unit tests are necessary in order to exercise every significant code path in a function"&gt;inputs&lt;/a&gt;, math, text, time&lt;/strong&gt; and &lt;strong&gt;system
resources.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If like me you are a software developer then it&amp;#8217;s commonly accepted
that about 50% of your time should be spent in testing rather than
writing code.  If this seems excessive think about how much time you
spent in &lt;em&gt;debugging&lt;/em&gt; the last time code you wrote was involved in a
production issue.  Then think about your level of stress.&lt;/p&gt;

&lt;p&gt;In the book &lt;a href="http://en.wikipedia.org/wiki/The_Soul_of_a_New_Machine"&gt;&lt;em&gt;The Soul of A New Machine&lt;/em&gt;&lt;/a&gt;, Tracy Kidder makes a
comment to the effect that most career programmers are pack-a-day
smokers who eventually drop dead of a heart attack.  Don&amp;#8217;t be that
guy.  Time spent testing happens during work hours, within the
parameters of an estimated project schedule that you (hopefully) got
to sign off on in advance.  If you follow the &amp;#8220;50% of development time
is testing&amp;#8221; rule then it&amp;#8217;s &lt;em&gt;possible&lt;/em&gt; that overall in the course of
your career you &lt;em&gt;may&lt;/em&gt; spend more time testing than you would have
debugging production issues if you hadn&amp;#8217;t taken the time to test.  But
even so, you will spend less time being stressed and &lt;a href="http://www.quora.com/Software-Engineering/What-distinguishes-a-good-software-engineer-from-a-great-one/answer/Irakli-Nadareishvili/comment/242923" title="The idea that long hours are necessary to build a great product is a myth, and a dangerous myth at that.  For (tragic) proof of this, one need look no further than Steve Jobs' biography."&gt;less time working
on the weekend.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And seriously, tested code is better code.  Better code means more
reliable products.  Reliability in turn leads to better
&lt;a href="http://en.wikipedia.org/wiki/Customer_experience" title="Good customer experience is what it's all about.  Without that, no one gets paid."&gt;customer experience&lt;/a&gt; because reliability engenders trust.  Trust
in turn is the foundation of the relationship that a product team
forms with its customers.  Tested code means better customer
experience which leads to products that compete more effectively in
the marketplace.  And that means you keep getting paid, which means
you get to keep writing code.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://26.media.tumblr.com/tumblr_l8qmd3W3Er1qze5g2o1_500.gif" alt="Peter Griffin pushes the forbidden button" title="Sometimes as testers our job is to NOT not push the button."/&gt;&lt;/p&gt;

&lt;h3&gt;Inputs&lt;/h3&gt;

&lt;ol&gt;&lt;li&gt;Minimum and maximum input values are always good to test.  For
instance, if a password field allows 6 to 128 characters, what actually
happens when you submit a six-character password?  What about a 128-character password?&lt;/li&gt;
&lt;li&gt;Too-high and too-low values.  What happens with a 5-character or
129-character password? Alternately, how does the system respond
to inputs equal to the the minimum and maximum integer values
allowed by the implementation language or platform?&lt;/li&gt;
&lt;li&gt;Invalid values such as &lt;code&gt;null&lt;/code&gt; and &lt;code&gt;NaN&lt;/code&gt;. Strings instead of
integers, arrays instead of strings.&lt;/li&gt;
&lt;li&gt;Inputs that might break the underlying code.  For a Web app examples
would include &lt;a href="http://xkcd.com/327/" title="Little Bobby Tables, we call him."&gt;SQL injection&lt;/a&gt; and
&lt;a href="http://ha.ckers.org/xss.html" title="A terrifying compendium of XSS exploits"&gt;cross-site scripting attacks&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Empty inputs such as a blank user name field or a transaction
record in which none of the fields contain any information.  For
unit tests, submitting zero or an empty string instead of a valid parameter
can sometimes yield interesting results.&lt;/li&gt;
&lt;li&gt;Inputs that are too big, perhaps even
&lt;a href="http://en.wikipedia.org/wiki/Buffer_overflow" title="buffer overflows are one of the interesting behaviors that can be triggered when a program doesn't manage system memory in a defensive fashion"&gt;too big to conveniently fit into available memory&lt;/a&gt;…&lt;/li&gt;
&lt;li&gt;Too many inputs or not enough inputs.  For a unit test this is
simply a matter of creating an incorrect function signature.  For a
Web app it might involve submitting too many POST parameters or
selectively deleting parts of a URL&amp;#8217;s  query string.&lt;/li&gt;
&lt;/ol&gt;&lt;h3&gt;Math&lt;/h3&gt;

&lt;ol&gt;&lt;li&gt;&lt;a href="http://www.theregister.co.uk/2011/09/22/software_bug_fine/" title="The story of a rounding error that incurred $217 million in lost revenue."&gt;Decimal math is hard.&lt;/a&gt;  Verify that integers are treated correctly
in a floating-point context, and vice versa.&lt;/li&gt;
&lt;li&gt;Repeating decimals.  Does the system treat &lt;code&gt;0.666&lt;/code&gt; differently from
&lt;code&gt;0.665&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;Rounding.  If you put &lt;code&gt;3 * 1.005&lt;/code&gt; into the system, do you
get &lt;code&gt;3.015&lt;/code&gt; back out? (This is &lt;em&gt;not&lt;/em&gt; &lt;a href="http://jibbering.com/faq/#binaryNumbers" title="Why does simple decimal arithmetic give strange results? In the comp.lang.javascript FAQ"&gt;the default behavior&lt;/a&gt;
in JavaScript, for instance.)&lt;/li&gt;
&lt;li&gt;Type coercion. Is an input of &lt;code&gt;23&lt;/code&gt; treated differently than an input of
&lt;code&gt;"23"&lt;/code&gt;?  That is: is a numeric input treated differently than
a string containing a numeric value?&lt;/li&gt;
&lt;li&gt;Units of measurement.  If you specify that the thrusters should
fire with a force of 267 Newtons, does the guidance system actually
interpret that value as Newtons?
&lt;a href="http://en.wikipedia.org/wiki/Mars_Climate_Orbiter#Cause_of_failure" title="in 1999, the Mars climate orbiter crashed due to a miscalculation caused by confusion over metric values that were inadvertently interpreted as English measurement values"&gt;Or is it interpreted as 267 foot-pounds?&lt;/a&gt; &lt;em&gt;(Hat tip
to Sebastian Delmont for
&lt;a href="https://twitter.com/sd/status/214358019432128513"&gt;pointing out that units of measurement are worth testing.&lt;/a&gt;)&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Units of currency.  There&amp;#8217;s going to be a problem if an input of
£23.00 is stored in the database as $23.00.&lt;/li&gt;
&lt;/ol&gt;&lt;h3&gt;Text&lt;/h3&gt;

&lt;ol&gt;&lt;li&gt;&lt;em&gt;&lt;a href="http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/" title="Falsehoods Programmers Believe About Names"&gt;User names&lt;/a&gt;&lt;/em&gt; are perhaps the single most interesting class of text
that can be submitted as input to a computer program.  At a
minimum, the system shouldn&amp;#8217;t break when names contain apostrophes,
hyphens or spaces.&lt;/li&gt;
&lt;li&gt;Passwords are also interesting.  Does the maximum password length
allow for &lt;a href="http://www.infoworld.com/d/security-central/password-size-does-matter-531" title="password length is more important than password complexity"&gt;enough entropy&lt;/a&gt;?  Are plain-English
&lt;a href="http://xkcd.com/936/" title="correct horse battery staple"&gt;passphrases&lt;/a&gt; disallowed because they don&amp;#8217;t contain
numbers?  Are passwords stored as &lt;a href="http://www.codinghorror.com/blog/2007/09/youre-probably-storing-passwords-incorrectly.html" title="adding a random string to passwords before hashing makes the stored passwords much more resilient against rainbow table attacks"&gt;salted hashes&lt;/a&gt;?&lt;/li&gt;
&lt;li&gt;Are Unicode inputs treated differently than ASCII?&lt;/li&gt;
&lt;li&gt;On the Web, are HTML-encoded entities properly converted to
characters and vice versa?  What about URL-encoded characters?&lt;/li&gt;
&lt;/ol&gt;&lt;h3&gt;Time&lt;/h3&gt;

&lt;ol&gt;&lt;li&gt;&lt;a href="http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time" title="In fact time creates so many problems in software that I wrote a whole other post about it."&gt;Time zones are a bitch.&lt;/a&gt;  Try switching the system time from GMT to
EST and see what happens.&lt;/li&gt;
&lt;li&gt;Test on the first and last day of daylight savings time.  The
system &lt;em&gt;does&lt;/em&gt; allow you to mock out the first and last day of 
daylight savings time, right?&lt;/li&gt;
&lt;li&gt;Like with unit tests, boundary conditions can reveal
interestingness.  How does the system behave between &lt;code&gt;23:59&lt;/code&gt; and
&lt;code&gt;00:01&lt;/code&gt;?  What about during the hour between &lt;code&gt;00:00&lt;/code&gt; and &lt;code&gt;00:59&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;Be very aware of dates and times that are &amp;#8220;special&amp;#8221; to your
system. For instance, if you have a fake user for testing
purposes, how does the system respond when it&amp;#8217;s that user&amp;#8217;s birthday?&lt;/li&gt;
&lt;/ol&gt;&lt;h3&gt;System resources&lt;/h3&gt;

&lt;ol&gt;&lt;li&gt;What if there&amp;#8217;s half as much available memory as the system&amp;#8217;s designers expect?&lt;/li&gt;
&lt;li&gt;In a distributed system, what happens if half the nodes become unavailable?&lt;/li&gt;
&lt;li&gt;In a service-oriented architecture, what happens if one of the
services becomes unavailable?  What if it&amp;#8217;s only partially available?&lt;/li&gt;
&lt;li&gt;What happens if the network is slow?&lt;/li&gt;
&lt;li&gt;What happens when the database is down?&lt;/li&gt;
&lt;li&gt;What happens when the database is &lt;em&gt;empty?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;What happens if the cache is disabled?  What about the CDN?&lt;/li&gt;
&lt;li&gt;What if load on the system spikes to ten times normal?&lt;/li&gt;
&lt;li&gt;What if load on the system drops to zero?&lt;/li&gt;
&lt;li&gt;For long-running operations, what happens if you power cycle the machine before the operation is complete?&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;&lt;img src="http://13.media.tumblr.com/tumblr_kpn54hYhcv1qa2i2xo1_400.gif" alt="A flashing red sign reads: COMPUTER MALFUNCTION"/&gt;&lt;/p&gt;

&lt;h3&gt;Two digressions: names and time&lt;/h3&gt;

&lt;p&gt;When it comes to Web apps, there are two areas that seem to cause more
pain than any other: &lt;a href="http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/" title="Falsehoods Programmers Believe About Names"&gt;people&amp;#8217;s names&lt;/a&gt; and the &lt;a href="http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time" title="In fact time creates so many problems in software that I wrote a whole other post about it."&gt;time&lt;/a&gt;.  These elements are
both common, essential to the correct functioning of a system, and
shockingly difficult to get right.&lt;/p&gt;

&lt;h4&gt;People&amp;#8217;s names&lt;/h4&gt;

&lt;blockquote&gt;
  &lt;p&gt;There are only two hard problems in Computer Science: cache
  invalidation, naming things and off-by-one-errors.&lt;br/&gt;&lt;cite&gt;        ~ Phil Karlton&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My favorite real-world case of a system finding a user&amp;#8217;s name
&amp;#8220;unacceptable&amp;#8221; involved a person whose first name was &lt;em&gt;9.&lt;/em&gt; Not &amp;#8220;Nine,&amp;#8221;
mind you but the numeral &amp;#8220;9&amp;#8221;.&lt;/p&gt;

&lt;p&gt;I have a friend named &lt;em&gt;Sonnet&lt;/em&gt; (no middle name, no last name) who is
unable to complete registration flow for most Web sites.  I myself
have occasionally been rejected by a registration form because I have no middle
name.&lt;/p&gt;

&lt;p&gt;When I used to build internal tools for &lt;a href="http://codeascraft.etsy.com/2011/04/20/divide-and-concur/" title="Etsy's CI system and automated testing described in Code As Craft: the Etsy Engineering Blog"&gt;Etsy&lt;/a&gt; I worked
with a plethora of excellently-named hackers such as
&lt;a href="http://pinterest.com/mdnetto/" title="Michelle D'Netto on Pinterest"&gt;Michelle D&amp;#8217;Netto&lt;/a&gt;, &lt;a href="https://twitter.com/kellan" title="Kellan Elliott-McCrea on Twitter"&gt;Kellan Elliot-McCrea&lt;/a&gt; and of
course &lt;a href="https://twitter.com/#!/i8ramin" title="Ramin Bozorgzadeh on Twitter"&gt;Ramin Bozorgzadeh&lt;/a&gt;. Ramin quickly became my test user
of choice because his surname was almost always too long for the
single line allotted to display it, thus breaking the UI.  And in at
least one case an intranet tool (which had been around for several
years at that point) was brought down hard by the introduction of a
user name that contained an apostrophe.  If you&amp;#8217;re not as fortunate in
the naming scheme of your alpha testers then take care to construct
your fixtures appropriately.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/" title="Falsehoods Programmers Believe About Names"&gt;Patrick McKenzie wrote the canonical blog post on the intricacies of testing user names.&lt;/a&gt;
Highly recommended (and highly amusing) reading.&lt;/p&gt;

&lt;h4&gt;Never, ever use the system time in tests&lt;/h4&gt;

&lt;blockquote&gt;
  &lt;p&gt;King and villein, lad and lass,&lt;br/&gt;
  All answer to the hourglass.&lt;br/&gt;&lt;cite&gt;        ~ trad.&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Tests that use the system time implicitly test the system clock of
whatever machine happens to be running the tests.  Speaking from long
experience, I can attest that this approach can only lead to
unreliable tests and &lt;em&gt;extreme debugging pain.&lt;/em&gt; If there is a test that
&lt;em&gt;must&lt;/em&gt; rely on the system clock then &lt;strong&gt;it is better to go without
implementing the test&lt;/strong&gt; than it is to expose yourself to the lost time
and frustration that running such a test would surely incur on you and
your team.&lt;/p&gt;

&lt;p&gt;So, the system you are testing &lt;em&gt;does&lt;/em&gt; allow you to mock out &lt;em&gt;all&lt;/em&gt; of
the necessary times of day and times of year.  Right?  I hope so
because &lt;strong&gt;if you&amp;#8217;re using the system time in tests, you are doing it
completely wrong.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And in my humble opinion, if you&amp;#8217;re using the system time in tests
because the system you are testing won&amp;#8217;t allow you to mock the time,
you aren&amp;#8217;t the only one doing it wrong &amp;#8212; the system itself is
fundamentally broken.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://30.media.tumblr.com/tumblr_l8dh1fEn6y1qay4v4o1_500.gif" alt="Gromit the dog sits at a control panel filled with blinking lights and buttons." title="Mistakes not caught in testing will be caught in production. That's OK, we're engineers. We can handle it. But we'd rather not!"/&gt;&lt;/p&gt;

&lt;h3&gt;Good hunting&lt;/h3&gt;

&lt;p&gt;Pretty much every bullet point on each checklist above was drawn from
my own direct experience with a mistake that was found either in
development or in production.  The cost of such knowledge was at the
very least some frustration for myself and in other cases a lot of stress and
lost time for many people on my team.  But as my career has progressed
and I&amp;#8217;ve moved to larger and larger projects, it&amp;#8217;s been really useful
to have this information in my head.  I like to think I design better
software because I&amp;#8217;ve been burned in the past.&lt;/p&gt;

&lt;p&gt;I hope this checklist helps you to find mistakes in the design and
implementation of your own systems as well. I hope &lt;em&gt;you&lt;/em&gt; at least will
find most of them before they&amp;#8217;re caught by your customers in
production.  Because as software engineers, a clean, well-functioning
system is the basic foundation of the trust that our users put in us
and in the products we deliver.&lt;/p&gt;</description><link>http://infiniteundo.com/post/25230828820</link><guid>http://infiniteundo.com/post/25230828820</guid><pubDate>Sat, 16 Jun 2012 12:15:00 -0400</pubDate><category>testing</category></item><item><title> Rapid Infrastructure: Tools You Can Use Even If You Only Have One Line Of Code</title><description>&lt;p&gt;There&amp;#8217;s an old joke that goes something like this:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Proposition one: all programs have bugs.&lt;/p&gt;
  
  &lt;p&gt;Proposition two: all programs can be shortened by one line.&lt;/p&gt;
  
  &lt;p&gt;Conclusion: every program can be reduced to one line of buggy code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Corny, I know ;-;)&lt;/p&gt;

&lt;p&gt;But hey, there &lt;em&gt;is&lt;/em&gt; a point in the life of every piece
of software when the entire system consists of one line of code.
That time is at the very beginning of a project, when one has just typed
the first bit of code into one&amp;#8217;s text editor.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/cayusa/522473179/" title="Spider - 1 by Cayusa, on Flickr"&gt;&lt;img src="http://farm1.staticflickr.com/235/522473179_31d14769ac_n.jpg" width="320" height="256" alt="Spider - 1"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You might be wondering: why are we
talking about projects that contain only one line of code?  How could
automation possibly help there?  And wouldn&amp;#8217;t it be overkill to set up
tooling to supports a trivially small, new project?&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ll explain how two automated tools can help you maintain a
project, even at the point where you&amp;#8217;ve just typed your first line of
code.  These tools are &lt;em&gt;code review&lt;/em&gt; and &lt;em&gt;static analysis.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;Start By Establishing A Culture Of Code Review&lt;/h4&gt;

&lt;p&gt;Recently I sat and talked with &lt;a href="https://twitter.com/kastner"&gt;Erik Kastner&lt;/a&gt;
about his thoughts on code review and testing.  Erik&amp;#8217;s a thoughtful,
experienced guy and after working with him for a couple of years I
have found that his opinions have become very important to me.  Erik
says great stuff like &amp;#8220;code review is just reading someone else&amp;#8217;s code
&lt;em&gt;and understanding it&lt;/em&gt; before it ships.&amp;#8221;&lt;/p&gt;

&lt;p&gt;That&amp;#8217;s one of the things I like about Kastner &amp;#8212; he does more than just propound his
methodology. When Erik talks about how he thinks software engineering
should or shouldn&amp;#8217;t work, he always &lt;em&gt;qualifies&lt;/em&gt; his statements.  And
there can be some pretty surprising insights wrapped up in those
qualifications.&lt;/p&gt;

&lt;p&gt;So let&amp;#8217;s look at this statement again:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Code review means reading &lt;em&gt;and understanding&lt;/em&gt; someone else&amp;#8217;s code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This implies that if you and I are working on a project together, you&amp;#8217;re
going to read my diffs before I commit or merge them into trunk.
We might be doing the review in &lt;a href="http://en.wikipedia.org/wiki/FishEye_(software)"&gt;FishEye&lt;/a&gt;
within a &lt;a href="http://help.github.com/send-pull-requests/"&gt;GitHub pull request&lt;/a&gt;,
or you might just be looking at my commits in our &lt;a href="http://en.wikipedia.org/wiki/Revision_control"&gt;SCM&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But I expect you to do more than just &lt;em&gt;read&lt;/em&gt; my changesets.  I also should
expect you to fully &lt;em&gt;comprehend&lt;/em&gt; how the diffs I&amp;#8217;m showing you are
going to change the behavior of the system.  Like many of Kastner&amp;#8217;s
qualifications to software methodologies, this is a subtle but large
distinction.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/daveblog/2050611763/" title="You need to clone out this shadow here by Daveblog, on Flickr"&gt;&lt;img src="http://farm3.staticflickr.com/2026/2050611763_649ff6bb8c_n.jpg" width="320" height="256" alt="You need to clone out this shadow here"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ideally every changeset I write gets reviewed by someone else before
it goes to production.  This is the practice at a lot of large,
successful organizations like Google and the JPL.  Having a human
review every changeset does impose an upper limit on how fast you can
deploy code to production.  For a new, relatively small project, you
might feel that reviewing every changeset is too heavyweight.  And you
might be right.  But keep in mind that it&amp;#8217;s a lot easier to put this
kind of process in place at the beginning than it is to wait until
your application is mature &amp;#8212; and you&amp;#8217;re &lt;em&gt;definitely&lt;/em&gt; going to want a
code review process in place at that point.&lt;/p&gt;

&lt;h4&gt;Static Analysis&lt;/h4&gt;

&lt;p&gt;Now consider the case where I have written the following one line of
code and I ask you to review it.  This is a trivial case of course,
but I hope it&amp;#8217;s still illustrative of why you should spend the time to
set up these tools before you write a single line of code.  Anyway,
here&amp;#8217;s my changeset, would you review it before I push it to prod?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php

echo "hello world''
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Did you catch both of the errors in my code?  Probably you did.  And
I&amp;#8217;m sure you noticed the missing semicolon immediately.  But did it
take you just a moment longer to realize there was something wrong
with that closing double quote?  If it did, then you were experiencing
a trivial increase in &lt;a href="http://www.joelonsoftware.com/articles/fog0000000022.html"&gt;cognitive load&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As our application gets larger and my changesets grow in complexity,
you&amp;#8217;re going to have to endure a greater and greater amount of
cognitive load every time you review and debug one of my changesets.  That&amp;#8217;s not
great.  You&amp;#8217;re a good hacker and our project is going to win because
you&amp;#8217;re using your whole brain to think about solving &lt;a href="http://www.etsy.com/listing/62336793/we-can-do-hard-things-distressed-sign-in"&gt;hard problems&lt;/a&gt;.
It&amp;#8217;s too bad that instead our new code review process is causing you
to fill your brain with thoughts about whether or not I got my
punctuation right.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/skellner/6140031987/" title="Die perfekte Welle by no, on Flickr"&gt;&lt;img src="http://farm7.staticflickr.com/6158/6140031987_92f9fddd31_n.jpg" width="320" height="213" alt="Die perfekte Welle"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Besides, checking other people&amp;#8217;s syntax is boring drudge work and &lt;a href="http://www.catb.org/~esr/faqs/hacker-howto.html#believe3"&gt;drudgery is evil.&lt;/a&gt;
So it&amp;#8217;s actually really important that we take a little bit of time at
the beginning of our project to  make sure that code review imposes
as little unnecessary cognitive cost as possible.&lt;/p&gt;

&lt;p&gt;Both of the errors I made above actually cause the PHP interpreter to
barf. So by induction, there must be a way to catch those errors
programmatically.  And of course there are &lt;a href="http://stackoverflow.com/questions/378959"&gt;several&lt;/a&gt; 
open source tools to help us do exactly that.  But the simplest option is to
just use the PHP interpreter&amp;#8217;s built-in syntax checker:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;php -l index.php

Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in foo.php on line 3
Errors parsing index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Great.  Just by running &lt;code&gt;php -l&lt;/code&gt; on my code &lt;em&gt;before&lt;/em&gt; you review it, you can
now avoid winding up as a human syntax-checker.  This saves us both
time and frustration as we continue to work on our project.  Even
better, I could run the syntax check on my own code before I send it
over to you for review.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s worthwhile for us to informally agree that we won&amp;#8217;t bother
reviewing any code that doesn&amp;#8217;t pass a syntax check.&lt;/p&gt;

&lt;h4&gt;Is It Worth Automating Static Analysis At This Point?&lt;/h4&gt;

&lt;p&gt;So we&amp;#8217;ve made an agreement to always run static analysis on our code
before asking someone else to review it.  This implies that any code
we deploy to production will have been run through static analysis at
least once.  Even though our project and our team are small, we&amp;#8217;ve
managed to put in place some important cornerstones on which we can
build a healthy engineering culture.&lt;/p&gt;

&lt;p&gt;We could codify
our new agreement by writing it down in our wiki (if we have one).
Another way to codify our contract would be to set up a &lt;a href="http://en.wikipedia.org/wiki/Continuous_integration"&gt;CI server&lt;/a&gt;
and configure it to fail the build if anyone commits a file that
doesn&amp;#8217;t pass the syntax check.  Yet another way to do this would be
for each of us to run &lt;a href="https://github.com/mynyml/watchr"&gt;watchr&lt;/a&gt; on
our laptops, and configure it to throw up a Growl alert whenever the
syntax check fails.  We can pick one of these automated solutions,
spend a couple of hours setting it up and get its benefit throughout
the life of our project.  So that seems like a worthwhile thing to do,
even though so far we only have one line of code.&lt;/p&gt;</description><link>http://infiniteundo.com/post/22292945729</link><guid>http://infiniteundo.com/post/22292945729</guid><pubDate>Wed, 02 May 2012 21:18:00 -0400</pubDate><category>infrastructure</category><category>static analysis</category><category>code review</category></item><item><title>Intrinsic and Incidental Complexity</title><description>&lt;p&gt;There is a very convincing argument to be made that feature-complete
software is ultimately more valuable than a readable codebase.
That there is more value in what an application &lt;em&gt;does&lt;/em&gt; than in how it
is put together.  Perhaps it is fair to consider architecture,
including the comprehensibility of a program as source code, to be of
some benefit but still orthogonal to a program&amp;#8217;s business value?
After all, it&amp;#8217;s incontrovertibly true that the most important aspect
of developing software is
&lt;a href="http://www.folklore.org/StoryView.py?story=Pirate_Flag.txt" title="Real artists ship. ~Steve Jobs"&gt;&lt;em&gt;shipping it to the customer.&lt;/em&gt;&lt;/a&gt; 
So then isn&amp;#8217;t it the case that the
&lt;em&gt;real&lt;/em&gt; value is all in what the software &lt;em&gt;does?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/arandalasch/5882749724/" title="The Morning Line Istanbul by Aranda\Lasch, on Flickr"&gt;&lt;img src="http://farm6.staticflickr.com/5108/5882749724_34ae47b9cc_n.jpg" width="320" height="213" alt="The Morning Line Istanbul"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Why is so much value placed on delivering readable code?&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://twitter.com/therealghorvath"&gt;Greg Horvath&lt;/a&gt; recently showed me a
&lt;a href="http://spinroot.com/gerard/pdf/P10.pdf" title="The Power of Ten, by Gerard J. Holzmann"&gt;paper on JPL coding standards&lt;/a&gt; (PDF)
that encouraged eschewing some
pretty basic strategies (recursion, dynamic memory allocation) on the
grounds that &lt;em&gt;they lead to code that is somewhat more difficult to run
through static analysis.&lt;/em&gt;  The takeaway for me was that NASA cares
a &lt;em&gt;lot&lt;/em&gt; about being able to tell what the code is &lt;em&gt;intended&lt;/em&gt; to do,
without actually running it.&lt;/p&gt;

&lt;p&gt;So while shipping feature-complete software is obviously important, it
seems that shipping &lt;em&gt;readable&lt;/em&gt; software is really important,
too.  Why?  I think it&amp;#8217;s because comprehensibility of components
&lt;a href="http://www.kitchensoap.com/2011/09/08/fault-tolerance-and-protection/" title="John Allspaw on fault protection strategies in aerospace and how those might map to building the Web"&gt;contributes to the resiliency of a system overall.&lt;/a&gt;
A prototype that
works is good.  A prototype that can evolve rapidly is even better.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/arandalasch/3480659883/" title="The Morning Line by Aranda\Lasch, on Flickr"&gt;&lt;img src="http://farm4.staticflickr.com/3618/3480659883_c2ea25a5fa_n.jpg" width="320" height="213" alt="The Morning Line"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Complexity is an inherent property of software. Comprehensibility is not.&lt;/h4&gt;

&lt;p&gt;It&amp;#8217;s interesting to note that &lt;a href="http://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD1012.html" title="Real Mathematicians Don't Prove"&gt;Dijkstra espoused&lt;/a&gt;
a readable-code-over-feature-completeness approach to software
architecture.  He contrasted the two mindsets as &amp;#8220;postulational&amp;#8221; and
&amp;#8220;operational,&amp;#8221; respectively.  &lt;em&gt;Postulational&lt;/em&gt; meaning one can
postulate about what a program does just by reading the source.
&lt;em&gt;Operational&lt;/em&gt; meaning that one bases one&amp;#8217;s expectations about what a
program will do, on (educated) assumptions about what operations will
be carried out when that program is executed.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1036.html" title="By evoking the need for deep conceptual hierarchies, the automatic computer confronts us with a radically new intellectual challenge that has no precedent in our history"&gt;Dijkstra also once pronounced&lt;/a&gt;
that software is the most complex product ever produced by human
effort.  When delivering &lt;em&gt;any&lt;/em&gt; non-trivial software application, some
degree of complexity is intrinsic to the task.  And obviously,
concepts that are complex do not lend themselves to implementations
that are easily readable.  So maintaining comprehensibility in
the components of a complex system, turns out to be a rather difficult
problem.&lt;/p&gt;

&lt;p&gt;Incidental complexity, once identified, can eventually be
&lt;a href="http://c2.com/cgi/wiki?WhatIsRefactoring"&gt;factored out&lt;/a&gt;, leading to
code that is more readable overall.  Therefore it is valuable to
take the (sometimes considerable amount of) time to &lt;a href="http://www.cs.utexas.edu/~EWD/transcriptions/EWD13xx/EWD1304.html" title="Dijkstra again: while we all know that unmastered complexity is at the root of the misery, we do not know what degree of simplicity can be obtained, nor to what extent the intrinsic complexity of the whole design has to show up in the interfaces"&gt;distinguish between intrinsic and incidental complexity,&lt;/a&gt;
and to continually either avoid or remove the incidental complexities
that over time can make a codebase harder and harder to read.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/arandalasch/3328924748/" title="The Evening Line by Aranda\Lasch, on Flickr"&gt;&lt;img src="http://farm4.staticflickr.com/3661/3328924748_2ed6594a5d_n.jpg" width="320" height="240" alt="The Evening Line"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;The most interesting part of delivering software is watching what users do with it.&lt;/h4&gt;

&lt;p&gt;In order to provide a satisfying user experience
over the long term, any software needs to be able to &lt;a href="http://www.uie.com/brainsparks/2007/07/26/uietips-article-debunking-the-myths-of-innovation-an-interview-with-scott-berkun/" title="the Flickr codebase began as a game, not a photo-sharing Web site"&gt;adapt&lt;/a&gt;
iteratively and rapidly to the unpredictable needs and desires of its
user base.  Resilient systems are best able to adapt, because successful
adaptation requires constant readjustment in the face of new
circumstances.  So there is considerable value in preserving the
readability of source code throughout the life of a system.&lt;/p&gt;</description><link>http://infiniteundo.com/post/19910636303</link><guid>http://infiniteundo.com/post/19910636303</guid><pubDate>Sun, 25 Mar 2012 16:06:00 -0400</pubDate><category>static analysis</category></item></channel></rss>
