[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Objects, processes, and encapsulation

I've just finished reading Meyer's chapter on OO and concurrency. While 
I'm decidedly underwhelmed and unconvinced, he does raise issues to which 
we need a response. He objects (no pun intended) to the notion of "active 
objects" (citing Doug Lea's book) on two grounds...(I paraphrase his 

1  Active objects are inconsistent with service provision
Objects should provide services to others. Active objects take 
responsibility for scheduling upon themselves, and away from clients. The 
situation becomes "particularly delicate" when both client and server are 

2 Active objects clash with inheritance
How do you inherit, and modify, an active behaviour? He criticizes 
Simula's "inner" construct for forcing a parent class to prepare the 
ground for offspring. A class should be "open" to modification, but 
"closed" upon use. Multiple inheritance exacerbates the problem.

He goes on to propose a "separate" declaration qualifier, which indicates 
that the object's procedures execute all on a single distinct thread 
(static). This removes the need for mutual exclusion to protect object 
state since only one thread can pass through any object.

Seems to me that neither of these objections really stand up. (He devotes 
a paragraph or two to CSP and just one line merely acknowledging occam's 
existance.) Tom has offered one model for inheritance with CPA, via 
delegation. I'm proposing an extensible interface based upon the formal 
notion of a service. Both remain to be demonstrated. Each may have 
problems. Neither allows for extension, or modification, of the 
(pro)active ingredient in a process. Should all activity be _reactive_? 
(One could include reaction to a 'start' event.)

It seems to me that, if you start with processes then you run into 
trouble with some OO principles, but if you start with (passive) objects 
then you run into concurrency issues. My money is on processes.


Dr. Ian Robert East         School of Computing and Mathematical Sciences
ireast@xxxxxxxxxxxxx                            Oxford Brookes University
(44) 1865 483635                                          Turing Building
                                                          Wheatley Campus 
                                                          Oxford OX33 1HX
Consultation hours for 2001/2002 Term 1
Mon 09.00..11.00
Fri 11.00..13.00