How silly/funny are your code/comments?
- hyphz
- Baaaaaa!

- Posts: 2856
- Joined: Tue Aug 13, 2002 4:24 pm 0
- Yahoo Messenger: hyphz
- Location: Reading, which is deep and dark apparantly
- Contact:
How silly/funny are your code/comments?
Just a rather random question that I'd be interested in folks' opinions of.
(This is after, a while ago, meeting a Shareware author who I thought was really impressive and finding out he had variable names like Kirianneistalkingtomeatthemoment.)
(This is after, a while ago, meeting a Shareware author who I thought was really impressive and finding out he had variable names like Kirianneistalkingtomeatthemoment.)
- Dvorak
- Baaaaaa!

- Posts: 4560
- Joined: Wed May 08, 2002 7:37 am 0
- Yahoo Messenger: d3dxquaternion
- Location: Germany
Knowing that others actually have to work on/with the code I'm producing, I tame my geekish attitudes and write clear and professional code and comments.
Listen, dudes: It's no fun at all if
- it's crunch time
- it's late
- I've been working like hell now for weeks
- it still doesn't work
- and I want a beer
- and want to go home so badly
- ...
and I have to work my way through oh-so-funny code that's a bloody mess and nothing but a pile of pure shite and we ...paid you for that...
It's evil!
Try it and I fire you right away! I'm not kidding at all!
Now, dare to write that you fancy oh-so-funny comments and variable names and and and...
[cough...cough...my heart]
Listen, dudes: It's no fun at all if
- it's crunch time
- it's late
- I've been working like hell now for weeks
- it still doesn't work
- and I want a beer
- and want to go home so badly
- ...
and I have to work my way through oh-so-funny code that's a bloody mess and nothing but a pile of pure shite and we ...paid you for that...
It's evil!
Try it and I fire you right away! I'm not kidding at all!
Now, dare to write that you fancy oh-so-funny comments and variable names and and and...
[cough...cough...my heart]
While I have been known to throw in the odd "out of cheese error" into my code it is only in response to real reboot universe tests...
But, on the basis that some poor sucker may have to go back to my code in six months time, and that the probability is that said poor sucker will be me, I do like to keep my code, comments and error conditions utterly sensible. Sorry.
Cheers
Chris
But, on the basis that some poor sucker may have to go back to my code in six months time, and that the probability is that said poor sucker will be me, I do like to keep my code, comments and error conditions utterly sensible. Sorry.
Cheers
Chris
the bizzarre ratings of an ignorant, deluded old fool
Oh. And pet hate time...
WTF is that supposed to mean? Give 'em real names...
Cheers
Chris
Code: Select all
Dim i, j, k, l As Integer
Dim foo as StringCheers
Chris
the bizzarre ratings of an ignorant, deluded old fool
- hyphz
- Baaaaaa!

- Posts: 2856
- Joined: Tue Aug 13, 2002 4:24 pm 0
- Yahoo Messenger: hyphz
- Location: Reading, which is deep and dark apparantly
- Contact:
I guess I should have been clearer about the setting for the coding really. One other thing: do you use "Hungarian notation" (type abbreviation before the variable, as in iNumber, sName, etc. - I have no idea if it's actually called that, I'm sure sure I heard it used once..) when you don't have to?
No, you were clear enoughhyphz wrote:I guess I should have been clearer about the setting for the coding really. One other thing: do you use "Hungarian notation" (type abbreviation before the variable, as in iNumber, sName, etc. - I have no idea if it's actually called that, I'm sure sure I heard it used once..) when you don't have to?
I write lots of code for "fun". But that isn't the same as writing code that I never want to see again. Quite often, code I write for a NGPC game or whatever will find it's way into "work" code at a later date. Therefore, it *always* suits me to make sure that my code is relatively clean and easy to follow - as I never know when something I knock out in a lunchtime might mutate into a larger scale project (see my 3d starfield demo for an example of that) or be used in something more serious (i.e. money earning) several months or years down the line...
As for Hungarian Notation? That is indeed where you prepend your variable names with their type, but what is important (and is often missed) is that the *name* part of the variable should therefore be meaningful - it's what I was alluding to in my last post. It's especially useful when you're translating between types for some reason - for instance if I wanted to translate between DayOfWeek in numerical (0 to 6) and textual (Sunday to Monday) form, my variables would be iDayOfWeek and sDayOfWeek respectively. It just gives the casual reader a little clue as to the code they're looking at without having to constantly refer to the declarations section.
And yes. I do that all the time - albeit in a rather loose fashion...
Cheers
Chris
the bizzarre ratings of an ignorant, deluded old fool
- hyphz
- Baaaaaa!

- Posts: 2856
- Joined: Tue Aug 13, 2002 4:24 pm 0
- Yahoo Messenger: hyphz
- Location: Reading, which is deep and dark apparantly
- Contact:
I actually largely agree with you, but I've seen some surprising examples who didn't.
Like Andrew Plotkin, who writes "interactive fiction" (ie, text adventures) in Inform. All his games are very well programmed, but try disassembling one of his games and you get huge numbers of very silly debug messages. (Like, at one point an interrogator asks questions of the player and can respond in different ways if you refuse to answer. Presumably he had some sort of pointer to indicate what question was just asked and then a generic failed-to-answer routine. But if the failed-to-answer routine was called with the question pointer invalid, you got: "BUG - You fail to answer the question that has not been asked. How Zen." Another one was "BUG - The tribe leaps out at you, realizes it doesn't exist, and leaves.")
Like Andrew Plotkin, who writes "interactive fiction" (ie, text adventures) in Inform. All his games are very well programmed, but try disassembling one of his games and you get huge numbers of very silly debug messages. (Like, at one point an interrogator asks questions of the player and can respond in different ways if you refuse to answer. Presumably he had some sort of pointer to indicate what question was just asked and then a generic failed-to-answer routine. But if the failed-to-answer routine was called with the question pointer invalid, you got: "BUG - You fail to answer the question that has not been asked. How Zen." Another one was "BUG - The tribe leaps out at you, realizes it doesn't exist, and leaves.")
silly comments are valid ... but just remember your employer will probably seize all your source code at some point
visible debug messages can also get you into big trouble, especially with european customers who are not known for their sense of humour
and it is probably not a good idea to slag off your work collegues through your comments, no-matter how much of a misery they are making your life
i have my own system of labelling variables, while not exactly hungarian notation, it works for me!
i think once you stop worrying about how you use curly brackets or ident your code, what variable names you use or how many comments is enough, then you immediately become a better and more productive programmer!
i still get great pleasure from calling a look up table structure 'sLut'
just done a search for 'huhuh' on some of my source code, here are the results...
int spent; // huhuh
void RefreshParts(); //huhuh
// two turns on a ratchet (huhuhuh rat shit)
Rect(1,47,207,18), // box (huhuh)
unsigned int top_slot; //huhuh
schoolboy humour will never die!
visible debug messages can also get you into big trouble, especially with european customers who are not known for their sense of humour
and it is probably not a good idea to slag off your work collegues through your comments, no-matter how much of a misery they are making your life
i have my own system of labelling variables, while not exactly hungarian notation, it works for me!
i think once you stop worrying about how you use curly brackets or ident your code, what variable names you use or how many comments is enough, then you immediately become a better and more productive programmer!
i still get great pleasure from calling a look up table structure 'sLut'
just done a search for 'huhuh' on some of my source code, here are the results...
int spent; // huhuh
void RefreshParts(); //huhuh
// two turns on a ratchet (huhuhuh rat shit)
Rect(1,47,207,18), // box (huhuh)
unsigned int top_slot; //huhuh
schoolboy humour will never die!
- sack
- Baaaaaaa!

- Posts: 7077
- Joined: Fri May 10, 2002 4:13 pm 0
- XBL Gamertag: evilgopher
- PSN: sixFiveOhTwo
- Location: Rijswijk, The Netherlands
- Contact:
I pad my code with music references for some reason
such as
if((man == 5) && (devil == 6) ) god == 7; // if you understand this code, can i have my MP3 CD back?
but I do like my code clean and readable though.
int i,j,k,l; do make an appearance - but always as generic loop counters - they never have a purpose beyond that (i is the outer for() loop, j is insider that, etc...)
such as
if((man == 5) && (devil == 6) ) god == 7; // if you understand this code, can i have my MP3 CD back?
but I do like my code clean and readable though.
int i,j,k,l; do make an appearance - but always as generic loop counters - they never have a purpose beyond that (i is the outer for() loop, j is insider that, etc...)
Last edited by sack on Mon Jun 02, 2003 3:39 pm 0, edited 1 time in total.
sack wrote:I pad my code with music references for some reason
such as
if((man == 5) && (devil == 6) ) god == 7; // if you understand this code, can i have my MP3 CD back?
I like that
Although, if I ever have to work on your code then I will have no choice but to track you down and kill you
Cheers
Chris
the bizzarre ratings of an ignorant, deluded old fool
- Muttley
- Sheepie Whore

- Posts: 13169
- Joined: Thu Apr 25, 2002 12:30 pm 0
- XBL Gamertag: Mu77ley
- Location: In a maze of twisty passages, all alike.
- Contact:
Completely serious for me I'm afraid. I'd get lost if I didn't (I seem to only get the opportunity to code once a month or so).
Muttley
Muttley
Muttley's Blog: Rarely updated, occasionally interesting… maybe
RetroRemakes Framework: Open Source BlitzMax Game Framework
MuttMod: My Open Source BlitzMax Modules
RetroRemakes Framework: Open Source BlitzMax Game Framework
MuttMod: My Open Source BlitzMax Modules
I tend to over comment at times - I understand what im trying to do in the code - but if it's complex then I go over the top with comments in case I forget what the hell it was doing. In doing so I lose the plot and a month of two later end up with comments as meaningless to me as the code. Best place for that kind of verboseness in a professional setting would be the project documentation but nobody keeps formal documentation for home brew stuff do they?
- korruptor
- Baaaaaa!

- Posts: 4291
- Joined: Sun Sep 22, 2002 10:35 am 0
- Location: Under The Northern Lights
- Contact:
I tend to keep it "professional", although I will get bored and throw in the odd joke or two. Variable names, however, have to be informative.
I did write some code once where all the variable names were characters out of Star Wars. Took me bloody ages to get the plot into the code as well though...
I did write some code once where all the variable names were characters out of Star Wars. Took me bloody ages to get the plot into the code as well though...
"Don't go into a trance boys..." :: DJ Mixes
Completely professional comments for me, I usually end up writing the comments before the code on particuarly complex pieces ('specially round transaction handling).
Variable names, yep must be informative but like most tend to reserve (i,j,k) for generic conter variables and the typical e for exceptions (can you guess what language I program in yet...)
Variable names, yep must be informative but like most tend to reserve (i,j,k) for generic conter variables and the typical e for exceptions (can you guess what language I program in yet...)



