844: Good Code

Explain xkcd: It's 'cause you're dumb.
(Difference between revisions)
Jump to: navigation, search
m (Explanation changed to note that there may be up to 3 loops in the flowchart)
Line 55: Line 55:
{{comic discussion}}  
{{comic discussion}}  
<!-- Include any categories below this line-->
<!-- Include any categories below this line-->

Revision as of 11:48, 6 December 2012

Good Code
You can either hang out in the Android Loop or the HURD loop.
Title text: You can either hang out in the Android Loop or the HURD loop.


The comic references the common meme of programmers that one can't actually write good code. Either the code is done quickly with shoddy "code style", weak logical structure, or any number of other kludges and hacks (which causes maintenance of the code to be a programmer's nightmare)... or else it is written well and beautifully structured, but can never be completed before changes in the situation cause the original code design to be insufficient for one or multiple reasons.

Either situation eventually leads to the need to completely start from scratch, designing and writing the program's code all over again. Of course, the writing of this new program is also locked in the perpetual cycle of choosing between ugly/bad code that works marginally well, or good/pretty code that never gets completed before being obsolete.

Additionally, the humorous point is being further emphasized for the primary target audience, programmers, by using an infinite loop (or more precisely, 2 possible loops and 1 forced loop) in the flowchart itself.

Also, of particular note, is the fact that Randall (the author) drives home the point of the inescapability of the infinite loop(s) by the use of the additional, disconnected, and logically unreachable portion of the flowchart. This disconnect points out that the only way to actually get to "Good Code" using the flow chart would be to follow a path of actions -- which does not start at the proscribed place -- for which there is only an unknown (and possibly unknowable) starting action ("?") which no one has ever discovered previously.

The image title text, "You can either hang out in the Android Loop or the HURD loop," makes a further dig at each community, claiming that Android developers are always choosing fast, ugly code, while HURD developers are always choosing to "do things right" but can therefore never finish their project at all. (The GNU Hurd project, which aims to create the kernel (i.e. lower-level portions) of the "GNU operating system," while building on a number of fundamentally "beautiful" concepts, has nonetheless been in development for many years with little forward motion towards actual usability by anyone except the developers themselves.)

Finally, the transcript of this comic is itself somewhat humorous (an additional inside joke, if you will) in that it converts the flowchart into a simple list of instructions (aka pseudo-code) using numbered lines as reference points for identifying which instruction to read and follow next. This process is basically identical to the oft-maligned programming technique of using so-called "goto loops." -- Furthermore, there is also a slight cross-reference between infinite loops and goto loops which is probably being referenced, in that goto loops are often criticized (whether accurately or not) as being more likely to create unintended infinite loops in code... primarily because of the difficulty inherent in keeping track of possible entry and exit paths, especially when making edits to the code at a later time.

--Jamescat (talk) 09:28, 6 December 2012 (UTC)


((The comic is a flowchart. In order to explain this in text, follow the line numbers. Options follow on new lines without numbers.))
How to write good code.
((10.)) Start Project. ((Go to 20.))
((20.)) Do things right or do them fast?
Fast ((Go to 30.))
Right ((Go to 40.))
((30.)) Code fast. ((Go to 35.))
((35.)) Does it work yet?
No ((Go to 30.))
Almost, but it's become a mass of kludges and spaghetti code. ((Go to 50.))
((40.)) Code well. ((Go to 45.))
((45.)) Are you done yet?
No. ((Go to 40.))
No, and the requirements have changed. ((Go to 50.))
((50.)) Throw it all out and start over. ((Go to 10.))
((60.)) ? ((Go to 70.))
((70.)) Good code.
Comment.png add a comment!


No comments yet.
Personal tools


It seems you are using noscript, which is stopping our project wonderful ads from working. Explain xkcd uses ads to pay for bandwidth, and we manually approve all our advertisers, and our ads are restricted to unobtrusive images and slow animated GIFs. If you found this site helpful, please consider whitelisting us.

Want to advertise with us, or donate to us with Paypal or Bitcoin?