Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Correlations among VFP and OOP languages
Message
 
 
À
14/06/2006 03:11:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
01128092
Message ID:
01129009
Vues:
14
Thomas,

>I've added all cases together, and when run as a prg, it works as I expected / described. The 3rd level of inheritance with all empty methods triggers the assert, as no implementation method exists to supply the correct method name equal to the abstract method. Program(n) counts the levels of methods with code on the stack. Just copy to "David.Prg" and let it run... Perhaps your test was on objects already loaded with "execute selection" - that would fall under the needed error checking I mentioned <bg>.

I swear that it g3b wasn't triggering it, but it is now so I must have done something else.

>>That's still an abstraction failure right? The draw() method isn't implemented anywhere along the g3b inheritance tree.
>
>Yeah, and fixing that would be propbably be UGLY.

I don't think so because all you have to do is check the inheritance along the line GraphicAbstractObject -> g1b -> g2b -> g3b. In a static classlib analysis it doesn't matter that gpolymorph is asking ox3 to draw().

>Yes, but also in the case of
>ox = CreateMyObjectViaTableBasedFactory("myClassHint", "myUnclearpathtotheVCX")
>ox.draw()
Object factories don't really enter into the equation. Your project would still contain the true vcx right? Whether or not the class myClassHint was really used in code wouldn't matter either in a static analysis of the classes in myUnclearpathtotheVCX and their entire inheritance tree. If you were not bundling your classlibs into the exe, you could create pseudo-projects that were used only for analysis of the inheritance tree.

>It is difficult to be certain on which class inheritance level the draw method has to be implemented at least once.

I thought a little bit about that yesterday, if you pulled the method code in and eliminated all the comments and the LPARAMETERS line and white space then if there was anything left you'd have implementation right? It may be a non functional implementation but who are we to decide what a developer does in their subclass? If the subclass doesn't work because of inadequate work on their part we can give them a warning.

Java on the otherhand plays fullblown policeman it won't even compile the subclass if the abstract methods are not implemented. That brings up the question if I wanted to leave G1.Draw() empty and delay the implementation until G2 can I do that in Java? I don't know and don't have a Java compiler handy to test it right now.

>Why not use the commentary fields for that ? They can be accessed programatically as well AND the developer sees the hint even when working on siblings of the base class. Just make your own rule, that the first line is for automatic parsing as well...

Currently I do just use a comment in the abstract method.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform