[0674] There Are 10 Types Of Programmers
└ posted on Monday, 13 April 2015, by Novil
[Update: 13 April 2015]: I fixed a bug in the code.
- Jack: You need to chill, boss. I’m sure Melody’s not intentionally trying to piss you off.
- Richard: All right.
- Notification: Source code repository: Melody Crawford has changed the indent style of all your code.
- Richard: ?
- Jack: I can provide a perfect alibi for you on Saturday, from 4 p.m. to 6 p.m.
- Richard: I always knew I could count on you when it really mattered, Jack.
Oh that hits hard
So much for a coding guideline (anyways failing to honor a coding guideline may result on being fired for a programmer in RL)
# TODO : Replace SetColor with set_color
# DEPRECATED : Use set_color instead
Public Node SetColor
(
int param_id,
int param_color
)
{
int nodes_total = nodes.size();
for
(
int i = 0 ;
i < nodes_total ;
++i
)
{
if
(
nodes.get(i).getId() == param_id
)
{
node.setColor
(
param_color
)
;
return
node
;
}
}
return
null
;
}
Indentation is like a religion… Just don’t go against company’s accepted standard… But using JavaScript indent in Java is just so not professional…
Not to mention the ineffectiveness of the code… If you have a function like that then you must have a Tree Map or Hash Map that stores all the nodes under keys of their Id, but what can you expect from company that uses Java. They probably just don’t care about performance.
Novil, what have you done. Now there’ll be people furiously debating indent style in the comments. I’ll start: Richard is right, he uses the only sane indent style.
Bah, let’s rather debate why Richard is preincrementing the loop variable …
Cervisia wrote:
That one is obvious… In compiled languages preincrement works faster than postincrement… Especially without optimizations or with complex types… I always do preincrement where possible or doesn’t matter because of that, and that is actually one of the code standards in our company…
I am curious how many readers initially misread today’s title.
@ Lookfar:
“There are one-zero types of programmers” What can you misread there? It is obviously binary…
@ Trimutius:
Well, I thought for a while it might be trinary. 10 thpes of programers: 01 = those who indent using Richard’s style, 02 = those who indent using Melody’s style, and 10 = those who can’t follow their own code (e.g. most of my students).
@ Lookfar:
Well if it is about identations… That I know at least 0010 (that’s Octal of course as everyone knows proper syntax and what those extra zeroes mean =))
0001 – those who indent like Richard
0002 – those who indent like Melody
0003 – those who indent ‘{‘ like Richard but put extra space after ‘(‘ and before ‘)’
0004 – those who indent ‘{‘ like Melody but put extra space after ‘(‘ and before ‘)’
0005 – those who indent ‘{‘ like Richard but don’t put whitespace between keyword and ‘(‘
0006 – those who indent ‘{‘ like Melody but don’t put whitespace between keyword and ‘(
0007 – those who indent in such a way so that nobody would be able to read their code on purpose
0010 – those who are all over the place (probably like your students)
But about the plot… It would be funny if in the end Melody says something like “I was doing it, to get your attention because you are dreamy.” Or something like that =)
@ Trimutius:
Yes, the plot – she does not seem deranged or sadistic. The most likely explanation for inexplicable behavior is generally love.
@ Trimutius:
Back to our irrelevant side discussion:
You are clearly a programmer first, because you see binary or octal as the only options. A mathematician, however sees a polynomial equation 1x + 0 = N, where N is the number of types of programers. We have a large, but finite number of possible solutions. Your example gives us a lower bound of x, N >= 8. The population of the planet gives us an upper bound of 7 biliion.
@ Lookfar:
Well you know love and hate are actually not opposites. Indifference is the opposite of love, while hate is actually quite close to it…
@ Lookfar:
No I did think about Base 4, Base 5 and Base 6 variants, but kinda Base 8 seemed more relevant, because I’m a programmer, so I was a little bit inventive there.
I myself probably not in any of those 8 groups anyway. Because As I mentioned above, I would indent as Richard in C++ and Java, but on the other hand I will indent as Melody in JavaScript, so it is kinda strange…
@ Trimutius:
I’m of the school that it doesn’t matter what style you use, so long as you have one and use it consistently.
And comments. Lots of comments. I generally have as many comments as lines of code. But then, I’m just a “casual.” As long as it works, efficiency is not nearly as important to me as being able to figure out my own logic a year later.
@ Lookfar:
I was taught to use Richard’s style by my first professor, and Melody’s style by my second. I think Richard’s is far easier to read, although it uses quite a few more lines.
Heeere’s Richard !
Probably one of the, if not THE funniest strip on Sandra and Woo. Kudos.
Hm, maybe Woo should learn programming. Hey, I have an idea for a story arc! Woo, Lily, Shadow, Echo and Sid founding a computer start-up company!
(OK, just kidding…)
Actually, it looks better now. You just need to add some air and comments to it to make it more manageable.
e…God damn it…the worse thing is when someone change something in the code and doesn’t leave a comment about what and why the changes were made…
Looks like Richard’s going out to do some chopping… wood, that is. Lots and lots of wood which he’ll use to burn down Melody’s house with her in it. Seems like Larisa’s fire workshop has been paying off for him as well.
Obligatory “axe to grind” joke here.
Now this “new mom” is getting utterly intolerable…
Not only because the sorting stuff but I especially hate the modified code style.
Wait, 23 comments in and noone has pointed out that both versions are bugged because “node” is neither declared or assigned?
Needs a
Node node = nodes.get(i);
I don’t blame him – I definitely prefer his original version (but with two spaces per level instead of three).
I would be seriously pissed if someone reformatted my code to the second form – it may take fewer lines but it’s harder to see what’s going on and to edit.
Also, I want to see his .emacs file.
So evil…
(Right now I’m learning Java, and I’m going to say this, but the indentation makes the code easier to read and easier to identify, since the black won’t smoosh together. I just don’t understand why people would code that way)
@ MDW:
Nah, its a member function from a class that contains nodes and node. The node member change every times get(int i) or getId() is called? (eurk… not really elegant)
[Update: 13 April 2015]: I fixed a bug in the code.
Eh, it’s Java, so who cares. Now, if it were C#, …
The One True Bracestyle!
Go Melody!
HAHAHA…. I have no idea what’s going on.
@ Trimutius:
Some of the 0010 (those who are all over the place) are adding information to the source. More vertical space means more important: Thus from least important to most important:
if(x) return 0;
if(x)
return 0;
if(x){
return 0;
}
if(x)
if(x)
{
return 0;
}
You can do more vertical space than that, but at that point you’re sorely in need of a comment.
On the other hand, those who indent with spaces…
(ignore the third one, it’s extraneous)
Onihikage wrote:
Fah, poo! Someone best me to it!
The joke is completely lost to me….
Melody’s style is a compromise between the old Sun standard and the Google standard (the difference being the number of spaces indented). Richard’s is the Maven style.
Richard’s biggest problem, though, is in not using a foreach loop…
Annon wrote:
For a complied code the the change of indentation style has zero effect on the performance of the code, it however has a major effect on reading the raw code when you’re looking for bugs
So She just Majorly made the job harder for all her colleagues for no practical gain.
however interpreted code like JavaScript removing unnecessary carriage returns makes the code file smaller, hence makes sending them over the internet faster. hence shorter page loading time.
Richard should be thankful that she fixed his flawed indentation.
You don’t mess with the indents.
Doesn’t matter whether it’s religious or convenience, but you mess with my indents, you die.
Oh man, I would probably have a similar response to Richard… I like my stuff readable =P.
I can’t decide which I like more: Cloud and Sandra’s sweet, innocent, romantic hi-jinks, or Richard and Melody’s intensely escalating love-hate geekfest.
I guess he’s got an… axe to grind?
Requesting last panel, with text, as a wallpaper option. I know a lot of workers who would benefit from this.
Hehe, perfect alibi indeed if Jack’s last name is Daniels.
Can we see Melody and Richard wearing Vi and Emacs t-shirts in the next strip?
We have officially reached warp factor pigtail-pulling.
I know nothing about coding but I can tell you that Richard is well on the way to ruining that ax. Sharpening should always be done on a slow, water-cooled grindstone. If it throws sparks you’re doing it wrong and probably over-heating the steel.
Java is easy to learn, and that is why Novil is using it for this webcomic.
C++ could slow down the comics quite a bit, and therefore wouldn’t be ideal for Novil considering his situation with having to make two strips per week on S&W alone.
That is why, from a reality-to-fiction perspective, Richard’s company is using Java. Not because that they are weak with code, but because that Novil is more interested in making sure that us readers are able to get the strips, and their associated jokes, on time.
Whether it be Java or C++ doesn’t change the context of the joke, it just changes how realistic the company is in the fictional work, and even then it is rather insignificant for the story at large. The problem only occurs when people try plugging in the code, but then that means that the code itself needs to be debugged, not changing the programming language entirely.
Then again, this explains why Melody is supporting P!=NP. She keeps screwing around with the code for customizing it to her desires instead of focusing on the final product’s quality and the needs of her team. This slows down how quickly code can be produced, and thus P!=NP is always true for her when she is cracking code, even if it would be disproven.
@ Trimutius:
0005 for me, all the way 🙂
Oh HELL NO. You do NOT do that.
That said, two things. First, Richard’s style really isn’t the correct bracing style for Java, which (I think) uses something closer to 1TBS. I’m guilty of this one too; I just like the Microsoft C# style. Still works, but you may lose credibility for it. Second, there should be some function in the IDE to customize brace style, which would then fix it when using the code formatting menu item.
So: though it is a strong indicator of hate (or schoolyard love), it’s actually not a horrible thing that’ll take hours or days to fix. (Also they’d better be using source control, and thus he can revert back one commit.)
As a side note, might it be a good idea to set up a source control system that reduces code down to the smallest uncompressed size (Like a JS minimizer) on commit, and gives it to the user on checkout in their preferred brace style?