Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Views & OOP Design
Message
From
07/02/2000 09:27:38
Gerald McKinsey
Keystone Consulting Services, Inc.
Yorktown, Indiana, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Views & OOP Design
Miscellaneous
Thread ID:
00328224
Message ID:
00328224
Views:
64
Tools used: Visual Fox Pro 6.0, Mere Mortals, & Rational Rose UML diagrams.

If we have 3 classes created: Customer, Products, and Customer Products. The "Customer" class contains general information about our customers. The "Products" table contains each product that we have ever made that is for sale to our customers, and contains information like version number, name, product code, product initials, etc. The "Customer Products" table lists the ID's of our customers, and the ID's of the products that customer has bought, with unique information like DateBought, price paid, etc.

Now in my UI I want to open a customer, and then display all the products that they have purchased from us. In rational rose, I quickly designed something that might be wrong: I had the UI call the "Customer" class's method, "GetCustomerProductList()" and send the parameter of the CustomerID. The first thing the Customer Class does is call the method "GetCustomerProductList" from the CustomerProduct class. This returns all the product ID's that this customer has. Then I had Customer call the "Product" class's method, "GetCustomerCustomerProductList", and sent as a parameter all the product ID's. This returned all the names of the products. Then the Customer class returned to the UI all the product names of all the products this customer had.

The problem arises when we tried to implement this in FoxPro's views, and code. Calling the first view and retrieving the ID's of all the products that a customer owned was easy. But how do we pass on the results to another view? (A bunch of product ID's into a view that will return names/desc for each ID?)
And why would we want to get this complicated?

The reason I had so many different method calls & views was because I believed that in Object Oriented design and programming that we'd want to keep each class independent of everyone else. If I ever make a change in a certain class or table, it shouldn't affect anyone else's code, or method calls.

However, it seems to me the best solution for making views in this example is to make a view containing 2 tables: Customer Product, and Product. We'll return all the fields of Customer Product, and just the Name & Description from the Product table.

But which class should have the method that calls this view? Customer, Customer Product, or Product? If I ever made a change to either the Product table, or Customer Product table, how do I know which views are affected? Doesn't this violate the black box idea of keeping each class independent from one another?
Next
Reply
Map
View

Click here to load this message in the networking platform