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.
Top comments (18)
So, the best object-oriented system is a system with only one object ----
warehouse/workshop model
.Traditional IT theory (OOP, FP and hardware architecture, etc.) are pseudoscience. they belong to what physicist Wolfgang Pauli said "Not Even Wrong".
2018.03.18, The Math-based Grand Unified Programming Theory: The Pure Function Pipeline Data Flow with Principle-based Warehouse/Workshop Model
The unification of Microservice, DB, OOP, FP and Warehouse/Workshop Model
Systematic Best Practices for Java's New Features: Java has abandoned OOP in favor of my theory!
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.
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.
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.
Hello Lin Peng, your theory is a theory, and obviously not even a very good one:
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.
Are you a ruminant?
I don't understand what you mean, and I'd love to get your scientific, logical, and well-founded evaluation of my theory.
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.
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?
No, we just know that bumblebees can fly.
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.
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.
This isn't actually correct. You've described class based OOP, not OOP generally.
Do you think i should change my submission and call it "Class Based OOP"?
Probably
And the inheriting child classes are from main classes.
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.
Right.