DEV Community

Discussion on: What is bad code?

Collapse
 
stereobooster profile image
stereobooster

I'm afraid I'm not following you

Collapse
 
sanidz profile image
sanidz

Sorry I just tried to oversimplify..
Code smell is term used to describe some possible problem in code regarding bad code, something "fishy" so to say, it can be serious or not, however it just feels wrong and its subjective.(naming, readability, complexity...see link below)
Little code smell can be tolerated and is sometimes justified, thats why bad code is code with too much smell.

One of the main reason for getting code smells from the bad code in the first place is lack of bussiness understanding + lack of technical knowledge.
Main reason for not fixing it is lack of confidence and fear to modify and refactor bad code.
List of code smells is long and depends from language and usually can be detected by static code analysis tools.

About antipatterns
Smelly code at the begining is allways acting alone, but when evolved will become serious bad code and will get its ultimate monster form as multiple antipatterns. So any "good implementation of antipattern" (is oxymoron), will be badcode as well.

Good code = badcode without smell

I find this classification really good
sourcemaking.com/refactoring/smells

At the end we are subjective and generalise, thats why we just say its bad code... :)