Editing 1695: Code Quality 2

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 8: Line 8:
  
 
==Explanation==
 
==Explanation==
This comic is the second in the [[:Category:Code Quality|Code Quality]] series:
+
The comic is a continuation of [[1513: Code Quality]] the first [[:Category:Code Quality|Code Quality]] series, in which we see [[Ponytail]] being introduced to the {{w|source code}} [[Cueball]] has written, and where he is warning her that he is self-taught so his code probably won't be written the way she is used to. In the first comic she continues to describe poetically the total mess of a code she encounters, using references to a child building houses, recipes created by corporate lawyers or the transcript of a couple arguing at IKEA, as well as using emojis in the code (title text).
* [[1513: Code Quality]]
 
* [[1695: Code Quality 2]]
 
* [[1833: Code Quality 3]]
 
* [[1926: Bad Code]]
 
* [[2138: Wanna See the Code?]]
 
  
Although [[Cueball]] is not seen in this comic, we can surmise that he is speaking from off-panel based on continuity with [[1513: Code Quality]].
+
In this comic she continues this trend in four more abusive comments, after starting this sequel with a short remark on how she hates reading Cueball’s code. Cueball is not even shown in this comic, only replying twice off-panel, but as the title makes it clear this is a sequel there can be no doubt that it is Cueball. With the four remarks here as well as a fifth in the title text, she has now managed to make no fewer than nine derogatory remarks on Cueball's programming skills.
  
As in the first comic in the series, we again see [[Ponytail]] being introduced to the messy {{w|source code}} Cueball has written. This comic evidently takes place some time later, as Ponytail now appears to be familiar with Cueball's code, and dreads reading it.
+
In the second panel Ponytail makes a reference to "OCR" ({{w|Optical Character Recognition}}), a technique for recognizing text in a picture using software. In this case she is referring to a picture of a {{w|Scrabble}} game, which is a popular word-making game in which players have a pseudo-randomized set of letters and must arrange them on a grid to form interlocking words. OCR software is notoriously imperfect at the time of writing, and the criss-crossing semi-random words on a Scrabble board fed through an OCR program would likely produce dubious results, certainly not fit for current code standards.
  
In this comic she continues the trend started in the first comic by using a parade of vivid similes to convey the incomprehensible nature of Cueball's code.
+
Ponytail observes that Cueball’s code includes the [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords JavaScript reserved words] more often than a typical Scrabble board would, a concession that the code looks at least vaguely code-like. Reserved words such as ‘function’, ‘if’ and ‘return’ are fundamental building blocks of code, and most code uses them often. (They are called “reserved” because those words are reserved for their actual meanings such as defining a function – programmers may not create variables with those names.) As for why “triple points” translates to a prevalence of those words, Scrabble's point system is based on the value of individual letters, combined with certain modifier squares on the game board which can boost points. "Triple points" is the highest class of modifier available in the game (though it can be for triple points on a specific letter, or the entire word) and is highly-sought-after by players.
  
===OCR, Scrabble, and Javascript-reserved words===
+
The third panel continues Ponytail's rant, this time referencing naval weather forecasts, avian interference and indentation. A weather forecast is a complex, multidimensional array of data used in predicting or assessing the atmospheric conditions of a geographical area over a set time. [https://www.aviationweather.gov/static/help/taf-decode.php Naval weather forecasts] use an extremely condensed code to send their information, rendering them unintelligible to an untrained reader. Transcribing it would be further complicated by a {{w|woodpecker}} (a bird noted for its rapid successive pecking motions) "hammering" (pecking) the Shift key on the keyboard, which would result in many letters being randomly capitalized. Indentation is the practice of shifting a section of text further from the starting margin, which in coding is typically used to organize functions and statements, but if done "randomly" would only serve to scramble the code hierarchy.
In her first simile, Ponytail makes a reference to using OCR ({{w|Optical Character Recognition}}) to recognize the letters on a {{w|Scrabble}} board. OCR is notoriously imperfect and often gets letters wrong, resulting in garbled words. The fact that a Scrabble board has criss-crossing words, with some of them traversing the board vertically, would make OCR output even less reliable.
 
  
Ponytail observes that Cueball’s code includes the [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords JavaScript reserved words] more often than a typical Scrabble board would, a concession that the code looks at least vaguely code-like. In programming, a reserved word is a word that has meaning to the programming language, and therefore is not permitted to be used as a variable name. Common examples are 'function', 'if', and 'return'. The reference to "triple points" refers to the fact that Scrabble's scoring system is based on the point values of individual letters; certain modifier squares on the board can double or triple those values. If Javascript reserved words are worth triple, that would incentivize the players to play them whenever they can, which could give the vague appearance of some kind of code structure.
+
The fourth panel references famous poet {{w|E. E. Cummings}} and user name suggestions. Edward Estlin Cummings was a poet who used capitalization, punctuation, and line breaks in unconventional ways. Websites that offer membership often also require that users create a pseudonym (known as a "username") for use in tracking/authenticating their actions on the site, as well as identifying them to the site's community. Many of these sites also require usernames be unique. On popular sites, many common words, phrases and names have already been reserved by users, so when signing up for them many people run into situations where the name they want has already been taken. On many sites where this happens, the site may suggest alternate usernames, usually based on the one that was entered to begin with. For example, if the username "Hedgeclipper" is already reserved, the site may recommend "Hedgeclipper1234" or "H3dg3clipp3r" instead, depending on the algorithm behind the suggestions. In other cases, websites requiring users to enter personal information such as their name may suggest a username based on their name with a string of digits after it, such as "Joshua1128". An E. E. Cummings poem written entirely out of these semi-random suggestions would make the resulting poem even more "unusual" than his work is already considered.
  
===Weather forecasts and woodpeckers===
+
The last panel's simile involves {{w|Markov chain|Markov chaining}}, {{w|Chatterbot|chat-bots}} (presumably), bus schedules and potential gross vehicular negligence. Applied Markov chaining is a process used in many computer algorithms that try to simulate real-world concepts such as speech simulation and decisions-making. Its inherent randomness also makes it a candidate for unpredictable things such as stock market analysis and speech recognition. Bus schedules are [http://elb-jpinstances-1463028547.us-east-1.elb.amazonaws.com/ccg3/XSLT_STT_REQUEST?mode=direct&line=ccg:01065:%20:H:y15&sessionID=0&requestID=0&itdLPxx_template=tableResults&type_stt=any&language=en&coordOutputFormat=WGS84%5Bdd.ddddd%5D&outputFormat=0&name_stt=10111816&contentFilter=allstops often complicated and full of notation], and are notorious for confusing people who are not used to reading them. Chat-bots using applied Markov chains to recognize and respond to speech/text rely on the input being clear and well-organized in plain language. "Feeding" bus schedules to such a bot would likely result in the returns being complete gibberish and unreadable. The issue is further complicated when Ponytail suggests that the schedules are from a city where "the buses crash constantly", which would be horrifying if it happened so regularly that the schedules actually took crashes into account. Even more horrifying would be the further unpredictability of the output of the chat-bot from such unpredictable input.
In her second simile, Ponytail references naval weather forecasts, avian interference, and indentation. A weather forecast is a complex, multidimensional array of data used in predicting or assessing the atmospheric conditions of a geographical area over a set time. [https://web.archive.org/web/20191115003453/https://aviationweather.gov/static/help/taf-decode.php Naval weather forecasts] (archive) use an extremely condensed code to send their information, rendering them unintelligible to an untrained reader. This is similar to the common bad coding practice of using unhelpful variable names - typically ones that are short and have no obvious meaning, or may even be misleading.
 
  
Transcribing such a weather forecast would be further complicated by a {{w|woodpecker}} randomly pecking the Shift key on the keyboard. Woodpeckers are wild birds famed for their ability to very rapidly peck at a target, which they use to make holes in trees, and also to create a loud "drumming" sound that can be heard a long way. Having a woodpecker peck at the Shift key would result in many letters being randomly capitalized, further reducing the readability of the output.
+
Cueball finally comments that "… it runs fine for now" which indicates he knows the code has problems but it reluctant to fix them because it's more-or-less serving its function. Ponytail quips back that "So does a burning bus", which is technically true, but the "for now" part implies that disaster and injury could result at any moment, as would likely happen on a burning bus.
  
Ponytail then suggests that the output is "randomly indented". Indentation is the practice of shifting a section of text further from the starting margin. In coding, indentation typically has no semantic function, but rather is a way to visually indicate blocks of code in a hierarchical fashion. Without indentation, code becomes extremely hard to read - as an example, see the entries in the {{w|International Obfuscated C Code Contest}} to see just how bad this can get.
+
In the title text Ponytail makes a final remark. A formal grammar is a way of describing the structure of text such that computers can recognize or generate such text. A raw {{w|database dump}} is an export of the data from a database for the purposes of transferring it to another database or importing it into a program, viewed “raw” without processing to make it easy for humans to read. {{w|QuickBooks}} is an accounting software package. The company collapsing in an accounting scandal implies their accounting database would be a mess even in a human-readable format.
 
 
The Python programming language is famous for actually making indentation part of its semantics - a Python program ''must'' be correctly indented, or it will not run.
 
 
 
If a piece of code was ''randomly'' indented, this could be even worse than having no indentation at all, as it could lead readers to see structures where there are none.
 
 
 
===E. E. Cummings and usernames===
 
<div class="poem" style="float: right; clear: both; margin: 0 0.5em; font-size: 90%">
 
<pre class="poem preformatted">Buffalo Bill's
 
defunct
 
        who used to
 
        ride a watersmooth-silver
 
                                  stallion
 
and break onetwothreefourfive pigeonsjustlikethat
 
                                                  Jesus
 
he was a handsome man
 
                      and what i want to know is
 
how do you like your blueeyed boy
 
Mister Death</pre>
 
<div class="poem attribution" style="text-align: right">–E. E. Cummings, "Buffalo Bill's" (1920)</div>
 
</div>
 
Ponytail's third simile references famous poet {{w|E. E. Cummings}}. Edward Estlin Cummings was a poet who used capitalization, punctuation, and line breaks in unconventional ways, suggesting that Cueball's naming conventions are esoteric and hard to follow. She follows this up by restricting the vocabulary to "the usernames a website suggests when the one you want is taken". Websites that offer membership typically require users to create a username that uniquely identifies them. This means that two people cannot have the same username, so if you try to request a name that's already in use, the website will ask you to pick another. Some websites try to help out by suggesting alternative usernames which are close to, but not quite the same as, the one they requested.
 
 
 
For example, if the username "Hedgeclipper" is already taken, the site may recommend "Hedgeclipper1234" or "H3dg3clipp3r" instead, depending on the algorithm behind the suggestions. These names are usually harder to read and less elegant than the one the user actually wanted. An E. E. Cummings poem written entirely out of these semi-random suggestions would make the resulting poem even more "unusual" than his work is already considered.
 
 
 
===Markov bots and bus timetables===
 
The final simile involves {{w|Markov chain|Markov chaining}}, bus schedules, and potential gross vehicular negligence. A Markov chain is a sequence in which each symbol depends only on the previous symbol. This is often used to simulate real-world concepts such as speech simulation and decision making. For example, in English text, you can make reasonable predictions as to what the next letter might be, based on the knowledge of which letters tend to be used together (and which don't). Thus, a Markov bot programmed with basic knowledge of English letter frequencies could produce plausible-looking text. However, the text would make absolutely no sense, as Markov processes are probabalistic and have no knowledge of how English semantics work.
 
 
 
Bus schedules are [http://elb-jpinstances-1463028547.us-east-1.elb.amazonaws.com/ccg3/XSLT_STT_REQUEST?mode=direct&line=ccg:01065:%20:H:y15&sessionID=0&requestID=0&itdLPxx_template=tableResults&type_stt=any&language=en&coordOutputFormat=WGS84%5Bdd.ddddd%5D&outputFormat=0&name_stt=10111816&contentFilter=allstops often complicated and full of notation], and are notorious for confusing people who are not used to reading them. Using these as the input to a Markov bot would result in an even more garbled and unreadable mess, as the Markov bot doesn't understand bus timetables either.
 
 
 
The issue is further complicated when Ponytail suggests that the schedules are from a city where "the buses crash constantly", which would be horrifying if it happened so regularly that the schedules actually took crashes into account. However, this is likely just Ponytail adding an additional layer of convolution to the simile.
 
 
 
Cueball finally comments that "… it runs fine for now" which indicates he knows the code has problems but is reluctant to fix them because it's more-or-less serving its function. This is a well-known cop-out in software development, and is considered poor practice - the fact that the code is running ''for now'', or runs in the specific circumstances the developer tested it in, does not mean that it is well-written, or that it will integrate with other parts of the system, or that it will continue to run reliably in the future.
 
 
 
Ponytail quips back that "So does a burning bus", which also meets Cueball's low standard - a burning bus can still drive despite being on fire, but most people would not enjoy traveling in such a vehicle,{{Citation needed}} and there will eventually come a point where the fire will endanger the occupants and interfere with the operation of the bus. This could be the reason the buses are always crashing in Ponytail's hypothetical scenario.
 
 
 
===Title text===
 
In the title text, Ponytail compares the code to a formal grammar, which is a way of describing a set of strings by providing a list of mapping rules that generate those strings. The resulting output would be a laborious list of rules which would all randomly reference each other, akin to {{w|spaghetti code}}. Furthermore, she suggests that the grammar is based on fragments of a raw {{w|database dump}}, which would be an export of the data from a database in a "raw" format that contains no processing to make it easy for humans to read. {{w|QuickBooks}} is an accounting software package, which could imply that the code Cueball has written is related to finance in some way. If the company using QuickBooks is embroiled in an accounting scandal, their database is likely already in a mess, even in human-readable format.
 
  
 
==Transcript==
 
==Transcript==

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)