It's a jungle in there
-
I feel your pain. I've just finished going through a similar process. After a while you stop getting annoyed and start laughing. The one that made me laugh most was:
public class OrderName
{
public String getName {
return "Order";
}
}That was the class in totality. One method that returned a hard coded value. [EDIT] I just found a better one:
for (int i = 1; i < 2; i++) {
//Code was here
}"You get that on the big jobs."
modified on Sunday, August 14, 2011 10:23 PM
-
I was refactoring a horribly written app. Tons of duplicated code. Crazy amounts of dead code (~30-50%). And my personal favourite, was a method that went something like this.
public void Some_Method()
{
try
{} catch (Exception x) { LogException(x); }
}
Fortunately, or not, this method was never called...but I sure am glad the catch block was there....just in case that empty try block failed.
-
Naerling wrote:
Perhaps the empty Catch is also VB6 inspired... OnErrorResumeNext
Is it just me or everytime someone talks about bad code, "VB" shows up? :sigh:
"To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson
Fabio Franco wrote:
Is it just me or everytime someone talks about bad code, "VB" shows up? :sigh:
It's just you - the worst code was (and may still be) written in C/C++ by former BASIC, COBOL, and FORTRAN programmers still new to Dykstra's "GoTo Considered Harmful" dictum...which didn't prevent them from abusing every feature in the language. I spent years cleaning such code, and still don't think I got everything fixed the way it should be (e.g. readable). BASIC, COBOL, and FORTRAN all allowed really bad code to be developed, real "spaghetti" code, but recasting the same engineering in C (or, worse by two or three orders of magnitude in this age of templates, C++) permits monstrosities to be created that even the coders may not be able to understand after a month or two working on other projects. Worse, with macros, you can make C/C++ look like BASIC or FORTRAN...perhaps even COBOL, though I've never seen anyone sick enough to try that (yes, I've seen examples of the other two practices, and it just makes you ill to see it if you ever loved C). As for On Error Resume Next....what other language system can anyone name that is as ubiquitous as BASIC, COBOL, FORTRAN, or C that allowed a non-in-line interrupt-style error handler to be constructed? Yes, the only one that comes to my mind, as well, is BASIC. On Error GoTo was a huge advance for its time; On Error Resume Next was, really, just a way to allow "old-fashioned" error handling (checking output variables and return values for error conditions) to be used or not. Most of the cocks-of-the-progamming-walk who complain about the foibles of this feature just weren't around to complain about it in 1968 when Dartmouth BASIC was released; if it seems a dated feature now, well, OF COURSE IT IS. Hmmm, does this count as a rant? :laugh:
-
Fabio Franco wrote:
Is it just me or everytime someone talks about bad code, "VB" shows up? :sigh:
It's just you - the worst code was (and may still be) written in C/C++ by former BASIC, COBOL, and FORTRAN programmers still new to Dykstra's "GoTo Considered Harmful" dictum...which didn't prevent them from abusing every feature in the language. I spent years cleaning such code, and still don't think I got everything fixed the way it should be (e.g. readable). BASIC, COBOL, and FORTRAN all allowed really bad code to be developed, real "spaghetti" code, but recasting the same engineering in C (or, worse by two or three orders of magnitude in this age of templates, C++) permits monstrosities to be created that even the coders may not be able to understand after a month or two working on other projects. Worse, with macros, you can make C/C++ look like BASIC or FORTRAN...perhaps even COBOL, though I've never seen anyone sick enough to try that (yes, I've seen examples of the other two practices, and it just makes you ill to see it if you ever loved C). As for On Error Resume Next....what other language system can anyone name that is as ubiquitous as BASIC, COBOL, FORTRAN, or C that allowed a non-in-line interrupt-style error handler to be constructed? Yes, the only one that comes to my mind, as well, is BASIC. On Error GoTo was a huge advance for its time; On Error Resume Next was, really, just a way to allow "old-fashioned" error handling (checking output variables and return values for error conditions) to be used or not. Most of the cocks-of-the-progamming-walk who complain about the foibles of this feature just weren't around to complain about it in 1968 when Dartmouth BASIC was released; if it seems a dated feature now, well, OF COURSE IT IS. Hmmm, does this count as a rant? :laugh:
cpkilekofp wrote:
Hmmm, does this count as a rant? :laugh:
Oh definitely :laugh: . Please don't take this personally :)
cpkilekofp wrote:
the worst code was (and may still be) written in C/C++
Nobody said that the worse code seen was in VB. The joke was about how often the name Ugly Betty comes up whenever we are talking about ugly girls.
"To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson