DEV Community

Cover image for Object Oriented Programming
Eckehard
Eckehard

Posted on • Updated on

Object Oriented Programming

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 (15)

Collapse
 
lincpa profile image
Lin Pengcheng • Edited

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.

Collapse
 
jwp profile image
John Peters • Edited

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.

Collapse
 
efpage profile image
Eckehard

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.

Collapse
 
lincpa profile image
Lin Pengcheng

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.

Collapse
 
efpage profile image
Eckehard

Are you a ruminant?

Collapse
 
lincpa profile image
Lin Pengcheng

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

Thread Thread
 
efpage profile image
Eckehard

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.

Thread Thread
 
lincpa profile image
Lin Pengcheng • Edited

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?

Thread Thread
 
efpage profile image
Eckehard

No, we just know that bumblebees can fly.

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ • Edited

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

Collapse
 
efpage profile image
Eckehard • Edited

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

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

Probably

Collapse
 
heyeasley profile image
heyeasley πŸ“πŸ₯­

And the inheriting child classes are from main classes.

Collapse
 
efpage profile image
Eckehard

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.

Collapse
 
heyeasley profile image
heyeasley πŸ“πŸ₯­

Right.