Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Every time you call a method you are breaking encapsulation because you can no longer change the name of the method, it is exposing the internals. Thats why Message Passing has more guarantees with encapsulation.

Abstraction is overdone. Sometimes the simplest implementation is a function. Not a class.

Inheritance is a failed idea of code reuse because it leaves the code brittle.

You can develop GUI apps without OOP - Tcl / tk and some game programming guis are done that way. All that you need are callbacks essentially.

Polymorphism is essentially overloaded functions and you don't need OOP to support that.



Polymorphism is OOP, not every approach to OOP is the same kind of nail.

Classes as concept, are nothing more than extensible modules, and in that regard C and Assembly are pretty much the only mainstream languages that eschew such abstractions.

You can also develop GUIs in Assembly, and I don't miss doing that.

Interesting that you mention Tcl/Tk, given the OOP extensions that were all the rage when version 8.0 came out.

https://wiki.tcl-lang.org/page/Object+orientation


> Classes as concept, are nothing more than extensible modules

If you're talking about ML-style modules, that really can't be farther from the truth, both in theory and how they're used in practice.

Modules can be used (among many other things) to implement abstract data types, which are conceptually a bit easier to compare to objects[0]. Then you'd have to go into structural vs nominal typing, functors vs generics, etc.

[0]https://www.cs.utexas.edu/users/wcook/papers/OOPvsADT/CookOO...


No, I am speaking about modular programming as abstract CS concept, with those nice math diagrams to describe language semantics.


You missed the first point I made. C++ / Java break encapsulation by using methods and pretend they are encapsulated.

Julia implements polymorphism without OOP. Modules are better than classes anyways. The whole Java ecosystem tried so hard to bring modules back as components and failed miserably.

If we are going to talk about all types of interfaces then OpenGL is a clear winner. That last time I checked it uses a procedural interface and vertex buffers directly. Why a procedural interface ? Because OOP is incapable of dealing with any complex data structure other than lists in a performant way.


Modules are classes without inheritance.

C++ and Java don't break anything that a bad designed module won't be doing as well.

OpenGL a clear winner?!? The 3D API that should never haven gotten outside SGI with its global variables and state?


That's exactly why modules are better than classes because they don't have inheritance. It allows for simpler solutions. No debates about taxonomies.

OpengGL is faster. Procedural code is always faster. Global variables are infinitely better than pretending problems vanish with singletons and AbstractFactoryMakerProducer. I remember going from C++ to Java, what a joke. C++ is infinitely better than Java because it doesn't suffer from OOP monothinking which is beyond pathetic. It was the first time I realised programmers would repeat marketing slogans without verification.


Modules can still be generic without inheritance, it is a matter of language and implementation.

OpenGL is a garbage API that I repent having spent so many years dealing with its Frankenstein API design.

Fast? Only if you happen to use the magic incantation of data structures and the driver happens to play ball.

There is a reason why all modern 3D APIs are object based, including Vulkan with its handle model.

OOP based C programming is used all over the place in the Linux kernel, in spite of Linus opinions regarding C++.


Modern OpenGL is also object-based. You select which instance you want to interact with via glBindX.


AZDO is not compulsory and rarely seen live, for example it isn´t supported in ES or WebGL variants.


I found OpenGL easy enough as compared to DirectX which is an abomination. Another problem with OOP, it breaks ABI because of name mangling. Had people just stuck to modular programming without inheritance this would have been a non-issue. Namespaces would have become underscores or something.

You can almost backtrack all the horrible decisions in C / C++ and compare it to wirth languages which tried modular programming, bounds checking ....

> Vulkan with its handle model

That sucks. The performance is going to be slow. It's possible they did not go full OOP because of performance.

> OOP based C programming is used all over the place in the Linux kernel

Nope. They implement interfaces / modules using structs. Again, no inheritance and "classes". The most popular example being drivers and filesystem.


OOP doesn't require inheritance, and structs with function pointers are how "classes" get done in C, better brush up your knowledge of OOP, and while you are at it, learn about Vulkan as well.

Also in case you have missed, all proprietary 3D APIs are either OOP or object based.

I wonder where is the OpenGL C implementation that will outperform LibGNMN.

By the way, one of the reasons why OpenCL failed to gain market shared was its focus in C, instead of the nice C++ libraries provided by CUDA.

When Khronos woke up and decided to offer such APIs, it was to late, now we have OpenCL 1.2 renamed as OpenCL 3.0, and SYCL is being re-designed to be backend agnostic.


From a quick read, Vulkan doesn't use inheritance. Its using the C module approach. Even the Web DOM doesn't use inheritance. It seem in the real world no one uses imaginary objects and everyone uses structs.


Advised lecture, "Component Based Programming".

Again, OOP is not 100% about inheritance.

It seems some people keep not learning what OOP is all about and relate OOP <===> Java.


I think you are finally getting it. Modules ~ Components. Where you and I differ is you think Component = Object. I think the difference is sufficient enough to warrant a complete divorce from the word object.

Linux kernel uses components, not objects.

The ideology of OO is using classes and inheritance to design software. It is an abysmal failure of software engineering, only mediocre managers use OO anymore and pretend visitor pattern is still a thing. All successful OOP projects use components in a disguised form and use a separation between Data (Value Objects, POJOs) and Code (Services). All failed OO projects use classes and take 3 years to deliver even the dumbest of software.


No you are the one not getting it still, components are an area of OOP, usually referred as object based programming.

SELF, BETA and JavaScript don't use classes yet are OOP.

VB originally did not do inheritance and yet it did provide another OOP approach.

Plenty of other languages can be looked upon on SIGPLAN.

Speaking of failed OOP projects, Web DOM, Android, iOS, CUDA, DirectX, LibNMN, LLVM, Metal are indeed such a colossal failure, what were they thinking.

In case you are lacking CS literature I can give you some hints.


That fact that you have to go through so many references to define the word object exactly proves my point.

You can just read this wiki ...

https://en.wikipedia.org/wiki/Modular_programming

Modularity is the very fabric of most engineering disciplines. As opposed to that, OO is a holistic "ideology" about using classes and inheritance to design software. I call it an ideology because despite its abysmal failures people still refer to it in positive terms.

Apart from Android not one software from the list uses inheritance and classes. OO has shown a narrow success in GUI.

In C you don't have modules and interfaces, so what you do is define a struct with pointers. Now you can compile any .c file which follows this interface and dynamically load it into the software.

Python / Perl / Javascript / Ruby ... support this. Remember how much code is resused in the packages downloaded when you do pip install ? Thank modules for that. Not OO. Because of duck typing these dynamic languages don't need interfaces but you can find code snippets that implement it with keywords like pass.

In modular coding you get libraries, extensions and plugins. I find it sad not many people use these terms and prefer to honk OO every time.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: