Distribution

Grumpy Moon

It is possible to use objects and messages in plain old non-object-oriented languages. This is done via function calls, which look ordinary, but which have object-oriented machinery behind them. Among other things, this allows sophisticated client-server software to run "transparently" from within ordinary programming languages.

Suppose you added a "plus" function to a C program:

int plus(int arg1, int arg2)
{return (arg1 + arg2); }

This hasn't really bought you anything yet. But suppose that instead of doing the addition on your own computer, you automatically sent it to a server computer to be performed:

int plus(int arg1, int arg2)
{ return server_plus(arg1, arg2); }

The function server_plus() in turn creates a message containing arg1 and arg2, and sends this message, via a network, to a special object which sits on a server computer. This object executes the "plus" function and sends the result back to you. It's object-oriented computing via a back-door approach!

This example is not very fancy, and, of course, it's easier to simply add two numbers directly. But as the musical example illustrated, there's no limit to the complexity of an object. A single object can include entire databases, with millions of pieces of information. In fact, such database objects are common in client-server software.

This also illustrates the flexibility of the object-oriented approach. In the usage just described, the object is very different from the earlier "a + b" example. Here, it receives two arguments, namely, the two objects that it is supposed to add. Previously, in the Smalltalk example, the object that was receiving a message was the first object, a. But in a client-server environment, the addition is not done locally, on the client machine, but remotely, on a server machine. The server machine contains the object that the message is sent to, and since it doesn't know anything about the first argument, you have to send both arguments.

 

Back To Top

 

 

_________________________________

Thanks to Terry Montlick

_________________________________

 

 

 

Visit An Area In OzEdweb

Technophile_City_(INFOTECH)The_Time_Machine_(HISTORY)  |  The_Tree_House_(SOSE)Lessons_Index   |  Assessment_Instruments  |  Maps   |  Power Point   |  Proforma  |  Links  |  Gallery  |  Games  |  Humour   |  Prizes  |  WebRings  |  Soapbox  |  Search_Engines  |  Site_ Map_ |

.

             Search OzEdweb By Keyword   

.CLICK ME TO VIEW FRAMES ALL RIGHTS RESERVED  OZEDWEB-©-VIRTUAL OZ  HOME..