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

RE: OO vs. CSP - Papers, Arguments?




Kai writes:
>> Peter Welch ... states that OO is 
>> not providing "real" data encapsulation. 
>

Neil writes: 
> Imagine ... a library system, where Library is an object (holding 
> links to all its Books), and Book is an object with a link to 
> its Library.  You might get a situation where you call 
> checkOut() on Book.  Book adjust its own member data 
> accordingly, and notifies the Library.  Due to a 
> misunderstanding in the spec, Library invokes a notification 
> method on Book, thus checking it out a second time.  When 
> Book returns from notifying the library, it doesn't know that 
> it has been accessed again during that time; the program 
> would continue and the bug remain undetected. 

A problem not involving errors of understanding is that there is 
at least a small window of time in which the data base must be 
locked to prevent other users from also checking out the same book,
resulting in inconsistencies in the data base.   While the data 
base may have locking and other tools to ensure safety, its
*not* part of OO.  The point is that while it may be possible
to code it correctly using data base features, CSP makes it natural.
 
-jc