Bad code doesn't just appear in a code base; programmers write bad code. Most of the time, bad code can be written because of any of the following reasons:
- Use of wrong approaches by developers when writing code that is often attributed to tight coupling of components
- Faulty program designs
- Bad naming conventions for program elements and objects
- Writing code that is not readable as well as having a code base without proper test cases, thus causing difficulty when there is a need to maintain the code base