Why should I have written ZeroMQ in C, not C++ (part II)

Eric Normand's Newsletter
Software design, functional programming, and software engineering practices
Over 5,000 subscribers

Reference: Why should I have written ZeroMQ in C, not C++ (part II)

In this post, Martin Sústrik makes a point about the performance of C compared to C++ (C++ is slower than C). While the performance point is valid, he makes some strong, dubious statements about Object-orientation and procedural programming.

Object-orientedness is after all just a syntactic sugar on the top of procedural language, making the code more understandable to the human brain which seems to have evolved natural ability to deal with objects at the expense of dealing with entities such as flows, relations etc.

Object-orientation is more than just syntactic sugar. OO uses message passing as its computational semantic, while procedural programming uses procedure calls.

He then goes on to describe a scheme where one class can define fields in another class that only it can access, which he calls "private in X". In this way, you can define a list which stores its pointers in the same memory as items of the list which still encapsulates the concerns.

The benefit of OO is that by separating out concerns, you achieve more reuse. You write one list class and one person class, and now you can share persons in different lists. The problem with Sústrik's proposal is that it only allows for an item to be in one list at a time (or you have to write a new list class for every list you want them to be in). This is not Object-oriented. It is merely yet another feature bolted onto C++.

Sean Allen
Sean Allen
Your friendly reminder that if you aren't reading Eric's newsletter, you are missing out…
👍 ❤️
Nicolas Hery
Nicolas Hery
Lots of great content in the latest newsletter! Really glad I subscribed. Thanks, Eric, for your work.
👍 ❤️
Mathieu Gagnon
Mathieu Gagnon
Eric's newsletter is so simply great. Love it!
👍 ❤️