Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Article on the future of VFP?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00302626
Message ID:
00303654
Vues:
23
John,

Ok go ahead and bait me into this :-).

An explanation for David:

Reserving our discussion to middle tier business logic objects only, the important aspect of inheritence in designing these classes is not the code. The code is completely different for every business object you create. The rules are different, the data sources are different, etc. Think about an invoice business object and and employee business object, what code would they have in common? One is needs multitable join to create the data view and the other uses a single table. One has rules about amounts, terms, and credit levels while the other has rules about social security numbers, significant other names, and marital status codes.

So what benefit is there in inheritence in designing these classes? Inheriting the interface! That is insuring that all business lgoic objects have the same set of published properties and methods so they are interchangable and so user interface classes can be created that are usable with all business logic classes.

I know, what about that not insignificant code that these business logic classes do have in common? That is easily handled through composition, that is creating a business services class (BS) that has the common code in its methods and then putting one of those in each specific business logic class (BL). The BL class can call the methods of the BS for the desired BS behavior.

In this scenario the benefit of inheritence is in building polymorphism into the middle tier. If VFP had the IMPLEMENTS interface command then I would say that the business logic class would be a flat inheritence hierarchy because the only benefit of it is in inheriting the interface. The IMPLEMENTS command would allow the sharing of an interface without the weight of class code resolution.

In my opinion, and I know I am not alone in this, inheritence is singly the most abused feature of OO. There are invariably many other ways to accomplish the same goal without inheritence that are simpler, cleaner, more maintainable, and more flexible.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform