Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Commonly misused and abused VFP features
Message
 
À
31/12/1999 13:27:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00310951
Message ID:
00311044
Vues:
47
>>1: Inheritence has to be the single most commonly misused feature of all OO languages.
>
>Sure can be, but I'd rather see it abused than not at all :-) Can you give a good example?

Ok, here's my favorite (is that the reight way to say that?) abuse of inheritence. I create a form class, then I subclass it and put buttons in it, and I subclass it again and put different buttons in it etc.. This would be mych better handled by using a factory pattern that would create teh required buttons at the Init of the form object.

Create an Save button class and then subclass it to provide differing code in the click event. Much better to have one Save button that calls some other method of some other object for the behavior.

Thereare many many mroe possible examples.

>>4: Filtered indexes, are often used where they are not necessary. The same result can be obtained using SQL without the overhead of having an extra index tag around all the time.
>
>I have never used a filtered index in VFP. I cannot see the point.


I used them a few times. One was for a system for a Bank's CD renewal operation. Each operator was assigned to a specific geographical region so it was pretty fast to have 6 filtered indexes one for each region instead of selecting the regions through a filter or select command.

>>6: PUBLIC variables are often used in situations where they are totally not required.
>
>Like...hmmm...in ALL situations? My only disagreement with you on this is with some objects. Like I might want to fire up a public instance of Excel the first time I need it and not in my startup code.

Again, If the sapplication needs to ahve access to teh excel object from all over the place then create the variable in the startup program;
* Startup program
PRIVATE oExcel
oExcel = NULL
Then when you need it you can;
IF TYPE("oExcel.Name") <> "C"
   oExcel =- CreateObject("Excel.Application")
ENDIF
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform