crap coding for myself. What variable names do you use?
-
so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?
To err is human to really elephant it up you need a computer
IBHosed - variable for checking connections
-
I'm with Marc: never. Why not? Because you will not find the time to go back and correct it - it will be permanent. That's why I "do it right" even for throwaway apps: parameterized queries, proper names, no default control names from Visual Studio, and so forth. Do it right all the time, and you don't get into bad habits which enter production cycle.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?
To err is human to really elephant it up you need a computer
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. :)
-
so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?
To err is human to really elephant it up you need a computer
Code right or code not. There is no try. :)
-
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.
-
It seems like I am the only one, but I am with you on this one... sort of. The only non descriptive variables I use for i, j & k in for loops. This is a throw back to my Fortran programming days. i, j & k were integers, other letters were floats. However. When I say descriptive, I do use names like 'something', 'stuff', 'thisOne', 'thatThing', etc. Sometimes, these do creep into production code, but not in a way that is confusing to the future being that has to deal with my code.
Nothing succeeds like a budgie without teeth.
Wizard of Sleeves wrote:
I use for i, j & k in for loops
I have the same less-than-great habit, also a hangover from my FORTRAN days (the fact that I type FORTRAN in upper case tells you how long ago that was). I have moderated the habit a little over the years, often making the names of the form
_ABC_i
where the_ABC_
prefix is a descriptive acronym for the array being indexed.Software Zen:
delete this;
-
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;
-
so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?
To err is human to really elephant it up you need a computer
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.
-
so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?
To err is human to really elephant it up you need a computer
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.
-
so frequently I find myself doing a proof of concept very short code that I am going to flush out later. Sometimes I even flush it. Pun intended. Anyway I frequently use variables like the following. astr - it is A String Temp table #ewww - because the data in the table is stinky at best. and so forth. I always promise myself to clean it up before I actually use it anywhere. Sometimes I even do. Does anyone else do this?
To err is human to really elephant it up you need a computer