Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Datasessions
Message
De
22/03/2007 10:24:44
 
 
À
22/03/2007 10:11:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01206843
Message ID:
01207061
Vues:
19
Ed,

>I meant that it's advised to make code error-proof...

I certainly agree that anticipating possible errors and coding for them is a good practice.

>... My major point was that if code (class) is encapsulated (i.e. as you said, it doesn't depend on any state of databases or tables outside of itself) then you don't need in private datasession at all.

The encapsulated code may not DEPEND on any state of databases or tables outside of itself, but if may CONFLICT with the state of databases or tables outside.

The example I referred to of encapsulating old code inside methods of Session subclass is done precisely for the purpose of enabling that code to be used anywhere in the application without any chance of its data-handling activities stepping on the data environment outside of the class.

This allows you to quickly take, for example, large blocks of horrendous code that select numbered work areas, open and close tables and or databases, and so forth. Encapsulating it inside Session is a quick and easy way to reuse that code safely. It might be better to complely rewrite it, but sometimes isolating it is the best incremental step to take, even if it will be rewritten later.

In the scenario described above, I don't bother to explicitly set datasessions back and forth because the Session class handles that very well.
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform