844: Good Code

Explain xkcd: It's 'cause you're dumb.
(Difference between revisions)
Jump to: navigation, search
(Polish.)
Line 1: Line 1:
 
{{comic
 
{{comic
 
| number    = 844
 
| number    = 844
| date      = 2011-01-07
+
| date      = January 7, 2011
 
| title    = Good Code
 
| title    = Good Code
 
| image    = good_code.png
 
| image    = good_code.png
Line 12: Line 12:
 
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.
 
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 [http://en.wikipedia.org/wiki/Infinite_loop infinite loop] (or more precisely, 2 possible loops and 1 forced loop) in the flowchart itself.
+
Additionally, the humorous point is being further emphasized for the primary target audience, programmers, by using an {{w|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.
 
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.
Line 18: Line 18:
 
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 [http://www.gnu.org/software/hurd/ 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.)
 
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 [http://www.gnu.org/software/hurd/ 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 [http://en.wikipedia.org/wiki/In-joke 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 "[http://en.wikipedia.org/wiki/Goto 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.
+
Finally, the transcript of this comic is itself somewhat humorous (an additional [http://en.wikipedia.org/wiki/In-joke 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 "{{w|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.
 
+
--[[User:Jamescat|Jamescat]] ([[User talk:Jamescat|talk]]) 09:28, 6 December 2012 (UTC)
+
  
 
==Transcript==
 
==Transcript==
<!-- The transcript can be found in a hidden <div> element on the xkcd comic's html source, with id "transcript".
+
:((The comic is a flowchart.  In order to explain this in text, follow the line numbers. Options follow on new lines without numbers.))
  -- Tip: Use colons (:) in the beginning of lines to preserve the original line breaks.
+
:How to write good code.
  -- Any actions or descriptive lines in [[double brackets]] should be reduced to [single brackets] to avoid wikilinking
+
:((10.)) Start Project. ((Go to 20.))
  -- Do not include the title text again here -->
+
 
: ((The comic is a flowchart.  In order to explain this in text, follow the line numbers. Options follow on new lines without numbers.))
+
:((20.)) Do things right or do them fast?  
: How to write good code.
+
:Fast ((Go to 30.))   
: ((10.)) Start Project. ((Go to 20.))
+
:Right ((Go to 40.))
: &nbsp;
+
 
: ((20.)) Do things right or do them fast?  
+
:((30.)) Code fast. ((Go to 35.))
: Fast ((Go to 30.))   
+
 
: Right ((Go to 40.))
+
:((35.)) Does it work yet?  
: &nbsp;
+
:No ((Go to 30.))   
: ((30.)) Code fast. ((Go to 35.))
+
:Almost, but it's become a mass of kludges and spaghetti code. ((Go to 50.))
: &nbsp;
+
 
: ((35.)) Does it work yet?  
+
:((40.)) Code well. ((Go to 45.))
: No ((Go to 30.))   
+
 
: Almost, but it&#39;s become a mass of kludges and spaghetti code. ((Go to 50.))
+
:((45.)) Are you done yet?
: &nbsp;
+
:No. ((Go to 40.))
: ((40.)) Code well. ((Go to 45.))
+
:No, and the requirements have changed. ((Go to 50.))
: &nbsp;
+
 
: ((45.)) Are you done yet?
+
:((50.)) Throw it all out and start over. ((Go to 10.))
: No. ((Go to 40.))
+
: No, and the requirements have changed. ((Go to 50.))
+
: &nbsp;
+
: ((50.)) Throw it all out and start over. ((Go to 10.))
+
: &nbsp;
+
: ((60.)) ? ((Go to 70.))
+
: &nbsp;
+
: ((70.)) Good code.
+
  
{{comic discussion}}
+
:((60.)) ? ((Go to 70.))
<!-- Include any categories below this line-->
+
  
 +
:((70.)) Good code.
 +
{{comic discussion}}
 
[[Category:Programming]]
 
[[Category:Programming]]

Revision as of 12:08, 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.

Explanation

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.

Transcript

((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!

Discussion

No comments yet.
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox

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?