push vs pull : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

push vs pull
If you had a stock market program that periodically asked the value of various stocks, that would be pulling from the database. If your stockbroker’s computer sent your application a message any time one of the stocks you are interested in changed, that would be a push application.

Inside Java, you run into the push-pull quandary all the time. All your classes are bristling with get/set methods, but whose job it is to call the get method of class A and relay the information to the corresponding set method of class B? E.g. where A is a data object and B is the corresponding GUI (Graphic User Interface) object. If A does it, you are pushing. If B does it you are pulling. If class C does it you are controlling.

GUI objects are usually tree structured, Panels within Frames. Frequently, data passed to a Frame gets then passed to a Panel and finally to some Component, with often many more layers than that. Should data be relayed down the hierarchy or passed directly?

You can see there many possible combinations of push/pull and indirect/direct, all of which would technically work. However, if you are not careful, you will create a rat’s nest and you will have no idea how to find the code you are looking for.

Here are some rules of thumb to help create order:


This page is posted
on the web at:

http://mindprod.com/jgloss/pushpull.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\pushpull.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[18.227.209.101]
You are visitor number