Last Revision — April 19, 2022
1 Min Read
---
Dispensables
Unnecessary Complexity
Between Classes
- Dubious Abstraction (antagonistic)
- Lazy Element (causes)
- Dead Code (causes)
Martin Fowler in book (1999): "Refactoring: Improving the Design of Existing Code"
Developers are humans, and humans are bad guessers [1]. Developers tend to create additional features in preparation for the future, guessing they will be useful, but that time never came. This problem lies within the human psychological nature and, contrary to their best intentions, it just clutters the code.
Psychologically, humans tend to anticipate scenarios and prepare for them.
The whole system is trying or expecting to do more than it is supposed to.
Each additional method, class, or module increases the required time and effort to understand it as a whole.
Context: Medieval Fighting Game
class Animal:
health: int
class Human(Animal):
name: str
attack: int
defense: int
class Swordsman(Human):
...
class Archer(Human):
...
class Pikeman(Human):
...
class Human:
name: str
health: int
attack: int
defense: int
class Swordsman(Human):
...
class Archer(Human):
...
class Pikeman(Human):
...