Editing 1513: Code Quality
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== | ||
− | + | [[Ponytail]] is about to look at some {{w|source code}} [[Cueball]] has written, and he is warning her that he is self-taught so his code probably won't be written the way she is used to. | |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | In spite of Ponytail's initial (polite) optimism, she comments in three increasingly harsh similes. First, she suggests that reading his code is like being in a house built by a child, using a small axe to put together what he thought was a house based on a picture. This relates to a technique especially common for new programmers. They follow and adapt tutorials, and find examples of similar problems being solved, copy the solution ("cutting" it out as with an axe), {{w|Jury_rig|jury-rig}} it together, and tinker with it until it seems to work. This can lead to code that is hard to follow or otherwise "messy" and inconsistent. Once a piece of code is working, inexperienced or deadline-driven coders are reluctant to go back and rewrite it to be cleaner or clearer, for fear of breaking something that has been working. More experienced coders will go back after the first time the code worked and try to improve the code if they think it is possible. This improvement practice is known as {{w|refactoring}} and code projects that incorporate cycles of refactoring tend to be easier to read and maintain than those that don't. Including good test cases reduces the risks. | ||
− | + | Second, she suggests that it looks like a salad recipe, written by a corporate lawyer on a phone with autocorrect that only corrected things to formulas from Microsoft Excel. This presumably relates to the way many programmers use {{w|integrated development environment}}s (IDEs). They serve as syntax-checkers and often also help correct other programming errors, but their corrections and advice can be unnatural and difficult to understand (like corporate lawyers producing Excel formulas). The result of just fixing what the IDE complains about often results in less-than-elegant code. | |
− | + | Third, she describes it as a transcript of the dialog of couple arguing at {{w|IKEA}}, which was then randomly edited until the computer compiled it with no errors. IKEA is an international chain of furniture stores which feature large, maze-like showrooms as well as a large warehouse area where you can pick up the furniture you want to buy in flat, some-assembly-required packaging. Especially on weekends when many people crowd in to a store, they can be stress-inducing places. So coming across arguing couples in IKEA is to be expected. Compiling refers to taking human readable source code and translating it into machine executable code; this is done by software that expects the input (the human readable part) to be in a certain format -- if the input is somehow not quite correctly formatted, the program will fail to compile the code, and will indicate that the input could not be compiled. Often, this is some simple little failure, like you forgot to put a semicolon at the end of a line of otherwise perfectly correct code. Putting in the semicolon in the correct place will allow the code to compile. Sometimes, it is not immediately clear what little violation of the language's syntax has been violated, and you will try two or three things, hoping to get the code to compile: maybe I need to capitalize this function name, and maybe I need to put this part in parenthesis, and maybe I need a semicolon at the end of this line. You do those things, and suddenly the code compiles, but you don't know exactly why. This reinforces behavior where you tend to just randomly edit your code until it compiles. An extreme of this would be to randomly edit some random starting input that isn't even really code, and just add and subtract stuff until by pure chance it happens to fulfill all the requirement of syntax that will allow it to compile. (This is very similar to an infinite amount of monkeys bashing away on typewriters for an infinite amount of time eventually producing the complete works of Shakespeare.) | |
− | + | Finally, Cueball makes the rather weak assurance that he will read “a style guide”. | |
+ | Although few programming languages require a perfectly rigid style, so long as the code is syntactically accurate, most programmers follow some sort of {{w|Programming_style|style}} to make the code easier to read. This includes indenting lines to show levels and using descriptive variable identifiers with special capitalization, (e.g., {{w|CamelCase|CamelCase}} (aka camelCase, capitalizing each word except for the first in a sentence)), {{w|Snake case|snake_case}} (separating lowercase words with underscores). | ||
− | + | It seems clear from Ponytail's commentary that his {{w|Software quality|code quality}} would benefit from far more training in computer programming. | |
− | + | The title text refers to {{w|emoji}}, originally called "{{w|Smiley|smiley faces}}". Ponytail's comment implies that some of Cueball's variables contained emoji, perhaps in an effort to capture the emotional content of the arguments which show through the requirements document. Many crying-face emoji are possible if variables can include full Unicode (e.g., 😢,😭,😂,😪,😥,😰,😿,😹). In some programming languages it would be impossible to use them in variable names, as the symbols would break the language's syntax rules. Exceptions to this include {{w|Go (programming language)|Go}}, {{w|Swift (programming language)|Swift}}, {{w|Java (programming language)|Java}} ([http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8], [http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isUnicodeIdentifierPart%28int%29]), but most languages with compilers that support Unicode characters can include this kind of emoji, even for languages that predate Unicode like {{w|C++}} and {{w|Lisp_(programming_language)|Lisp}}. | |
− | |||
− | |||
− | |||
− | |||
− | Many crying-face emoji are possible if variables can include full Unicode (e.g., 😢,😭,😂, | ||
− | |||
− | |||
− | |||
− | |||
− | |||
==Transcript== | ==Transcript== | ||
Line 44: | Line 31: | ||
:Ponytail: ...Wow. This is like being in a house built by a child using nothing but a hatchet and a picture of a house. | :Ponytail: ...Wow. This is like being in a house built by a child using nothing but a hatchet and a picture of a house. | ||
− | :[ | + | :[Ponytail sits at desk, Cueball stand behind her.] |
:Ponytail: It's like a salad recipe written by a corporate lawyer using a phone autocorrect that only knew Excel formulas. | :Ponytail: It's like a salad recipe written by a corporate lawyer using a phone autocorrect that only knew Excel formulas. | ||
− | :[ | + | :[Ponytail sits at desk, Cueball stand behind her.] |
:Ponytail: It's like someone took a transcript of a couple arguing at IKEA and made random edits until it compiled without errors. | :Ponytail: It's like someone took a transcript of a couple arguing at IKEA and made random edits until it compiled without errors. | ||
:Cueball: '''''Okay,''''' I'll read a style guide. | :Cueball: '''''Okay,''''' I'll read a style guide. | ||
==Trivia== | ==Trivia== | ||
− | *Emoji can be simulated using {{w|ASCII}} characters, | + | *Emoji can be simulated using {{w|ASCII}} characters, and have roots in ASCII {{w|emoticon}}s. Most languages will allow variable names to include underscores, so some sad face ASCII emoticon will be legal variable names, such as <code>T_T</code>, <code>p_q</code>, <code>ioi</code> etc., but such things rarely show up in software variables. Many more can be made possible using [http://hexascii.com/sad-emoticons/ UTF-8 characters]. |
{{comic discussion}} | {{comic discussion}} | ||
+ | <!-- Include any categories below this line. --> | ||
− | |||
− | |||
[[Category:Comics featuring Cueball]] | [[Category:Comics featuring Cueball]] | ||
[[Category:Comics featuring Ponytail]] | [[Category:Comics featuring Ponytail]] | ||
[[Category:Programming]] | [[Category:Programming]] | ||
− | |||
− | |||
− | |||
− |