An anti-pattern is a concept used in programming to define patterns (or practices) of writing code that are undesirable. It often comprises ineffective, complex, or ambiguous methods of writing code. The term acts as the opposite of a design pattern, which means desirable coding practices.
Use Cases and Examples
There are a number of programming practices that can be considered an anti-pattern. Some are listed as follows:
- Spaghetti Code is a common anti-pattern characterized by a lack of planning and inexperience leading to messy code that is hard to read and comprehend, and often contains errors that might not be noticeable on the surface but build up to difficult to manage source code.
- Golden Hammer is another anti-pattern that is often used to describe a programming practice that is not relevant or effective for the project at hand. It does not mean that the programming practice itself is bad, rather just irrelevant to the code at hand.
- Dead Code is an anti-pattern used to describe code that does not perform any function within the overall code but still remains there.
In essence, anti-pattern comprises unwanted programming practices that lead to overall poor code quality.All terms