Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Business classes
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Business classes
Divers
Thread ID:
00532154
Message ID:
00532154
Vues:
53
Hello,

I created a business class "Item".
In this class there is the Save() method, the Revert() and also the OpenAllTables() method.

So after instantiation of the object I issue loItem.OpenAllTables() in order to have for sure the table open and to go to the default record set.

When I have a form (=class, no DE) where I do the data entry of one item, I drop this object on the form, and in the form's init I issue the THISFORM.oItem.OpenAllTables() command in order to open the tables that this business object works with.

In fact all other methods of the form, like Save() or Revert() just forward the message to the business object, so the form itself is only the pure interface for the user, and no rule validation or saving etc will take place.

The problem I encounter is, that the controls on the form rely on the open tables that the business object opened. I do not want to open the tables in the Load event of the form, because the form should not need "know" for example whether the businessclass works with buffering, a view or anything else. I think this is more encapsulated.

So I bind the Controlsources of the controls on the form in the form's init event after the THISFORM.oItem.OpenAllTables().

Is this the right approach to this situation, or are there better ways of doing the 2 tier design?

I know that this is a long story, but this question has bothered me for some time now, so I would really appreciate some more information on this desing issue.
Christian Isberner
Software Consultant
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform