Advertisement

Questionable Design Habbits

Started by February 27, 2009 02:20 AM
16 comments, last by Lode 15 years, 8 months ago
Quote: Original post by Benjamin Heath
If a hobbit is half-hobo and half-rabbit, is a habbit more rabbit than hobo?


Answer the question, I must know. :|


Glad to see I'm not the only one who saw that.
Well, I'm not employed in any sort of coding environment so thankfully I can't get in trouble for "creative" variable naming or commenting, but even if I was I doubt it would be an issue.

Perhaps it's just the fresh schooling in the back of my mind, but I'm pretty strict on naming variables. Their names always have relevancy, are always in the caps style, and I almost never do something like foo1 and foo2 because I can't think of two new names. Even in debug code. I just can't make myself do it for some reason. I only do it if I know I'm going to remove the code immediately after a debug step through or something, nothing that might inadvertently get saved into a source file and forgotten about.

Comments I'm a bit more flexible on. Generally if I have a problem with comments it's the fact that I tend to over comment and do it in completely unnecessary ways, like:

// Read the file in
readFile("file.txt");

Sometimes I do get frustrated and put a comment like, "Why the heck doesn't this work?" in my source files, but again, I'm the only one who ever reads them anyway, so it doesn't much matter.
Success requires no explanation. Failure allows none.
Advertisement
Quote: Original post by dpadam450
When I get mad at code, all my test variables become swear words. But they eventually are deleted cuz they are tests.


Oh yeah, the F word is quite used variable name when I'm trying to debug stuff.

If you use questionable things in "temporary debug code", you might still accidentally forget about it and commit it. So to avoid that, I just don't use anything offensive or questionable at all even in temporary debug code. I just use boring variable names like "temp" and "test" there. Sometimes I do use a Dutch name like "watismedattehiervooriets".

What I sometimes do is, at the end of the day, type some text with my thoughts right in the code that will not compile, so that the next morning when hitting compile I immediately end up there and can continue with the thoughts of the day before.
funny story. 2 years ago i was in a programming contest. i had called the judges up on their phone, and was complaining about vagueness in one of the questions. anyway, later on during the award ceremony, they mentioned how one of the teams had embarrassed their school forever. i was convinced it was mine for hassling them on the phone.

turns out it was a team who put in weird offensive/racist debug info in their code and forgot to get rid of it when they finally submitted their programs.
I forget the details, but for a calculus assignment we needed to write a code to integrate the heights of bean shoots over time or something like that. I thought of it in terms of velocities and accelerations and had variables shootHeight, shootVelocity, shootAcceleration, and, needing the time derivative of the acceleration, shootJerk. The professor made a remark during class about the unacceptable behavior of some students. I was completely oblivious until I asked him, after class, why my assignment hadn't been handed back with the rest of the class'.

But I almost never do that intentionally. Sometimes, if we need a value but it's irrelevant what it is I'll do something. I've done simulations using a library code that needed to be told what element to use even though it made no difference to my calculation (elemental properties were taken care of elsewhere), so I told it we were working on Boron.
Advertisement
Since I work at a professional company, the code I commit into the build system must be professional. As much as I would like to commit swear words into my code, having my entire team review my commits prevents this. So, I usually take my frustrations out on my white board in the form of random nonsense and references to FSM.

In my time working there, I don't think there was one day where I had work-related stuff on my white board.
------------Anything prior to 9am should be illegal.
Quote: Original post by RealMarkP
Since I work at a professional company, the code I commit into the build system must be professional. As much as I would like to commit swear words into my code, having my entire team review my commits prevents this. So, I usually take my frustrations out on my white board in the form of random nonsense and references to FSM.

In my time working there, I don't think there was one day where I had work-related stuff on my white board.


Nice whiteboard! You should start a webcomic ;)

This topic is closed to new replies.

Advertisement