Object Oriented Programming
Eckehard

Eckehard @efpage

About: Always curious...

Location:
Germany
Joined:
May 24, 2021

Object Oriented Programming

Publish Date: Jun 14 '24
61 18

This is a submission for DEV Computer Science Challenge v24.06.12: One Byte Explainer.

Explainer

Class based OOP is a paradigm that uses classes as templates for reusable code modules (objects). Objects can have their own private data and functions. Inheriting child classes is the way to extend functionality while keeping the existing codebase stable.

Comments 18 total

  • Neurabot
    NeurabotJun 14, 2024

    And the inheriting child classes are from main classes.

    • Eckehard
      EckehardJun 14, 2024

      Not necessarily. You can also use an abstract class to inherit from, but going into details would exceed the limit of 256 characters which were achieved exactly.

  • Lin Pengcheng
    Lin PengchengJun 14, 2024

    It’s better to have 100 functions operate on one data structure than 10 functions on 10 data structures.

    ---- Alan Perlis, the first recipient of the Turing Award (1966), a founding father of Computer Science as a separate discipline

    So, the best object-oriented system is a system with only one object ---- warehouse/workshop model.

    • Eckehard
      EckehardJun 14, 2024

      Are you a ruminant?

      • Lin Pengcheng
        Lin PengchengJun 15, 2024

        I don't understand what you mean, and I'd love to get your scientific, logical, and well-founded evaluation of my theory.

        • Eckehard
          EckehardJun 15, 2024

          Most of the common operation systems like Windows or Linux have been built using OOP methods, even the DOM features and OOP based approach. But you tell us: bumblebees can´t fly.

          There are some theorists who think their theory is the only correct one. For me it is enough that it works practically.

          • Lin Pengcheng
            Lin PengchengJun 15, 2024

            So we don't need to talk about science, mathematics, logic, we just need to conform to the herd or authority, we don't need scientific skepticism, we don't need independent thinking, so geocentrism is correct, Bruno should be burned, right?

            • Eckehard
              EckehardJun 15, 2024

              No, we just know that bumblebees can fly.

    • JWP
      JWPJun 17, 2024

      Yes this would enforce the favor composition over inheritance theroy. However we see plenty of instances of inheritance which worked perfectly. Jusy look at the masiive C# class library.

      The trick is to know the hard rules of what inheritance is and never misuse it. Tires aren't Cars, they are parts of Cars.

      • Eckehard
        EckehardJun 18, 2024

        OOP is just a tool like a hammer or a circle saw. If you know how to use it, it can be most beneficial. But in the wrong hands or applied to the wrong task, using it can be dangerous. But a good craftsman (or craftswoman) can operate many tools.

      • Lin Pengcheng
        Lin PengchengJun 18, 2024

        The most important point is that my theory is to give everyone a common way of constructing a system, according to which everyone can get a consistent optimal design solution under the same conditions. And it is possible to demonstrate the advantages and disadvantages of different design schemes in this way, without having to wait until the end of the project construction to find out that it is not good and cannot meet the needs.

        • Eckehard
          EckehardJun 18, 2024

          Hello Lin Peng, your theory is a theory, and obviously not even a very good one:

          Object-oriented and functional programming completely do not meet these three beauty requirements. The strange shapes and chaotic logic of OO&FP are not only unsightly, difficult to read and understand, and completely incompatible with the simple and repeatable requirements of industrial production. Source

          I can fully accept that you do not understand these "strange shapes", maybe it was good to finish reading your books first. But what do you think you can give to the people if you do not have any practical experience at all?

          By the way: your comment is off-topic. The question here is the quality of the explanation, not your personal preference about programming.

  • Jon Randy 🎖️
    Jon Randy 🎖️Jun 15, 2024

    This isn't actually correct. You've described class based OOP, not OOP generally.

    • Eckehard
      EckehardJun 15, 2024

      Do you think i should change my submission and call it "Class Based OOP"?

  • Vivekanand Tulaskar
    Vivekanand TulaskarJun 28, 2024

    Good .

    Inheritance is a fundamental concept in OOP that allows one class (the subclass or child) to inherit properties and behavior from another class (the superclass or parent). The subclass inherits all the fields and methods of the superclass and can also add new fields and methods or override the ones inherited from the superclass.

    • Eckehard
      EckehardJun 28, 2024

      If you are developing software, inheritance has a double effect:

      Never change a winning team: Inheritance allows to extend functionality without changing the base class. This can be important to avoid unwanted side effects. If a class hierarchy grows, this can be a life saver.

      Don´t repeat yourself: Not only the child class inherits new features, but also the childs of the childs. So, you try to create new features only once, while the whole family can benefit from the extension.

      Well done, inheritance can make code much more maintainable. It is just not so easy to do things right here.

Add comment