December 11, 2019

Object protocol

 

A software system consists of objects that collaborate to perform some task by either sending or receiving messages. To design object-oriented systems it is unnecessary to know how those messages are implemented; the software designer does not require knowledge of the code being executed when an object receives a message. All that is required, for an object to do something, is to send it an appropriate message. Consequently, if a designer knows precisely what an object does, not how it does it, these software components can be combined within a structured environment to perform complex behaviour.

There are direct parallels between OOP and network computing. For example, client software such as a Web browser can request a file from a Web server. The server "understands" the request and sends back the relevant file. The Web browser employs a protocol called HTTP, Hyper Text Transfer Protocol, to communicate with the server.

Similarly, objects have a protocol. A client object may request some data from a server object by sending a message. As long as the server object "understands" that message, it will send back a message answer to the client. The message answer, or return, is itself an object. This message answer object may, or may not, be used for further processing.

The protocol of an object is the list of messages that an object "understands", and is said to be the interface to that object. Click here for an illustration in pdf format.

Next page » Objects and encapsulation

Previous page « What is an object

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Up to top of page