|
-
February 10th, 2005, 05:19 AM
#1
Frequently encountered errors
Hi
I want to know what errors do you meet often in not yours code,in code of beginner. Especially, code which works, but still bad?
-
February 10th, 2005, 08:11 AM
#2
Re: Frequently encountered errors
Code errors on codes that works?
You probably mean general problems with a beginner's codes because if it works, it has no error.
I have little experience evaluating other beginner's codes. I can only recall that when I compared my codes lately with my codes when I was a beginner, I often find something like:
- There are variable assignments that can be placed strategically to make progam more efficient. Example, I sometimes assign values inside a loop when that value does not necessarily change on the duration of said loop.
- Because I cannot memorize all functions, there are instances when I create one not knowing that it's already available.
- I have tendencies to use variable type larger than necessary (in VB - Long instead of integer) because I felt then they're "much safer."
- sometimes I defined dead variables or even dead functions.
To sum it all, my common "error" (if you put it that way) is that my beginner's codes are often less efficient -- but they have worked.
Last edited by aio; February 11th, 2005 at 08:28 AM.
Marketing our skills - please participate in the survey and share your insights
-
-
February 10th, 2005, 08:22 AM
#3
Re: Frequently encountered errors
I mean errors which reduce effectiveness of code
or in future during redesign or some modifications cause errors
or make something more complicated than it is.
-
February 10th, 2005, 08:42 AM
#4
Re: Frequently encountered errors
If you think you CAN, you can, If you think you CAN'T, you are probably right.
Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.
-
February 10th, 2005, 09:05 AM
#5
Re: Frequently encountered errors
 Originally Posted by TOMNKZ
I mean errors which reduce effectiveness of code
or in future during redesign or some modifications cause errors
or make something more complicated than it is.
Things like ....
Accidently keeping references to objects that are no longer needed 
Automatic garbage collection is nice .... if you remember to cut the references to the objects 
Removing references to objects which are needed again later in the code, so one creates the same object several times.
-
February 10th, 2005, 09:52 AM
#6
Re: Frequently encountered errors
I hate finding this in (not necessarily) beginners code:
Code:
bool function()
{
if (<bool expression> == true)
{
return true;
}
else
{
return false;
}
}
N.B. I'm not referring to languages where bool is not an actual type.
Useful? Then click on (Rate This Post) at the top of this post.
-
February 11th, 2005, 06:28 AM
#7
Re: Frequently encountered errors
This is what I've found...
these are not exactly errors in *code* :
-forget to commit updates in DB.
-forget to insert comments in code to make other coders' life easier.
-do not follow coding standards
-In GUI - forget about TAB ORDER of objects on sreens...as they (beginners) usually use mouse they forget about the users who prefer to use keyboards to enter data.
-In GUI they type messages that are not understood by users.... like for example, Operation Commited, instead of, for example, Application Sumitted.
That's all I can think for now.
-
February 11th, 2005, 08:33 AM
#8
Re: Frequently encountered errors
 Originally Posted by cloureir
This is what I've found...
...
-In GUI - forget about TAB ORDER of objects on sreens...as they (beginners) usually use mouse they forget about the users who prefer to use keyboards to enter data.
...

I totally agree with this one. Most beginner thinks that all users depended so much on mouse. I have encountered several of these on some of my newbie office mates before.
And if I may add, there are lot's of tendencies newbies would overkill the design of the forms(like fonts too big, and multi-colored which in most instances are rather nuisance than helpful).
Marketing our skills - please participate in the survey and share your insights
-
-
February 12th, 2005, 07:07 AM
#9
Re: Frequently encountered errors
 Originally Posted by TOMNKZ
Hi
I want to know what errors do you meet often in not yours code,in code of beginner. Especially, code which works, but still bad? 
I have to add here that can exist bad code which still works but not forever. And this is the most dangerous because usually it crashes after the testing phase at the customer.
For example:
Last edited by ovidiucucu; February 12th, 2005 at 07:29 AM.
-
February 12th, 2005, 07:19 AM
#10
Re: Frequently encountered errors
For C/C++/Java you can use this analysis tool to detect bad style issues in source code.
-
February 15th, 2005, 05:27 AM
#11
Re: Frequently encountered errors
Years ago I saw this:
"Delete From Table_XXX"
that's it.... no Where clause!!!!!
Fortunately the DBA restored the data.
-
February 16th, 2005, 05:40 AM
#12
Re: Frequently encountered errors
These also can generate trouble in a program sooner or later:
Code:
SELECT * FROM blahblah
Code:
INSERT INTO blahblah VALUES(...)
Last edited by ovidiucucu; February 16th, 2005 at 06:08 AM.
-
February 16th, 2005, 05:49 AM
#13
Re: Frequently encountered errors
This stupid one made computer frozen (at the client of course ):
Code:
..... WHERE ...<some good joins here>... AND a='A' OR a='B' OR a='C'
instead of:
..... WHERE ...<some good joins here>... AND a IN('A','B','C')
-
February 16th, 2005, 06:06 AM
#14
Re: Frequently encountered errors
Returning to C/C++
This one makes me often feeling sorry I have not a machine gun:
Code:
HRESULT hr = SomeFunction();
_ASSERTE(SUCCEEDED(hr));
-
February 16th, 2005, 07:24 AM
#15
Re: Frequently encountered errors
Here's one that makes me wish a had a gun:
Code:
byte _AnalogProperties[8]; // no initialization here
if(<condition>) // this one can be false
{
// perhaps a loop here
_AnalogProperties[some_index] = some_value;
}
SetTheseProperties(_AnalogProperties, sizeof(_AnalogProperties));
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|