Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data Pull vs. Push OOP Approach

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?

like image 286
Bunkai.Satori Avatar asked Apr 26 '11 15:04

Bunkai.Satori


People also ask

What is the difference between pushing and pulling data?

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.

What is the difference between push and pull notifications?

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.

What is the push and pull?

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.

What is push pull model?

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.


1 Answers

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

like image 72
Kamil Tomšík Avatar answered Sep 20 '22 05:09

Kamil Tomšík