ABSTRACT

Each of the techniques that have been covered so far, such as the use of state diagrams, Java Events, and notification objects, as well as such concepts as race conditions and deadlock, is very powerful in its own right; however, it is when these are used together and combined with other object-oriented programming (OOP) concepts, such as confinement, that truly elegant yet simple program designs and implementations can be achieved. Problems that would be difficult, if not impossible, to effectively realize using other paradigms are easily decomposed into cooperating, asynchronous activities. This chapter solves four problems to illustrate some of the ways in which combining concurrent programming techniques can produce elegant and effective components. On first trying to understand these solutions, they may seem complex; however, when the interactions between the components and asynchronous activities are isolated and the components are seen as providing a single coherent service to those asynchronous activities, the complexity within the programs can be viewed as being much less than would be required with some other implementation mechanisms. These simple components can then be used as building blocks for larger, more complex systems.