DEV Community

Discussion on: What is the worst code you have ever seen/written?

Collapse
 
jfrankcarr profile image
Frank Carr

The worst I've seen is legacy code from internal corporate applications that was written over a long period of time (10+ years) by either unskilled developers or multiple developers/contractors at different times. There is serious "code rot" throughout the code base. Testing outside of the full production environment is virtually impossible. If you took the principles of SOLID and DRY and reversed them, you would have this kind of code.

One common example I used to see a lot in the VB6 days and that's still around sometimes today is running an application on users' systems in the IDE rather than compiled. Why? Because the application won't work correctly compiled to an EXE! Often this is due to a dependency problem that couldn't be resolved by the developers.

There was a cut-and-paste masterpiece I had the misfortune to work with where the original developer bragged about it having a million lines of code. It probably did although well over half of it was the same code with minor modifications. Database access was scattered all over the place so it was difficult to know exactly which function was going to be called when. Any modification anywhere in the code was very likely to cause serious problems elsewhere. It was the definition of brittle code.

Collapse
 
chrisvasqm profile image
Christian Vasquez

"If you took the principles of SOLID and DRY and reversed them, you would have this kind of code."

daaaamn