Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data objects
Message
From
28/11/2000 12:30:13
 
 
To
28/11/2000 07:17:31
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Miscellaneous
Thread ID:
00446076
Message ID:
00446263
Views:
16
Christian,

>Maybe I did not search very much, but I was wondering whether someone here can point me to a good example or description of using data objects, and generally how to use more OOP in data handling procedures.

Generally speaking, related to OOP with data handling, you would have a base data class (perhaps defined in code based on the Session class) with generic methods and properties to handle routine tasks such as selecting a record based on ID, saving an edited record, getting a blank record, saving a new record, a "stub" validate method (usually coded in a specific subclass), perhaps pre-save and post-save methods that can be used for specific subclasses, etc.

Those generic methods, such as GetRecordByID, would likely have code to construct a SQL command, either for local Fox data or for other databases. You might have a layer of subclasses with different code for different backends, to account for differing SQL syntax, or you might bridge out to different data behaviors that could be attached to the class for different backends.

At any rate, you would then create subclasses for specific business objects, filling in properties for the table name, the ID field name, perhaps a default WHERE clause for a SQL SELECT statement, a default order, and overriding methods where necessary, such as Validate mentioned above.

You might get some good ideas from studying the docs for the various commercial frameworks.

Also, there is a very good article on nTier Design with Visual Foxpro by Doug Hennig in the Summer issue of CoDe Magazine (www.code-magazine.com).
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Previous
Reply
Map
View

Click here to load this message in the networking platform