2 ms·
The biggest upside of programming with objects/classes is dependency injection. And no, I don't mean DI frameworks like Spring. I mean simply the dynamic (i.e
by lliamander 7y ago
The biggest upside of programming with objects/classes is dependency injection.
And no, I don't mean DI frameworks like Spring.
I mean simply the dynamic (i.e. runtime) composition of program behavior, typically by passing collaborating objects into the constructor. (Functional programming languages have something similar with higher-order functions.)
Contrary to prior claims, objects aren't great at representing real world entities: to do that you would also need to add a notion of time and concurrency to those objects (e.g. actors, processes, services). However, they are a great way to represent the components and capabilities of such entities.