Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where does the code go
Message
 
À
15/06/2000 07:09:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00380644
Message ID:
00380649
Vues:
10
There are different ways of approaching this.
If your code needs to be totally generic, bundle it into a procedure file (alternatively, if you need functions to relate to other function's values and have a lot of this, you can bundle it all into a custom class and assign properties for the shared values).
If, however, the code only needs to be accessed on a form or a collection of forms, put methods on the form (and, if a collection of forms, save the form as class). You should always avoid putting code in the click method of a button - what if you need to call it from somewhere else on the form? Click methods should just call form methods or functions/procedures/class methods.

It's all down to "how many places need this code and where?"

>I have various forms that run reports, and a lot of time, do a fair bit of processing before displaying the report.
>
>Whenever I have created these forms, I just put the processing code in the Click() of the OK button.
>
>I'm sure this isn't good practice in OOP, can anyone give me their views as to where it would be appropriate to place my "report processing" code. I would imagine it was better to have huge chunks of code in a central spot, then have the form fire it off from there.
>
>Can anyone advise?
>Thanks
>Kev
Nigel B Coates
NBC Software Services
Dublin, Ireland.
eMail: Nigel.Coates@NBCSoftware.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform