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

Sign up for weekly Clojure tips, software design, and a Clojure coding challenge.

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++.