When I design my system from scratch, I often face a dilemma whether my object should push information into another objects OR whether the objects should pull the necessary data from another objects.
Is there anything like a standard in OOP design, that I should prefer data pull by objects, versus data push into objects?
Can anyone experienced advise, whether one approach is better over the other from longer term viewpoint, or when the OOP structure/framework/diagram gets more complex?
If you're taking information out of a database, out of a system, that's pulling. If you're putting information into a database, you're pushing.
Pull notification means a client requesting a server to check if there are any updates. Push notification means a server notifying a client about the updates.
A force that changes the direction of an object towards you, would be a pull. On the other hand, if it moves away, it is a push. Sometimes, force is simply defined as a push or pull upon an object resulting from the object's interaction with another object. Hence, any kind of force is basically a push or a pull.
Push and pull distribution strategy is all about directing your promotional route to market. Either by the product being pushed towards customers or your customers pulling the product through the retail chain towards them.
According to tell dont ask, push is better - or more OO. You don't want to query object for data so you can do something, you want object to do it, because he's the one who knows his data.
Related article about evil getters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With