1695: Code Quality 2

Explain xkcd: It's 'cause you're dumb.
Revision as of 13:09, 29 March 2024 by 172.70.38.176 (talk)
Jump to: navigation, search
Code Quality 2
It's like you tried to define a formal grammar based on fragments of a raw database dump from the QuickBooks file of a company that's about to collapse in an accounting scandal.
Title text: It's like you tried to define a formal grammar based on fragments of a raw database dump from the QuickBooks file of a company that's about to collapse in an accounting scandal.

Explanation

This comic is the second in the Code Quality series:

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.

As in the first comic in the series, we again see Ponytail being introduced to the messy 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 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.

OCR, Scrabble, and Javascript-reserved words

In her first simile, Ponytail makes a reference to using OCR (Optical Character Recognition) to recognize the letters on a 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 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.

Weather forecasts and woodpeckers

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. 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 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.

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 International Obfuscated C Code Contest to see just how bad this can get.

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

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
                 –E. E. Cummings, "Buffalo Bill's" (1920)

Ponytail's third simile references famous poet 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 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 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 spaghetti code. Furthermore, she suggests that the grammar is based on fragments of a raw 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. 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

[Zoom in on Ponytail sitting in front of a computer screen typing. Cueball speaks only off-panel, but since this is a direct continuation of comic 1513: Code Quality where Cueball is shown, there can be no doubt it is him.]
Ponytail: Ugh, I hate reading your code.
Cueball (off-panel): I know, I know.
[Zoom out of Ponytail in an office chair in front of the computer on a desk.]
Ponytail: It's like you ran OCR on a photo of a Scrabble board from a game where Javascript reserved words counted for triple points.
[Zoom in on Ponytails head.]
Ponytail: It looks like someone transcribed a naval weather forecast while woodpeckers hammered their shift keys, then randomly indented it.
[Zoom out back to the setting of the second panel.]
Ponytail: It's like an E E Cummings poem written using only the usernames a website suggests when the one you want is taken.
[Zoom in to Ponytails head and the screen in a wider panel. Finally Cueball again answers off-panel.]
Ponytail: This looks like the output of a Markov bot that's been fed bus timetables from a city where the buses crash constantly.
Cueball (off-panel): Whatever, it runs fine for now.
Ponytail: So does a burning bus.


comment.png add a comment! ⋅ comment.png add a topic (use sparingly)! ⋅ Icons-mini-action refresh blue.gif refresh comments!

Discussion

Edward Estin Cummings was a poet (pseudonym e e cummings) who used capitalization, punctuation, and line breaks in unconventional ways. When a new user creates an account that duplicates an existing user name, many websites will suggest a user name with the user's first name followed by a string of digits. The Dining Logician (talk) 14:42, 17 June 2016 (UTC)

I really love these ones :) I hope there will be a part 3. Can we please make a contest for these?162.158.83.246 15:22, 17 June 2016 (UTC)

Yes please! How about:

"It's as if you used a kaleidoscope while following a style-guide written in Rongorongo & applied a pseudo-random number generator to the Unicode table for all your regular expressions. Also, you're not supposed to use line-breaks to draw letters using pipe symbols when defining your variables." (A nice example of the Reverse Boustrophedon format used in Rongorongo) 162.158.68.137 22:05, 17 June 2016 (UTC)

My brother made up this one: "It's as if you ran a sponge through a punch-card reader." --172.69.42.50 00:10, 12 March 2021 (UTC)

I know Ponytail is female but I keep reading her voice as TJ Miller's character from the movie Deadpool.--R0hrshach (talk) 15:45, 17 June 2016 (UTC)

Are you also a fan of Dr. Mrs. The Monarch, from Venture Bros? 162.158.68.137 22:05, 17 June 2016 (UTC)

"This is further compounded by Ponytail's suggestion that Cueball made rampant use of JavaScript reserved words in his declarations, which is strictly forbidden by the language." I don't think Ponytail made any such suggestion. I think all Ponytail is suggesting is that reserved words occur more often than they would in an ordinary scrabble game. A "house rule" giving triple points for using particular words would explain their high frequency.

Of course in pretty much any program reserved words do occur with high frequency, it's hard to write without them. There is also heavy overlap in the list of reserved words in different languages, so that the program might not be in javascript. A typical C program uses lots of javascript reserved words.--108.162.218.59 16:12, 17 June 2016 (UTC)

I agree, and as "the program runs fine for now" it appears to be at the very least a syntactically correct program. --141.101.104.76 21:17, 17 June 2016 (UTC)
I also agree that it's highly speculative to assume that Cueball's use of reserved words is necessarily erroneous; However, that may be the funnier interpretation, as it indicates an even higher level of improper usage. 162.158.68.137 22:05, 17 June 2016 (UTC)
I interpreted it quite differently: that he uses variable names very similar to reserved words. For example, "stririg" or "strlng" for a string. 173.245.52.70 11:12, 19 June 2016 (UTC)

Do we really need the "funny bus crash" photos in the transcript?141.101.98.123 20:01, 17 June 2016 (UTC)

"Funny" bus crash is redundant, in my antisocial opinion. 162.158.68.137 22:05, 17 June 2016 (UTC)
No we do not need them. Feel free to delete them. They are though not in the transcript (where they would for sure not belong). The transcript shoudl genreally have no links. They are in the explanation above the transcript as is also the case with the crash photos. --Kynde (talk) 14:43, 18 June 2016 (UTC)

"It works fine for now" is the reason we still have such a hard time figuring out genetics.172.68.35.83 05:57, 18 June 2016 (UTC)

Somehow the "OCR on the photo of a Scrabble board" line reminded me of 1685: Patch. Tepples (talk) 22:43, 18 June 2016 (UTC)

Much shorter insult, courtesy StackOverflow: "The garbage collector is broken". "What? Impossible!" "Surely. Your program is still there." 162.158.201.84 08:37, 20 June 2016 (UTC)

"Navy weather forecast"

The link given in the explanation to a navy weather forecast is to a graphical weather forecast product. This doesn't make sense, since Randall was clearly referring to a textual weather forecast product. I believe the type of weather forecast Randall intended to reference is an aviation weather forecast, which is textual, not graphical, and is indecipherable to a lay person (pilots must learn how to read them during their training). An example of such a forecast is the blue text on this page explaining how to decode themSaxTeacher (talk) 14:14, 21 June 2016 (UTC)

In the 1st panel her hands are on desk but others are on the drawer underneath :) 108.162.245.50 20:36, 14 November 2016 (UTC)

That's easily explained away as she is also hunched over in panel 1 trying to read his code. Holding onto the desk like that would make sense as she would not currently be using her hands to type and correct things (not that it's possible to correct Cueball's code). 108.162.241.118 (talk) (please sign your comments with ~~~~)

Cummings example

I wish we could copy over the "Buffalo Bill's" quote box from E. E. Cummings, but sadly we don't have Template:quote box or <poem> available on this wiki... Maplestrip (talk) 15:31, 25 March 2024 (UTC)

Would {{Quote}} (Template:Quote) be useful to you? Or just use the "space-starting line" format
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
There's various possible treatments. With perhaps some additional arguments to it all, if you want it 'side-aligned'/text-flow-past/whatever, which might also be a template option, or possible through direct xhtml-type markup. Not sure how much you want to exactly emulate it what's over there... 162.158.74.119 23:35, 25 March 2024 (UTC)
Something like this..?
Using float
In a table
Or a different div-style block
If you don't need tables
    to do    weird stuff...
172.70.85.77 17:11, 27 March 2024 (UTC)
I think a side-aligned little box would be nicer, as then it wouldn't completely break up the explanation. I simply wouldn't want the example of a E.E. Cummings poem to be taking up more space than the two paragraphs in the same section already do. But the exact styling can be anything, of course. Maplestrip (talk) 14:01, 27 March 2024 (UTC)
This is pretty good! I implemented something with this and I think it works. Couldn't figure out how to stop this from being in bold (I know it's the th fault but I don't know how to fix it), but I think it's already good enough to be on the page. Thanks for the help! Maplestrip (talk) 12:40, 29 March 2024 (UTC)
I hope you like how I changed it. Took a few tweaks to make it right (more than a few Previews, but also changed mind over submitted 'final' versions).
It doesn't need to be a table (the above was designed for contextual use that you don't need to invoke). Yes, the 'th' (table header cell) defaults to bold, and other formatting, where 'td' (table data cell) does not. I should have TDed most rows, if not all, in the example. But not using either now, so doesn't matter.
While it somewhat satisfies me, I don't know if it works for you (or others). And there are several other ways of rendering it (and encoding the rendering) that do the same sort of thing. Never mind someone going so far as to writing a Template:poem and putting the working code (and a ton of wikicode, to deal with optional changes) into that. 172.70.86.16 15:48, 29 March 2024 (UTC)
(sorry for the late response) This looks great! I think this is a really nice format. I'm not big on the font, but it being monospace probably helps and I don't know what the original poem's font was. You did a great job, thank you very much ^_^ ..I do have to say that I absolutely do not get the appeal of this Cummings poem. It does vaguely remind me of badly-indented code :p Maplestrip (talk) 09:38, 3 April 2024 (UTC)