Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper Encapsulation Techniques?
Message
From
22/09/1998 14:57:11
Bob Lucas
The WordWare Agency
Alberta, Canada
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00131613
Message ID:
00139571
Views:
13
>>The more I've considered how bizobj are intimately related to their data the more I like the idea of creating properties on the bizobj representing data fields. I've started a small app to examine this idea further.
>>
>>I especially like how this ties in with VFP's access and assign methods. No longer will I have to place validate code in controls if I want validation right away or batch validation in a method if I want to validate all the fields before a save.
>>
>>There are a few items that have come up, however: How do you deal with different field types? I believe property strings can only be 255 characters long, so how do you place a memo field in the property? The same goes for a general field type.
>>
>>The only other problem I foresee with this is having to write the equivalent of a GetFldState function.
>>
>
>Michael,
>
>I prefer to not use properties as it makes subclassing the bizobjs for sepcialization cleaner, in my opinion. If I use properties then I will be introducing new properties to subclasses which rubs me the wrong way when thinking about the idea that superclasses should introduce the interface and subclasses should use the interface.
>
>It is easy enough to create control classes that can read the controlsource during their Init and remap everything to the bizobj.


I have thought about this too, but look at it another way. If you have a business object that has a 'cursor object' as one of its references, like obizobj.calias = , then you can consider the cursor object to have a collection of properties (identified by fields() collection). There is no need to create properties in the business object subclass to match the properties of the cursor.

Sure, the syntax is a little different (you can't use obizobj.calias.field(1).value = ) but it isn't a whole lot different.

Cursors are special objects. I think the operations that work on them should be handled by the business object (new, save, delete, etc) but we can still work directly with their properties, as in thisform.txtname.value = customer.name.
Previous
Reply
Map
View

Click here to load this message in the networking platform