POP VS OOP
If you find your self having similar code in many places, your probably doing it wrong. consider using POP. Because with POP you can reuse the same code.
Drawbacks with pop:
ITs harder to understand the structure, what overrides. Ive developed a way of thinking about called “shallow deep” Basically. Shallow calls are calls that comes from class. And deep calls are calls that comes from a template method in a protocol. You can override calls coming from template methods, But at that point you can only call the same method across. calls form shallow on the other hand can also override and call a sort of “super” on the same method. The drawback is that you have to be peculiar when you design your method chains when compositing with protocols. As oppose to OOP where you can easily just call up and down the hierarchy with super and override. Ill explain with a diagram:
- Easy to maintain
- Zero duplicate code (Get your codacy/Codebeat GPA up)
- Supports Multithreaded code
- Makes your code more modular
- Add new functionality to your code w/o affecting altering underlying code. Light code injection.
- Less code per class
- Hard to get working
- Hard to understand the architecture of your app. What calls what? what blocks?
- Mixing OOP and POP things get complicated.
- Easy to get working
- Easy to see where calls go and come from
- Complexity grows
- Hard to maintain
- Duplicate code grows as your project grows
- Impossible to maintain after a point.
- More code per class