We all take short cuts when we code, and maybe you come back and clean them up, but what are some of the bad habits you have when coding?
For me, it's not scoping my variables, and not using OO all the time. For little things, I'd rather just code it up real fast using the ole top down approach. I also use SELECT * a bunch when writing queries which is bad because I rarely need all the fields.
What are your bad habits?
Bad HabitsWe know you've got some... what are they?
27 Replies - 3274 Views - Last Post: 09 October 2007 - 12:10 AM
Replies To: Bad Habits
#2
Re: Bad Habits
Posted 07 September 2007 - 02:56 PM
Sometimes I catch myself using the obscure variable name but as soon as I put it down I always go back and rename it two seconds later. One because it irritates me and two I want to force myself into good habits. Maybe I dive into code a little too soon sometimes before fully planning something out but I have been working on that one as well.
#3
Re: Bad Habits
Posted 07 September 2007 - 03:04 PM
i'm with you Chris, sometimes I am in a rush to finish I just make it work, and don't worry about efficiency, effectiveness, or even consider other approaches to solve the problem... I blame University giving me 2 weeks (with 4 other courses of work and work itself) to do 1000-3000 line programs from scratch... often without discussing the topics ahead of time.
Justified or not, I try to break this habit when I write code for personal use.. but sometimes you just need it to work... and remembering to fix it can tough, lol
Justified or not, I try to break this habit when I write code for personal use.. but sometimes you just need it to work... and remembering to fix it can tough, lol
#4
Re: Bad Habits
Posted 07 September 2007 - 06:13 PM
I tend to really rush the last 10% of the project...it's always the most interesting part, but I'll end up rushing through it because I want it done with - this leads to shoddy code, most of the time. 
I do the same thing with SELECT * as Skyhawk does.
And I tend to play around with scope a bit too much. Things like this:
I do the same thing with SELECT * as Skyhawk does.
And I tend to play around with scope a bit too much. Things like this:
while($sth->fetch) {
my $sth = $dbh->prepare("SELECT * FROM users WHERE clue > 0");
## blah blah blah
}
#5
Re: Bad Habits
Posted 08 September 2007 - 02:25 PM
in the app i am currently programming i have used the variable boner and boner2 about 100 times.
#6
Re: Bad Habits
Posted 08 September 2007 - 02:37 PM
I'll use very short variable names...like $a, $b, $q, $t, etc. However my style of coding consisting of mainly class/methods and functions, so I don't run into naming conflicts often.
#7
Re: Bad Habits
Posted 08 September 2007 - 03:01 PM
The bad habit I hate committing the most is copying and pasting some code that should really be part of a function or routine somewhere.
For example, when generating html for 5 icons I'll get it to work once and then copy/paste it four more times only changing the SRC attribute.
"That's bad and will bite you later." my Conscience says...
"Shut up I have to have it done by the 2 o'Clock meeting and it works." I rebut through gritted teeth
For example, when generating html for 5 icons I'll get it to work once and then copy/paste it four more times only changing the SRC attribute.
"That's bad and will bite you later." my Conscience says...
"Shut up I have to have it done by the 2 o'Clock meeting and it works." I rebut through gritted teeth
#8
Re: Bad Habits
Posted 10 September 2007 - 04:05 AM
Not planning before starting a project and not using OOP and I always seem to forget finishing a function or something.
#9
Re: Bad Habits
Posted 10 September 2007 - 07:59 AM
Oaty, on 8 Sep, 2007 - 03:01 PM, said:
The bad habit I hate committing the most is copying and pasting some code that should really be part of a function or routine somewhere.
For example, when generating html for 5 icons I'll get it to work once and then copy/paste it four more times only changing the SRC attribute.
"That's bad and will bite you later." my Conscience says...
"Shut up I have to have it done by the 2 o'Clock meeting and it works." I rebut through gritted teeth
For example, when generating html for 5 icons I'll get it to work once and then copy/paste it four more times only changing the SRC attribute.
"That's bad and will bite you later." my Conscience says...
"Shut up I have to have it done by the 2 o'Clock meeting and it works." I rebut through gritted teeth
Yes I have seen myself in this same boat before as well. Although I have seen a co-worker of mine actually make a decent first page and not do anything until crunch-time (the time after he procrastinated and now the project is due) and have pretty much just a background for the rest of the site. It's almost humorous... until I am the one on the weekend correcting it.
#10
Re: Bad Habits
Posted 10 September 2007 - 09:54 AM
my bad habit is the lack of commenting in code. i usually don't use comments except now in C# i use the summary and parameters to describe the functions, where previously i didn't use them much in vb.
#11
Re: Bad Habits
Posted 10 September 2007 - 02:18 PM
My worst bad habit is probably that I find it hard to accept some coding standards of the companies I work for it they are totally against what I'm used to doing. Generally I'll try to sneak in my own preferences and see if anyone notices.
The last bank I work for wouldn't let me code if statement like this:
they insisted on this:
which used to drive me crazy and I fought against it for ages.
The other bad habit stems from using Eclipse. It actively encourages you to refactor. You see a method named wrong, double-click, hit Shift-Alt R, rename, then watch as Eclipse trawls through all the necessary classes and mends everything. It's obviously the right thing to do but you keep having to explain yourself why a simple code change has resulted in so many affected files.
The last bank I work for wouldn't let me code if statement like this:
if (...) {
}
they insisted on this:
if (...)
{
}
which used to drive me crazy and I fought against it for ages.
The other bad habit stems from using Eclipse. It actively encourages you to refactor. You see a method named wrong, double-click, hit Shift-Alt R, rename, then watch as Eclipse trawls through all the necessary classes and mends everything. It's obviously the right thing to do but you keep having to explain yourself why a simple code change has resulted in so many affected files.
#12
Re: Bad Habits
Posted 11 September 2007 - 05:09 AM
HAHA, you really can't do much about it.
Everyone has their own indenting styles.
I usually use the latter.
I guess they forced the indentation style to maintain readability across the entire code.
Everyone has their own indenting styles.
I usually use the latter.
I guess they forced the indentation style to maintain readability across the entire code.
#13
Re: Bad Habits
Posted 11 September 2007 - 05:45 AM
An indentation guide is like the most idiotic thing I've ever come across, since the most basic IDEs support the feature to indent your code with a keypress to whatever format you prefer, so it's like totally unnecessary to bug the programmers with it - actually none of the more professional places I've been to required it. (If it is so important and mission critical for the company run an identator app on the version control server)
Just to make it clear: I am not agaisnt correct indentation (it's really essential), but against forcing one format onto everybody.
Just to make it clear: I am not agaisnt correct indentation (it's really essential), but against forcing one format onto everybody.
#14
Re: Bad Habits
Posted 11 September 2007 - 06:25 AM
I'd agree with that. I actually quite like all the programmers to have similar but different styles. It makes it easy to see what you coded and what you can trust.
#15
Re: Bad Habits
Posted 11 September 2007 - 07:51 AM
What I cannot stand are the crappy, poorly thought out and written requirements that the supposed "Project Managers" I work with create. They are not technical but its a requirements doc, why the h**l cant they just clearly and explicitly state what they want? Ok, Ill get off my soapbox...--jp
|
|

New Topic/Question
Reply



MultiQuote









|