Vb Ii By Preprocessing Source

How to implement VbClassicImplementationInheritance with a tool to preprocess the source code: "Class inheritance" definitions would direct the tool to copy methods, insert forwarding calls, or do other appropriate code generation necessary to simulate ImplementationInheritance in VisualBasie?.


See Sheridan Software Systems' ClassAssist tool; a full-featured implementation.


[MacReiter says...]

Having gone through [the other ideas in VbClassicImplementationInheritance] and decided that none of them give a fully useful version of Inheritance, I have decided to create a tool that will implement the old tried and true containment method of inheritance (Dog contains Private mAnimal, and wrappers to everything in Animal) as well as an inlined version (Dog simply contains all of the code from Animal). Intention is to have a VB add-in that you can run and it will re-synchronize everything in your project. Inheritance is flagged by comments like:

 'BASE-CONTAINER:Animal

(implements the containment method)

I already have the Inline version up and running. Inheritance hierarchy is built and then inlined from the root base classes out to the leaves. If a derived class contains a sub/function/property, it is not copied in from the base class, thus allowing proper overloading of behavior in derived classes. I currently do not do that check for Private/Public variables, but that is more tedium than genius to implement at this stage. I also have some cleanup to do (agressive refactoring, and all that -- I have only spent one day on the project...) Then I need to implement the Containment method (saves space at the cost of run-time performance due to double function calls). This is more complicated because I don't want the wrapper in Collie to call the wrapper in Dog which calls the function in Animal. I want the wrapper in Collie to call the function in Animal, UNLESS it was overwritten inside Dog. So I have to back up the chain and call the first non-wrapper code I see...

I also intend to support inheritance for forms, since they are classes/objects as well. I will have to spend more time on those for parsing and deciding exactly what it means to derive frmDog from frmAnimal. Since the re-synchronization will be done frequently, I can't blindly copy EVERYTHING over...

Oh, and this is being developed in VB5 as an Add-In DLL. Obviously, it will need some VB6 testing, as well as somebody willing to pound it to death in a real-world inheritance system. I have a feeling I'll be able to do the pounding, and can probably find someone else at work willing to do the VB6 testing, but it will add to development time. I'm hopeful, however, as it seems to be falling together quickly. I'll let you know when it becomes available. (I am developing it at home to retain ownership of it. My current intention is to sell it for a relatively small fee. I'll have to see what I think when it's done.) --MacReiter


Why can't you write test cases for you code? Then you don't have to pound, you can mostly have the computer pound for you. And when you move to VB6, you can run the test cases again and pretty much know whether it works. I suppose the weakness of this approach is that MicroSquish? is free to change the semantics of the language, thus silently invalidating the requirements on which the test cases are based. However, mostly the tests are still a good idea. --KentBeck


See VbUnit, a TestingFramework for VbClassic.


CategoryVbClassic

EditText of this page (last edited January 31, 2009) or FindPage with title or text search