No announcement yet.

Where I think this is going…

  • Filter
  • Time
  • Show
Clear All
new posts

  • Where I think this is going…

    And correct me if I'm wrong, Bob (or Theo or anyone for that matter. . .)

    Now, I'm writing this as someone who has never (yet) deliberately done anything with COM objects (not even in VB much less Delphi or C++) and my current PB programming style is something of a hash of the PB I used 20 years ago and my C / C++ / Delphi days. So far, everything I've been doing has been in the console compiler (no need to immediately go and learn windows GUI (PB Style) if I can read in a text file for simple input). So with that for context. . .

    While the nature of the various discussions here seems to imply that the next version of PB will include OOP capability, that capability will be primarily directed towards the COM standard, rather than a more "traditional" OOP (such as C++) format.

    In my C++ days we would define things like:

    Class MyClass : public PubBaseClass, private PrivBaseClass
         private :
              int myVar1, myVar2, myVar3
              static int mySVar1, mySVar2, mySVar3
              int myFunct1
              float myFunct2
              void myFunct3
              int var1, var2, var3
              int PFunct1
              float PFunct2
              void PFunct3
              int pr_var1, pr_var2, pr_var3
              int PR_Funct1
              float PR_Funct2
              void PR_Funct3
    Given that I have no (zip, zippo, nada) experience using COM (and I'm betting that there are others here as well) could some kind soul "map across" the code above into what we're talking about?

    Because without any actual COM experience I feel that I'm getting lost.

    Is an INTERFACE just the publically available functions and variables? Does COM support multiple inheritance, public/private/protected, friend classes, etc?


    Lost in the Arizona Monsoon Season
    John Strasser
    Phone: 480 - 273 - 8798

  • #2

    Hi John!

    I'd say its considerably worse than your worst nightmares! I've got about 5 books on it and have barely scratched the surface. The one I'm working through now is probably the simplest, and its by Dale Rogerson "Inside COM".

    Is an INTERFACE just the publically available functions and variables? Does COM support multiple inheritance, public/private/protected, friend classes, etc?
    Its based on multiple inheritance. The difference between the C++ classes you are familiar with and C++ classes using COM is that the class you create to house a component inherits from both a system defined base class IUnknown, and any interfaces you create yourself - hence multiple inheritance. The whole reason for this is to create a particular memory footprint involving the VTable. And to create the propper memory layout what the interfaces are are pure virtual bases classes in C++. The class you create to 'house' your component implements the pure virtual base classes.

    The whole ediface was created to support the 'dynamic composition of systems'. That is, so that components could be plugged in or unloaded at run time. Its encapsulation with a vengence, to be sure. Also, the design heavily implicates the registry. That's where the GUIDs come in. The actual components are loaded by system services on behalf of your client app.

    here ...

    is a short C++ program that shows a very little bit of what is going on. There's of course a great deal more, but I hope this helps.

    And I'm sure PowerBASIC will hide as much of the truely ugly stuff as possible.
    Last edited by Fred Harris; 9 Aug 2008, 09:09 PM. Reason: added last line


    • #3
      There's a huge difference between--

      1) Implementing a COM server yourself, in many languages (like C), can be a challenging proposition. The books you quote describe that process. It is daunting. It's also wholly unnecessary.

      2) Using a language which does all the work for you.

      Creating and using objects will be dead simple. It's likely that no other methodology is simpler, not more efficient, nor more powerful.

      Don't make assumptions about GUID's, the Registry, Multiple Inheritance, and more, until you have all the PowerBASIC facts. They're coming at a record pace. The information we've provided is very dense. Read it very carefully, as the text is packed with important details. In fact, read it often. {smile}

      If you have a question, please ask it?

      Bob Zale
      PowerBASIC Inc.


      • #4
        I've got this statement from the "Jesus of COM" himself, its about which Books he recommends.

        Many people has asked me which books I recommend, but the fact is that I just learned COM programming reading the MSDN documentation and practizing it, step by step. The only available examples of any value to me where written in plain C, since VB examples hide everything, and C++ examples are a confusing mess of classes upon classes.

        GPFs are a good debuggint tool. If it GPFs, then you are doing something wrong J

        Things will be much more easy to us, when we can use BOB's new Object. Because we don't need to learn C first.

        If you "feel i am getting lost", ask one of your NLP friends, he may be able to support you on that issue .
        Last edited by Theo Gottwald; 10 Aug 2008, 01:27 AM.


        • #5
          Very true, Theo. I have hundreds of books on COM. There isn't one I would recommend unless you were writing your own compiler. Even then, I'd limit it to the 5-volume ms set. You'll get much more in the PowerBASIC Help File, and you'll save some money, too. {smile}

          Best regards,

          Bob Zale
          PowerBASIC Inc.


          • #6
            Originally posted by Theo Gottwald View Post
            If you "feel i am getting lost", ask one of your NLP friends, he may be able to support you on that issue .

            Working that knid of "NLP magic" requires that the subject have enough information to put things in context to begin with. In this case I don't. And apparently trying to "map across" to C++ is a bad idea.

            So for now I'm going to have to treat this as a completely separate language construct and learn it separately - despite the fact that it shares vocabulary I already know. Then it can be integrated.

            Which also means that it can be ignored until I have to deal with COM objects.
            John Strasser
            Phone: 480 - 273 - 8798


            • #7
              I have hundreds of books on COM
              I have tried to read one and put it aside some time ago. Because it was totally far from how i worked until then. Its a complete new way of thinking.
              I'd never had been doing a step on this floor if not with PowerBasic.

              NLP teaches us, that the world in reality is quite different from what we think how it is.
              Just like if we see it through coloured glasses. Everybody other colours.

              But then we can solve problems we thought we can never overcome, by using resources to get more freedom in our decision, to find new sollutions, open doors we have been afraid of opening before.
              Finally we can reach goals, we have never thought could be possible before.

              Thats what happens here also.

              I think after you get hands on the new "Power-Objects" you'll see that its much more easy then you thought before. Just use the resources you already have to integrate the new resources you get now.

              In my case ... after I have been printing out all the Sticky's from Bob and re-reading them carefully "One-by-one" again and again, I think I am now ready for the next level of programming!

              Seeing that I needed so much time to understand the new Objects, I realized that this PB Thing is the biggest PB-Revolution until now maybe since the first version.


              • #8

                This is definitely the biggest release of PB and very welcome too. There are still some things Bob must probably explain like how to deal with events, will we be able to place OCX on a dialog without the need for special third-party assistance. But I think with this release, PB will be in a league of its own in competing with .NET. I've been dealing with OOP for a long time, using Java and even in the product I represent (Peoplesoft) OOP is ubiquitous. It gives so much more flexibility than with a procedural coding style. For large projects this is the only approach to use. But OOP comes with a steep learning curve and techniques such as UML (Unified Modelling Language) are great ways to portray the flow of the application in terms of 'which class inherits from what'. There will be a lot to learn but I don't mind learning new stuff.

                I applaud Bob and his team to make this happen !!!

                So here we are, this is the end.
                But all that dies, is born again.
                - From The Ashes (In This Moment)