Hacker News new | ask | show | jobs
by pjmlp 1754 days ago
https://microsoft.github.io/microsoft-ui-xaml

> WinUI is powered by a highly optimized C++ core that delivers blistering performance, long battery life, and responsive interactivity that professional developers demand. Its lower system utilization allows it to run on a wider range of hardware, ensuring your sophisticated workloads run with ease.

Apparently Microsoft does care about OOP in C++.

As does Apple,

https://developer.apple.com/metal/

https://developer.apple.com/documentation/driverkit

And Google,

https://github.com/google/oboe

https://www.tensorflow.org/api_docs

Maybe modern C++ is safe from OOP, so lets look into ranges,

https://en.cppreference.com/w/cpp/ranges

So we have factories, adaptors, concepts (aka interfaces/traits in other languages), std::ranges::view_interface as base class mixin, all stuff I can find on the Gang of Four book.

2 comments

I wasted time looking in those links. The WinUI page does not mention base classes (or prototypes), inheritance, or any sort of runtime binding. A "highly-optimized C++ core", in particular, does not imply OO. The std::ranges view_interface template is not OO; it uses concrete inheritance purely as a notational convenience.

Likewise the others, with one exception. The Apple driverkit page does mention base classes.

Factories, adaptors, concepts/traits/interfaces have nothing to do with OO, beyond that OO designs often also use them. OO designs define functions, too, but functions do not imply OO.

It is, in any case, meaningless to trot out apparatus system-vendors oblige programmers to use to access proprietary facilities, and equate that to programmers' interest in whatever tech is used for them. Programmers are interested in using the facilities, and are glad when whatever they are obliged to use works at all; too often it doesn't.

WinUI uses COM/WinRT, COM is an OOP ABI, and WinRT is basically COM v2, with TLB libraries replaced with .NET type system and types must support IInspectable in addition to IUnknown. Are you going to argue .NET isn't OOP?

As for the rest, OOP doesn't imply inheritance, BETA and SELF are good examples of OOP without inheritance.

Nobody uses Beta or Self. And, no matter how much alphabet soup MS throws at its long, rolling UI debacle, it demonstrates nothing about general programmers' current level of interest in OO.
Arguing against industry usage of OOP, including C++20 own standard library, trying to fit one's little window of the world, also doesn't help.
OOP is great when you write APIs/libraries (your examples), but is useless or even counter productive when writing applications, where encapsulation or inheritance just obfuscate everything.

My main grip with Java is that everything is by default a library.

But there is hope, recent changes in Java, records and pattern matching move away from that idea.

saying OOP is only useless and counter productive is as short sighted as saying it is the golden hammer for everything.

PS: WinUI apps use plenty OOP

It's not what i've said, OOP is great for creating APIs like WinUI, not great for writing applications
In which universe an application which uses mainly OOP APIs isn't itself OO.
What OOP is good at is maintenance over the time by making clear what is API and what is implementation.

My point is that when you develop an application, you only need strawman OOP i.e. calling methods.

You don't need class inheritance if you can pass functions as parameters, you don't need encapsulation given all your pieces co-evolve at the same time (if it's not split than part into a library).

and WinUI apps are applications, and - as said - OOP is used by them, see e.g. the reference architecture guide