|
> From: Booth Martin > > Right. Good idea. Lets see an example Joe. Perhaps a simple > example:adding an address to a person's name. They live in Quebec, Canada > and have provided "Qu" as their province. (Quebec is usually "PQ") > > We don't need real code, but what does get done where? This actually kind of a cool example. Let's say that you start out with a standard customer file, with a customer name, address and all that jazz. You might define a business entity to be "Address", which contains a bunch of attributes, including street address, state/province, postal code, and so on. Your code is simple: GetAddress(customer) In this simple environment, this will return a data structure containing the information from the customer master. Now, however, you decide to increase your capabilities a little bit, and you add ship-to addresses. You can split off the address information into a separate file, add a *NOPASS parameter to your GetAddress, and suddenly you've created the following: GetAddress(customer) returns the corporate address GetAddress(customer : shipto) returns ship-to address This is starting to get interesting! Now let's say you decide to have a generic lookup scheme, where you store all addresses in a file, with a type and a generic key. You add a new procedure: GetTypedAddress(type : key1 : key2) Now, you say, the old GetAddress is broken. Not so! You simply subsume the code into the GetTypedAddress, and then modify the GetAddress as follows: GetAddress(customer : shipto) return GetTypedAddress('C' : customer : shipto) Pretty cool, eh? Not only that, the GetTypedAddress can be smart enough to access your database for local information, but if it recognizes that the information is not locally available it can get it smoe other way, transparently to the application. For example, let's say it's a ship-to address from a client - GetTypedAddress might invoke a web service on the client box to get the info. This level of abstraction is very powerful when done correctly. Joe
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.