1833: "Code Quality 3"

This forum is for the individual discussion thread that goes with each new comic.

Moderators: Moderators General, Prelates, Magistrates

Yu_p
Posts: 51
Joined: Wed Oct 12, 2011 9:00 am UTC

1833: "Code Quality 3"

Postby Yu_p » Fri May 05, 2017 12:22 pm UTC

Image

Alt-Text It's like a half-solved cryptogram where the solution is a piece of FORTH code written by someone who doesn't know FORTH.

Disappointing that I had to post the thread. I was really curious about people's "bad coding" anecdotes :(

Don't worry I added the link for you, but maybe next time read the stickied post before creating a new thread here!

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3392
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1833: Code Quality 3

Postby Soupspoon » Fri May 05, 2017 12:35 pm UTC

You put this up while I was posting my own, so you nearly didn't have to... ;) Mine now deleted, though, in deference. Thus the following is dereferenced.. :P
Spoiler:
(It was late today, or perhaps everybody else who could have picked it up is down at the beach. And beyond wireless internet range.)

Maybe they don't know FORTH, just regular Polish?


My own 'bad' coding tends to be of the "cram it all into one line, between short-circuiting logical operators" style, but I do it such that I can make it look good, and thus more readable. (Or "ook good", as originally typed, which perhaps applies only to a particular programming language..)

User avatar
squall_line
Posts: 166
Joined: Fri Mar 20, 2009 2:36 am UTC

Re: 1833: Code Quality 3

Postby squall_line » Fri May 05, 2017 1:30 pm UTC

I'm going back through some of my old code from 3 years ago and updating it and commenting it.

In some cases, I'm completely re-writing it because I can't make any sense of what I originally did. In other cases, I'm writing it more efficiently (or in a more consistent style).

I am also adding much, much more line-broken and indented code to make it easier to read.

And even though I must have read the others when they were first posted, I seem to only be able to read these in the voice of T.J. Miller now.

commodorejohn
Posts: 1085
Joined: Thu Dec 10, 2009 6:21 pm UTC
Location: Placerville, CA
Contact:

Re: 1833: Code Quality 3

Postby commodorejohn » Fri May 05, 2017 2:05 pm UTC

"But my code actually works to spec."
"I don't see what that has to do with anything."
"'Legacy code' often differs from its suggested alternative by actually working and scaling."
- Bjarne Stroustrup
www.commodorejohn.com - in case you were wondering, which you probably weren't.

User avatar
Flumble
Yes Man
Posts: 1998
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: 1833: Code Quality 3

Postby Flumble » Fri May 05, 2017 2:24 pm UTC

commodorejohn wrote:"But my code actually works to spec."

But then how are you going to add new features to the application?

commodorejohn
Posts: 1085
Joined: Thu Dec 10, 2009 6:21 pm UTC
Location: Placerville, CA
Contact:

Re: 1833: Code Quality 3

Postby commodorejohn » Fri May 05, 2017 2:26 pm UTC

Not by sitting around bitching about the quality, that's for sure!
"'Legacy code' often differs from its suggested alternative by actually working and scaling."
- Bjarne Stroustrup
www.commodorejohn.com - in case you were wondering, which you probably weren't.

User avatar
Flumble
Yes Man
Posts: 1998
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: 1833: Code Quality 3

Postby Flumble » Fri May 05, 2017 2:37 pm UTC

Yeah but I mean, if you fully comply with the specifications, there's hardly any room left for unforseen features.* You'd have to actually think about what to add or, even worse, ask the users.


*although, when are the specs ever complete?

commodorejohn
Posts: 1085
Joined: Thu Dec 10, 2009 6:21 pm UTC
Location: Placerville, CA
Contact:

Re: 1833: Code Quality 3

Postby commodorejohn » Fri May 05, 2017 3:11 pm UTC

True that.
"'Legacy code' often differs from its suggested alternative by actually working and scaling."
- Bjarne Stroustrup
www.commodorejohn.com - in case you were wondering, which you probably weren't.

User avatar
Reka
Posts: 198
Joined: Thu Sep 20, 2012 10:21 pm UTC

Re: 1833: Code Quality 3

Postby Reka » Fri May 05, 2017 3:57 pm UTC


User avatar
Heimhenge
Posts: 222
Joined: Thu May 01, 2014 11:35 pm UTC

Re: 1833: Code Quality 3

Postby Heimhenge » Fri May 05, 2017 5:38 pm UTC

squall_line wrote:I'm going back through some of my old code from 3 years ago and updating it and commenting it.

In some cases, I'm completely re-writing it because I can't make any sense of what I originally did. In other cases, I'm writing it more efficiently (or in a more consistent style).

I am also adding much, much more line-broken and indented code to make it easier to read.

And even though I must have read the others when they were first posted, I seem to only be able to read these in the voice of T.J. Miller now.


I'm doing the same with an old game I coded. Having the same issue figuring out WTF the variables represent, even though I did a fair amount of commenting but obviously not about what needed commenting. After spending so much time trying to decypher my earlier code I'm considering the very real possibility that starting over from scratch might be the more efficient route.

quyiatiy
Posts: 1
Joined: Fri May 05, 2017 6:38 pm UTC

Re: 1833: Code Quality 3

Postby quyiatiy » Fri May 05, 2017 6:41 pm UTC

Happy May 4?

Yu_p
Posts: 51
Joined: Wed Oct 12, 2011 9:00 am UTC

Re: 1833: Code Quality 3

Postby Yu_p » Fri May 05, 2017 10:33 pm UTC

Ugh... just ran into the issue myself today, when I showed someone a five-line bookmarklet for reformatting an inconvenient website. Needless to say that being hacked together quickly, with lines added as based on interactive use in the javascript console, resulted in somewhat obscure code.

Obviously, with bookmarklets being length-limited, I had chosen cryptic short-names for the variables, but the script also included a function which was just a short alias for document.getElementsByClassName, and used exactly once. That probably made sense somewhen during the creation of the bookmarklet. (I assume in some intermediate version, that function was called more often?).

qvxb
Posts: 133
Joined: Mon Sep 19, 2016 10:20 pm UTC

Re: 1833: Code Quality 3

Postby qvxb » Sat May 06, 2017 1:02 pm UTC

That evening he'll give her $100 to tell him the same things while he's wearing a ball gag and she's in a leather corset, spanking him with a pointer.

User avatar
peterdavidcarter
Posts: 42
Joined: Wed Dec 14, 2016 6:36 pm UTC

Re: 1833: Code Quality 3

Postby peterdavidcarter » Sat May 06, 2017 5:10 pm UTC

I have to look at a codebase for an indie MMO on Monday that looks exactly as described. It has been about six months since I last attempted to work on it and in the end threw my hands up in despair. I can only assume in the ensuing time no-one else was able to fix it either. On the flip side looking at bizarre code is often a great window into how crazy people's minds work...

User avatar
Solra Bizna
Posts: 55
Joined: Fri Dec 04, 2015 6:44 pm UTC

Re: 1833: Code Quality 3

Postby Solra Bizna » Sun May 07, 2017 2:01 am UTC

Am I the only one who was expecting an asm.js joke?

User avatar
Flumble
Yes Man
Posts: 1998
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: 1833: Code Quality 3

Postby Flumble » Sun May 07, 2017 2:28 am UTC

qvxb wrote:That evening he'll give her $100 to tell him the same things while he's wearing a ball gag and she's in a leather corset, spanking him with a pointer.

Do coders ever have side jobs? Or is she not actually employed there but just broke in and started reviewing someone's code?

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3392
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1833: Code Quality 3

Postby Soupspoon » Sun May 07, 2017 8:55 am UTC

Flumble wrote:
qvxb wrote:That evening he'll give her $100 to tell him the same things while he's wearing a ball gag and she's in a leather corset, spanking him with a pointer.

Do coders ever have side jobs? Or is she not actually employed there but just broke in and started reviewing someone's code?
She could be multitasking... She's also hosting a dinner party for a bunch of philosophers (with deliberately insufficient tableware) in the next room, and periodically ZOTting some Oracle Supplicants (in a non-halting manner) in another.

User avatar
Eternal Density
Posts: 5545
Joined: Thu Oct 02, 2008 12:37 am UTC
Contact:

Re: 1833: Code Quality 3

Postby Eternal Density » Wed May 17, 2017 11:47 am UTC

Soupspoon wrote:
Maybe they don't know FORTH, just regular Polish?
!traż ynteiwŚ
Play the game of Time! castle.chirpingmustard.com Hotdog Vending Supplier But what is this?
In the Marvel vs. DC film-making war, we're all winners.

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3392
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1833: Code Quality 3

Postby Soupspoon » Wed May 17, 2017 12:22 pm UTC

Eternal Density wrote:!traż ynteiwŚ

...ic ęjukęizD

(Yup, makes as much sense to me... ;))

User avatar
Eternal Density
Posts: 5545
Joined: Thu Oct 02, 2008 12:37 am UTC
Contact:

Re: 1833: Code Quality 3

Postby Eternal Density » Sun May 21, 2017 3:20 am UTC

Soupspoon wrote:
Eternal Density wrote:!traż ynteiwŚ

...ic ęjukęizD

(Yup, makes as much sense to me... ;))

You're welcome.
Play the game of Time! castle.chirpingmustard.com Hotdog Vending Supplier But what is this?
In the Marvel vs. DC film-making war, we're all winners.


Return to “Individual XKCD Comic Threads”

Who is online

Users browsing this forum: No registered users and 22 guests