| LowestOne (895) | |||
|
I've seen a bunch of inappropriate variable names online. I was told by a teacher to never be cute like that, and I follow his advise. I was able to find something I'm not quite sure about now :) I have two words, which I've named:
Think fWord is going to be a problem? Is the industry so politically correct? | |||
|
Last edited on
|
|||
| Luc Lieber (985) | |
|
The only thing that you have to consider when choosing a variable name is that it sufficiently self-documents itself. Follow that guideline and you: A) Probably won't ever need to use "vulgar" terms unless you're writing a sexual reproduction library. B) Probably won't get confused with your variable names so often. C) Won't incur the wrath of others that depend on your code. | |
|
|
|
| darkestfright (1128) | ||||||
|
Teachers live in the mystical land of Academia, and the things they tell you pretty much never apply to the real world. For example, I was reading the Doom source code and noticed a variable called "fuck". It's completely undocumented, and I have no idea what it does. I've also seen a few gems in my time, like:
| ||||||
|
|
||||||
| ResidentBiscuit (2650) | |
| Ha the dear maintainer one was awesome. | |
|
|
|
| xerzi (605) | |||
Is the memory leak suppose to be part of the joke ? | |||
|
|
|||
| chrisname (6191) | |
|
@xerzi Looks like C# or Java to me, so it won't leak memory. | |
|
Last edited on
|
|
| Duoas (6752) | ||||||
I disagree. Crude language is never appropriate in source code, except when in lists of specifically vulgar words. It isn't funny, or cute, or smart, and all it shows the reader is that the writer's head is not where it belongs. Whom would you hire? Someone whose code looks like this:
Or like this:
Crude words stand out just as much. What they show the reader are the following things: 1. The writer does not care about code maintainability. 2. The writer very likely does not understand his code very well. 3. The writer's code probably has some serious bugs. 4. The writer does not know how to properly name something. 5. The writer does not care about working with other people. 6. The writer is wasting time (thinking about stuff other than his program). Just for starters. Your teacher is right about this. BTW. "vulgar" means, in today's language, anything that is crude or offensive, not necessarily just sexual. edited to fix speling missteak | ||||||
|
Last edited on
|
||||||
| helios (10258) | |
| Well, if the variable name is explicative, then that's alright. Expletive would be a different story, though. | |
|
|
|
| DeXecipher (170) | |
| maybe in the coorporate world but probrably not in the entertiainment/science world with games and such. It may be offensive if it was a slur but all i could see happening is a chuckle. | |
|
|
|
| Duoas (6752) | |
|
@helios Holy crap! I can't believe I made that mistake! I'll fix it above. | |
|
|
|
| darkestfright (1128) | ||
If the person who sometimes use expletives in his code writes code like John Carmack, you bet your ass I'm going to hire him. I'm in the business of shipping code that works, period. I could give 2 shits what his variables are called. | ||
|
Last edited on
|
||
| devonrevenge (897) | |
| hurhurhur variaballs only write dirty code if your bored on your own and it turns you on | |
|
|
|