Oop quora.com

https://www.quora.com/In-object-oriented-programming-why-is-it-bad-practice-to-make-data-members-public-when-the-get-set-public-members-modify-it-anyway Alan Kay responds:If you use setters, you are not really working with objects, but glorified data structures. This use of objects as “Abstract Data Types” is not in the spirit of Object Oriented Programming and Design. This misuse is one of the biggest misconceptions about what OOP is all about — and it also removes much of the power of organizing modules whose contents are sealed off from the outside.

One way to think about “objects” is that each is an *idea* that holds possibly useful behaviors that can be *requested* (not ordered). So they are like servers with differential privileges. Since there are almost always many more ways to accomplish concepts than there are concepts — think of the *idea* of “sorting” vs the many ways to do sorting — it makes great sense to separate the “language of concepts/behaviors” from the ways to accomplish the concepts/behaviors.

This allows many kinds of scaling and reformulations to be done both safely, and while the larger system is running (hint: your systems design is poor if you have to stop it to fix it or change it).

Another way to look at this is that “data” in most imperative and static senses of the word needs to go away — it is much too fragile and exposed.

You can request services, and some of these might be as simple as asking for a particular value. If the server is representing a “person” then you might request “date of birth” and get a date object as a reply. If you request “age”, you would expect to get a duration object back. In the first case the date object might be held directly internally (probably not), and in the second case, the duration object is the result of an on the fly calculation (and which might be “continuous”).

A more sophisticated use of objects would be to have a “goal pool” of things the larger system needs done, and the server objects could be constantly looking at the goal pool to find things to do. (This is a kind of “Publish and Subscribe” — or Linda — type process.)

https://www.quora.com/As-a-C-programmer-why-didnt-you-switch-to-C-in-your-career I’ve used both. My big issues with C++ are You can’t find the code that does the work. Sometimes it is in a header file, sometimes in .cpp, often split between them. Java is like this too. You can’t find the main flow of control. Too many things are done by constructors and buried in other modules. Usually with C, you can read the main program and get the general idea, then go look at the libraries. There is too much burying of control in data structures, like building lists of objects that each contribute some actions. See “you can’t find the flow of control”. C++ is not performance transparent. You can’t tell how fast something is by looking at the source. You can’t even tell what the types or operations are. Operator overloading is just a bad idea. The thing is that expert C++ programmers know all these things and can write extremely fast code, but the learning curve is extreme. Also: the language is too big and the libraries are too big. I use mostly “C with classes”, which is closer to C than to C++. I do not use “Modern C++”, because that implicitly uses heap, albeit with smart pointers, and the systems I am writing for do not have a heap, which is reckoned to be too dangerous for systems that need to run, effectively, for ever.

links
oop