You may perhaps still remember that inheritance in OOP is introduced in most of the books by an association with 'genetic' inheritance in the animal world, polymorphism with transportation by vehicles operated differently, etc.
A common pattern you often encounter is to retrieve some data. The retrieved data is used for ongoing lookup tasks, normally based on an input key.
At a conceptual level there are perhaps two ways to accomplish it :
- Access the underlying data each time the lookup operation is needed: directly or in a SOA like manner by calling the service layer on top of your data.
- Retrieve and cache all your lookup data in a hashtable data structure. If you are dealing with 'slow changing' data, the latency and refreshing policies are acceptable, then this might be your choice. You will gain a better performance, reduce locking and even cost of usage if your data provider charges your 'data trip' as perhaps is the case for your mainframe platform.
But what do you do every time you turn your gas oven on ?
- You rush to the grocery store and buy exactly one match. Then 'same procedure as....'
- You already have a box of matches in your kitchen and just pick up a match out of it. No trip, no extra cost.
Ingen kommentarer:
Send en kommentar