|
There is nothing worse, as a support engineer, than working through some code and coming to a line that says something like:
/* Note: Needs to be fixed before general release. */
|
|
|
|
|
Nope, my OCD won’t let me do such things. Quick an dirty code as well as production get the full treatment!
|
|
|
|
|
Well, if I'm writing a very short procedure purely as a way to check it works or compare two methods that have occurred to me, and am probably doing it in a test rig, then yes, I will use short variable names for speed. But I do it properly when I rewrite the code into the actual program.
One thing I will admit to: if I write a short utility function, one or two lines... you know, to return a filename without the extension, or the nth word in a string or something... I will often use astr, x etc. And counters are i. Always. Unless there is a nested loop, in which case one of them is j. Unless the code is long and complicated, in which case one is outer and the other inner.
Should I hang my head in shame? [Please specify precise angle]
|
|
|
|
|
When learning the language (C++) I utilize class names cfoobar cgoobar and choobar as needed. Never needed a cjoobar. Also as per FORTRAN i often utilize i j k for loop counters. Otherwise I utilize descriptive variable names even lengthy ones unless the lengthy type name is conveniently nearby to provide the context.
|
|
|
|
|
I don't object to others doing that, but to think about code I do better to "think in code". So the comments about "habits" really apply here. If any identifier is unconventional/silly I won't be focused on the intent of the code.
Secondly - the code that I do as a "one-off" often turns out to be useful and adopted in another project or context. It drags down my time and effort if I need to go back and tidy up and refactor.
Lastly - I was part of a moderately sized audience for a product demonstration once. As often happens the "presentation gods" were unkind. The demo started going awry and exposing all kinds of errors, exposing dopey-silly stuff that the developers probably NEVER intended to be part of a marketing demo.
I felt awful for the marketing guy that had to tap dance around to try to save this humiliating, failing pitch.
|
|
|
|
|
Pete Kelley wrote: I felt awful for the marketing guy that had to tap dance around to try to save this humiliating, failing pitch Wow. It must have really been awful.
In my case if I saw a marketing guy drowning in gasoline, I'd hand him a lit match...
Software Zen: delete this;
|
|
|
|
|
Yes, but only in a situation like this:
1) I need to change something in a database, that is really complicated to do using only SQL instructions.
2) Using any of my programs, I create a new button. I never use the name proposed by Visual Studio, but in this case it does not matter
3) I create the code I need to modify the database (Read data, change it, write it back)
4) I run the program and go to the module that has my button.
4a) Of course, I press the button.
5) The job is carried on.
6) I stop the program.
7) I delete the button
That's it. The button's life is just the time it takes to change my database. (Or whatever stuff must be done)
|
|
|
|
|
Never in production code.
Many of my solutions include a "scratch" project which I use as a testbed for writing code like you mention.
The app never sees the light of day.
The code never gets pasted from that app to the real apps.
Real programmers use butterflies
|
|
|
|
|
Well, it VARIES. (Obligatory Answer).
Like many here, I use i,j,k, and occasionally other single letters for loops and counters. It's habitual enough that their purpose actually screams out "I am a counter".
But, in general, I do it in camelCase because it's eye-friendly to me and follow the following:
"If you don't have time to do it right the first time, how will you find the time to do it again?"
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
IBHosed - variable for checking connections
|
|
|
|
|
I tend to use descriptive names. I keep this code around for 10 years (yep, 10 years) and I've discovered I sometimes need to go back to it.
Now the oddest name I used was the loop control in a language that didn't have infinite loops. The loop was (old ALL CAPS language)
DO
....
UNTIL HELLFREEZESOVER
Unfortunately that program terminated in 2004 when the Red Sox won the World Series.
|
|
|
|
|
Code right or code not. There is no try.
|
|
|
|
|
From the original post...
Does anyone else do this?
Absolutely not. I learned a long time ago that a lot of POP code becomes production code. Like one of the other respondents posted...
Code right or code not. There is no try.
|
|
|
|
|
Err... I would never hire you if I was an interviewer.
I name everything properly, even in a throw away / practice program.
Habit is something that's hard to change.
Have a good habit.
|
|
|
|
|
I think you should always make the decision before you code: Is it one-way disposable code or is it production-level clean code. The latter can take up to twice as much time, so you should decide carefully. So when you decide to use throw-away code in production, you *have* to invest some more time to make it nice and neat. At least that's the way I do it.
|
|
|
|
|
|
I lived there[^] - or as I call it, my Eleven Year Sentence.
All those jokes - like what has 500 legs and 12 teeth? Two Hundred Fifty West Virginians - well, they're true. "Deliverance", light. Hunting, Guns, Canning - that's pretty much it.
And, from my own observations: If someone ever tells you to "stick something where the sun don't shine" - just ship it to WV.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
IMHO, a post like this has no place in the Lounge. It serves no constructive purpose at all.
|
|
|
|
|
Slacker007 wrote: It serves no constructive purpose at all SO ?For that matter, as an ironic note, you reply servers no constructive purpose, either.
Perhaps,
IF in your vast experiences, you can add your views of your time spent there?
ELSE, that old saying can well be said: "Physician, heal thyself!"
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Sometimes, I think you miss the Soapbox so much, that you poop on the floor here just to see who complains about the smell.
|
|
|
|
|
|
It's almost always me that complains. I am probably his only audience member.
|
|
|
|
|
I never say anything But Slacker I think you are correct.
To err is human to really elephant it up you need a computer
|
|
|
|
|
Or, perhaps to catch flies? Perhaps this will make you happy ? 💩 Now - settle down & relax!.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Slacker007 wrote: IMHO, a post like this has no place in the Lounge. It serves no constructive purpose at all.
And posts in the lounge usually are?
Well, I certainly found it interesting, and it certainly applies to people who work in this field as many of us can (and currently are) working remotely, so not really sure what you're upset about.
|
|
|
|