|
stupid porgramming
|
View this Thread in Original format
| malek |
I have to maintain software and some of the code I see is heart braking... its bad really bad.
If you have examples of your own, please post:D
example 1:
start = 1
if (start > 1) then
... code
else
... code
end if
example 2:
if (a > 0 )
...if (b > 0)
.......code
.......x = 2
...else
.......code
.......x = 2
...end if
else
...if (c > 0)
.......code
.......x = 2
...else
.......code
.......x = 2
end if |
|
|
| _Nut_ |
PHP:
All part of a METAR reading subroutine. This is about 1% of it, and I just found an issue in the LST conversion... boo urns. broken |
|
|
| winnowingfan51 |
PHP:
:wtf:
Yea... in our CMS that we use, the guy that wrote it assigned $this to something else. SERIOUSLY WTF?! |
|
|
| LeopoldStotch |
seriously, i have seen this before at work.
code:
a=true;
i=0;
while(a == true) {
i++;
if (i>0)
a = true;
}
|
|
|
| witchsabbath258 |
| quote: | Originally posted by LeopoldStotch
seriously, i have seen this before at work.
code:
a=true;
i=0;
while(a == true) {
i++;
if (i>0)
a = true;
}
|
Thats almost as bad as this.
code:
some_psuedo_function {
if(x == 0) {
return x;
} else {
//continue
}
}
Though technically its bad practice to have a return anywhere but the last statement (at least thats what I been told :p).
Also I guess you could be checking something for x and then doing something special if it doesnt meet the return value or something, I dont know.
Over complexity. |
|
|
| LeopoldStotch |
| quote: | Originally posted by witchsabbath258
Thats almost as bad as this.
code:
some_psuedo_function {
if(x == 0) {
return x;
} else {
//continue
}
}
Though technically its bad practice to have a return anywhere but the last statement (at least thats what I been told :p).
Also I guess you could be checking something for x and then doing something special if it doesnt meet the return value or something, I dont know.
Over complexity. |
you are right, however i have been in many companies with many people touching the CVS, and i have learned the "less" changes, the better. i have seen that before, and i have also seen this.
code:
some_pseudo_function {
if (x ==0)
return x;
//continue
}
where everyone knows once the prog executes the return, it pops out of the function. bad programming practices, but sometimes the "less is more" philosophy works. |
|
|
| malek |
| quote: | Originally posted by LeopoldStotch
seriously, i have seen this before at work.
code:
a=true;
i=0;
while(a == true) {
i++;
if (i>0)
a = true;
}
|
wow:nervous: |
|
|
| Dr. Cfire |
How about bad variable names.
In one function the idiot assigned these variables
Torque
torque
Ratio
ratio1
Maintorque
mainTorque |
|
|
| LeopoldStotch |
| quote: | Originally posted by Dr. Cfire
How about bad variable names.
In one function the idiot assigned these variables
Torque
torque
Ratio
ratio1
Maintorque
mainTorque |
someone told me this quote ... "if you find yourself F3ing a lot, then the person who wrote the program sucks at naming variables" (he was referencing the F3 function to "goto variable decleration" in eclipse). |
|
|
|
|