Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Does OOP serve a purpose?

Name: Anonymous 2012-08-08 15:32

Aside from encapsulating data well and making generalisation fanbois wet?

Name: Anonymous 2012-08-09 16:15

OOP is a philosophy, a way of thinking. It has nothing to do with structures, inheritance, overloading, code reliability, or many other concepts taught in schools. OOP is about how data is manipulated, and who has ownership of data. It is about messaging, signals, callbacks and closures.

To make long stories short, here is an example. Say you have a distributed network, and an object exists in one of the nodes. Say it needs to communicate with another object located in a different node. Issuing a simple method usually results in transmitting a message and will cost 1 credit. A method with a return value requires the other object to transit a message too, so that is 2 credits. But accessing a (member) field requires the object to be located in the same node. As this is not the case, it must be serialised, transmitted,  deserialised, and perhaps have an owner attached. Cost 100 credits.

That is why you have methods to set and get members. To avoid accessing them directly. Another advantage with the messages is that they can be queued. That there is some message queue handler (the object owner) who performs all operations on the member fields. By doing so you do not need to lock or sync data operations.

OOP is all about communication. Not about the structure.

Writing a program in an OOP friendly language does not imply that the program is OOP. Just as you can write an OOP program in a language that is not designed for, like C, it just requires more effort.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List