3 ms·
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 Mes
by foobar_ 6y ago
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.
- pjmlp 6y agoPolymorphism 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 https://wiki.tcl-lang.org/page/Object+orientation
- foobar_ 6y agoYou 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.
- pjmlp 6y agoModules 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?
- foobar_ 6y agoThat'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.
- pjmlp 6y agoModules 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++.
- foobar_ 6y agoI 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.
- pjmlp 6y ago
- l_dopa 6y ago> 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/CookOOPvsADT90.pdf https://www.cs.utexas.edu/users/wcook/papers/OOPvsADT/CookOO...
- pjmlp 6y agoNo, I am speaking about modular programming as abstract CS concept, with those nice math diagrams to describe language semantics.