We all have been taught that reusable code is good. We all know why we should do it but there are some misconceptions about how to do it.
There are two common misconceptions about reusable code:
- Using inheritance in order to achieve code reuse.
- Creating a static utility or helper class in order to reuse methods.
Mostly these misconceptions are the result of procedural thinking. People usually understand how certain object-oriented principles work. However, it is seldom taught what is the purpose of such principles.