Results 1 to 28 of 28

Thread: Does New-Basic really need class inheritance?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2020
    Posts
    261

    Does New-Basic really need class inheritance?

    I saw that twinBasic is discussing the inheritance of twinBasic on github. I think it is necessary for further discussion in vbForums.

    We know that complete OOP language features can greatly increase the reuse rate of code and make development more efficient. However, adding class inheritance features to New-Basic will greatly increase the complexity of the programming language and at the same time increase the coupling of code modules. Therefore, some modern programming languages such as Golang and Rust have abandoned the traditional OOP design pattern, but these two languages can indirectly implement most of the OOP features through other solutions (such as interfaces or traits ).

    So is it necessary to provide class inheritance for New-Basic (such as twinBasic)? Is there a better way or the best solution to implement New-Basic object-oriented programming?
    Last edited by SearchingDataOnly; Apr 21st, 2021 at 11:48 AM.

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    2,430

    Re: Does New-Basic really need class inheritance?

    The age-old question........
    For what it's worth: IMO inheritance is a basic principle, which should be implemented in any language, which wants to be taken seriously.

    Example:
    Base class Vehicle
    Property NumTyres
    Property Seats
    Property HorsePower
    Method Accelerate

    Derived Class Car
    Property Registration (There are vehicles you don't have to register)
    Property HasPowerWindows

    Derived Class Bike
    Property IsHarleyDavidson

    What's easier?
    With inheritance i can declare "Car" being a vehicle, without i have to jump through hoops with Interfaces (as mentioned) or delegation
    One System to rule them all, One IDE to find them,
    One Code to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  3. #3
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Posts
    2,967

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by Zvoni View Post
    For what it's worth: IMO inheritance is a basic principle, which should be implemented in any language, which wants to be taken seriously.
    Well rust and go don't have implementation inheritance the way it's implemented in classic java, C# or C++.

    Speaking about implementation there is multiple inheritance in C++ with complex multiple base classes that require impl virtual inheritance and virtual destructors in the language and there is C# and java with single base class only but multiple interfaces impl possible.

    COM on the other hand has aggregation which is a form of composition that is not implemented in VB6 and devs are not aware of it very much.

    cheers,
    </wqw>

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    22,164

    Re: Does New-Basic really need class inheritance?

    Just keep hanging more crap on that Charlie Brown Christmas Tree.

  5. #5
    Hyperactive Member
    Join Date
    Jul 2013
    Posts
    376

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by dilettante View Post
    Just keep hanging more crap on that Charlie Brown Christmas Tree.
    We know already your opinion about a new COM based VB, but your comments always make me smile. Thank you for being you
    Carlos

  6. #6
    Hyperactive Member
    Join Date
    Jun 2015
    Posts
    431

    Re: Does New-Basic really need class inheritance?

    I would vote no. Keeping things relatively flat and simple is better in my book. Once you have to start hunting for where the actual implementation is, or trying to make the implementation more abstract so that works in multiple use scenarios code becomes more complex and harder to navigate.

    Gurus may be able to use it elegantly, but it becomes harder for anyone else to understand their implementations as they are more complex. newer developers will use it to create a mind boggling mess.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2020
    Posts
    261

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by dz32 View Post
    I would vote no. Keeping things relatively flat and simple is better in my book. Once you have to start hunting for where the actual implementation is, or trying to make the implementation more abstract so that works in multiple use scenarios code becomes more complex and harder to navigate.

    Gurus may be able to use it elegantly, but it becomes harder for anyone else to understand their implementations as they are more complex. newer developers will use it to create a mind boggling mess.
    Agree. My idea is to maintain the existing Semi-OOP(Half-OOP) solution of VB6, but borrow some more flexible interface operation modes from Golang, Rust and TypeScript.

  8. #8
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    33,343

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by dz32 View Post
    I would vote no. Keeping things relatively flat and simple is better in my book. Once you have to start hunting for where the actual implementation is, or trying to make the implementation more abstract so that works in multiple use scenarios code becomes more complex and harder to navigate.

    Gurus may be able to use it elegantly, but it becomes harder for anyone else to understand their implementations as they are more complex. newer developers will use it to create a mind boggling mess.
    Sooo... that's a no? jsut because some people don't have the proper training and or discipline? By that same logic, the goto statement should be thrown out as well. After all that has a long documented history of being abused and creating horrible code. Same could be said of On Error Resume Next ...

    Just because up and coming script kiddies aren't disciplined enough to use inheritance correctly, doesn't mean it shouldn't be included. In fact the opposite should happen. It should be included. I'd love to see it. It then becomes the burden on the rest of us "gurus" and older types to make sure that the next generation knows how to use it correctly.

    That said... I currently work in Java. We use inheritance plenty. And it's great. Just yesterday I needed to add something to a class. It's part of a templating system that's used in a larger system. So there's a base class, and then other classes that extend the base class for specific cases as needed. The data that I needed to add needed to be available to all of the templates of the same base types, so adding it to the base class instantly adds it to all of the other child classes. With interfaces, it would have been a lot more difficult. Sure, inheritance can get messy if you inherit too far, but that can be said of any concept. Now, multiple inheritance... that's something I'm on the fence about: a class inheriting from two other classes at the same time... that just seems... odd, but I've seen people ask for it. so... shrug, what do I know?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  9. #9
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    36,088

    Re: Does New-Basic really need class inheritance?

    In my experience, multiple inheritance is better left to single inheritance plus interfaces. Also, I'm coming around to the idea that interfaces are generally preferable to single inheritance, so I'm alright with the idea that inheritance be left out. I've used it, in places, and do see recognize that there are places (as TG described), where it can make for a more elegant solution, but it seems that there is no place where it is essential...so...whatever, I suppose.
    My usual boring signature: Nothing

  10. #10
    Frenzied Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    1,358

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by Shaggy Hiker View Post
    In my experience, multiple inheritance is better left to single inheritance plus interfaces. Also, I'm coming around to the idea that interfaces are generally preferable to single inheritance, so I'm alright with the idea that inheritance be left out. I've used it, in places, and do see recognize that there are places (as TG described), where it can make for a more elegant solution, but it seems that there is no place where it is essential...so...whatever, I suppose.
    Interfaces tend to be a lot more useful compared to inheritance, however inheritance can make solving certain types of problem so much easier. then again even when I use a base class I still tend to opt for interfaces with the base class being a good default implementation of the interface...

  11. #11
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,133

    Re: Does New-Basic really need class inheritance?

    The most clear, obvious and instant advantage is to shut the mouth of all haters that say "VB6 is not OOP because it does not have inheritance" or "it is very limited" or "not for serious projects".
    After that, we'll see how useful is the feature in practice.

    So yes, it would be good if it implements true class inheritance.

  12. #12
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    36,088

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by Eduardo- View Post
    The most clear, obvious and instant advantage is to shut the mouth of all haters that say "VB6 is not OOP because it does not have inheritance"
    That won't work, so I wouldn't bother with it for solely that reason. The people who dump on any VB aren't doing so from a position of experience. I'm currently writing in C#, and trying not to be too critical of the clear and obvious shortcomings of that language from a syntactical position. I can see that, had I started with C#, I would find VB syntax similarly alien. So, if I was to criticize C# syntax, I would have to be careful to avoid criticizing it simply for being unfamiliar. Such criticisms can be made, and similar criticisms can be levied against VB, but lots of the criticism of VB is because of what the critic is familiar with, not because of a feature of the language.
    My usual boring signature: Nothing

  13. #13
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,133

    Re: Does New-Basic really need class inheritance?

    Yes, it would work. They will have to find something else to criticize.
    There are many people in the middle that follow what others say. If they can't say much, it is a win.

    About familiarity with syntax, I think it is true in part. I think there is an objective part also. VB is much more natural in regard of human language. What somebody talks to other humans. I don't think you talk like #:=-1 ==> {this, self}
    You usually talk like For Each If True Then Do Until

    I don't know, if I had programmed many years in a #+=>-1{this}; language, perhaps I would be so familiar with it like I'm now with VB, but for beginners surely it is not the same thing.
    I've learnt some JavaScript recently and started to get a bit used to it, like you say.

    The feature that I missed most is run step by step and debug, see what is happening in every moment (must be possible probably but I still didn't learn that).
    I'm blind, it is difficult to program blindly.
    VB6 has that out of the box.
    I think I would not be able to do 1/4 of what I did in VB6 programming in such way.

    Also, regarding the language itself, we could say that VB is economic in the sense that do not waste your brain unnecessarily, it takes advantage of what you already know (English).

    Even if I get personally to the point that I'm very comfortable with some ___def___ {<-- p}; language, I think VB is a better option for humanity.

  14. #14
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,133

    Re: Does New-Basic really need class inheritance?

    In other words: once you learn Klingon, Klingon must be as good as English, but tell me if you would not prefer to have to learn an English dialect instead if you can choose.

    {
    };
    Last edited by Eduardo-; Apr 21st, 2021 at 07:45 PM.

  15. #15
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    36,088

    Re: Does New-Basic really need class inheritance?

    As a language, English is a total mess. It's also the most widely used, and growing, mess.
    My usual boring signature: Nothing

  16. #16
    PowerPoster
    Join Date
    Feb 2017
    Posts
    3,133

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by Shaggy Hiker View Post
    As a language, English is a total mess. It's also the most widely used, and growing, mess.
    One strength that is has is that it is economic (short sentences, few words). That feature is good for using it as the base for a programming language.

    Spanish can express many things with more precision and less ambiguity, but is uses more words and is more complex (many verb tenses for example).
    I don't know much about other languages so can't compare others.

    Anyway, like it or not, it is the lingua franca now.

  17. #17
    PowerPoster
    Join Date
    Feb 2006
    Posts
    22,164

    Re: Does New-Basic really need class inheritance?

    The biggest issue is backing. Take Python for example.

    I did some digging (can't find the page again) but when I located the "Python Software Foundation" list of corporate backers it was hilariously long and listed every big-ticket Silicon Valley corporation as well as Microsoft and some very well-endowed universities. PSF takes that money and awards "grants" (wink, wink) back to corporations and academia to develop the shabby bags of broken toys that make up the various Python toolchains (Python, MicroPython, etc.). Of course it is all about avoiding taxes and antitrust action. This isn't just Python, it's just how things are done these days in the era of "open source" which isn't at all what little people imagine it to be.

    It isn't impossible to compete with that and even exceed it but it isn't very easy. Getting more and more elaborate adding arms and legs and a prehensile tail sounds more like procrastination than progress.

  18. #18
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    401

    Re: Does New-Basic really need class inheritance?

    My opinion is NO!

    It creates unnecessary complexity with no reward. Interface inheritance as in vb6 is fine, but inheritance is not needed. I have found object composition a much more simple and more maintainable solution.

  19. #19

  20. #20

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2020
    Posts
    261

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by wqweto View Post
    Well rust and go don't have implementation inheritance the way it's implemented in classic java, C# or C++.

    Speaking about implementation there is multiple inheritance in C++ with complex multiple base classes that require impl virtual inheritance and virtual destructors in the language and there is C# and java with single base class only but multiple interfaces impl possible.

    COM on the other hand has aggregation which is a form of composition that is not implemented in VB6 and devs are not aware of it very much.

    cheers,
    </wqw>
    Quote Originally Posted by axisdj View Post
    My opinion is NO!

    It creates unnecessary complexity with no reward. Interface inheritance as in vb6 is fine, but inheritance is not needed. I have found object composition a much more simple and more maintainable solution.
    Before I created this thread, I have seen some articles saying "composition is better than inheritance", my understanding is: "composition is better than inheritance" refers to the composition between COMs (that is, the composition outside the source code), I hope to see the "composition within the source code". Could anyone give some examples of "composition within the source code"? Thanks.
    Last edited by SearchingDataOnly; Apr 22nd, 2021 at 06:24 AM.

  21. #21

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2020
    Posts
    261

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by The trick View Post
    You can use Decorator pattern if you need inheritance.
    Hi The trick, could you explain the "Decorator pattern" further? Thanks.

  22. #22
    Lively Member
    Join Date
    Jun 2016
    Posts
    98

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by Shaggy Hiker View Post
    As a language, English is a total mess. It's also the most widely used, and growing, mess.
    ...well, so true! But this is not surprising, considering that English was born from the head-on collision of two languages, Germanic and French. But the good thing is that because things like spelling and pronunciation are so difficult, other things like grammar have been radically simplified, not to say eliminated. Just compare English grammar with German or almost any other grammar.

    So for the world, it's a win! (as long as you just want to *speak* it, that is )

  23. #23

  24. #24

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2020
    Posts
    261

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by The trick View Post
    Thank you, The trick.

  25. #25
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    36,088

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by tubus View Post
    ...well, so true! But this is not surprising, considering that English was born from the head-on collision of two languages, Germanic and French. But the good thing is that because things like spelling and pronunciation are so difficult, other things like grammar have been radically simplified, not to say eliminated. Just compare English grammar with German or almost any other grammar.

    So for the world, it's a win! (as long as you just want to *speak* it, that is )
    Yeah, that's a good point. Still, I've always felt that the Italians can swear better than we can.
    My usual boring signature: Nothing

  26. #26
    Lively Member Grant Swinger's Avatar
    Join Date
    Jul 2015
    Posts
    69

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by SearchingDataOnly View Post
    Thank you, The trick.
    If you want a good book on patterns grab "Head First Design Patterns". But don't get the latest version because it's no different than the 2014 edition of which you can find plenty of copies at a lower price. All the examples are in Java but they're not difficult to understand even if you're not a Java developer.

  27. #27

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2020
    Posts
    261

    Re: Does New-Basic really need class inheritance?

    Quote Originally Posted by Grant Swinger View Post
    If you want a good book on patterns grab "Head First Design Patterns". But don't get the latest version because it's no different than the 2014 edition of which you can find plenty of copies at a lower price. All the examples are in Java but they're not difficult to understand even if you're not a Java developer.
    Thank you, Grant Swinger. Many years ago I read some books on design patterns, and when I read these books again, there will be many new gains.

    For me, concise/simple and extremely flexible have always been the principles of software design patterns that I admire. In this regard, VB6 seems to be the best. It has a good balance between simplicity and complexity, and a good balance between stability and flexibility.

  28. #28
    Addicted Member Episcopal's Avatar
    Join Date
    Mar 2019
    Location
    Brazil
    Posts
    227

    Re: Does New-Basic really need class inheritance?

    I am not an expert, nor have I worked with .Net ... But if twinbasic promises 100% compatibility with VB6 ... why not support inheritance? As I said, I do not program with vb.net, but I know that it is possible to program on vb.net as if it were vb6, without these OOP complexities. Therefore, it would be interesting for twinbasic to work both ways, so that both the programmers of vb6 and vb.net could use twinbasic .... they asked for their opinion and this is mine .... remembering that I am not even one specialist, like you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width