Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OO Proper Design
Message
De
14/11/2001 10:51:02
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
14/11/2001 10:39:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00581500
Message ID:
00581543
Vues:
19
I don't know if this is perfect OOP-design, but:

You can have one global variable for one object, another for the other one. In one object, you can invoke method from the other one.

To avoid having many public variables, you can have a single public variable for the "application object". In your example, this can store references (in properties) to your license manager, your shutdown-manager, and many others more.

Sample code:
goApplication = CreateObject("cApplicationObject", (optional parameters))

...

* cApplicationObject.Init():
This.oLicenseManager = CreateObject("cLicenseManager", (optional parameters))
This.oLoginManager = CreateObject("cLoginManager", (optional parameters))

...

if (you need your users to log out for some reason)
  goApplication.oLoginManager.AskAllUsersToLogout()
endif

...

* Example, where one class needs to invoke another
* In cLoginManager.Init()
goApplication.cLicenseManager.IncrementUserCount()
HTH, Hilmar.

>Hi,
> Oopps. hehe.. sorry.. tahnk you for your reply.
> Hmm.. Actually I post this question before, However I would liek to get more ideas..
> I have two classes, license manager and adminshutdown (as shown in FP Advisor on June 2001 issue). Both using seperate array to store the each instance. It will loop through the array and call method of the instance stored to perform process.
> Once my client application startup, it will crateobject of my license manager and login, and logout if terminated. On the other hand, I have a small application in server that allow admin to get the list of "active" workstation that login to system. If necessary, admin may ask all workstation to terminate application for database update and etc. Once application teminated but adminshutdown, the logout method have to be called too.
> In OO design, i heard that one class should only do one job. So, in the case above, how to design the interface in order license.logout() will be called if adminshutdown.shutdown being called()? and also if I have more services it should not effect my whole design.
>
>Thank you
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform