Chapter 3. Building Blocks

Show me your code and conceal your data structures, and I shall continue to be mystified. Show me your data structures, and I won't usually need your code; it'll be obvious.

—Eric Raymond (paraphrasing Fred Brooks), The Cathedral and the Bazaar

Now that we've taken a quick tour of the JavaSpaces API, we have the tools in hand to begin exploring space-based programming in more depth. As with any new programming model or paradigm, learning to write programs using JavaSpaces technology involves both changing the way you think about programming and mastering a set of new techniques and patterns for your programming repertoire.

Our aim over the next several chapters is to show you a new way of programming based on passing around (writing, reading, and taking) entries through spaces. The techniques we will show you are straightforward and surprisingly simple, yet they form the basis of many of the most sophisticated space-based applications. This is the beauty of JavaSpaces technology. Using a simple API, we can create powerful programs yet avoid both the complexity of lower-level approaches and many of the pitfalls that crop up when developing distributed applications.

In this chapter we are going to concentrate on a common set of building blocks that are used in practically every space-based program. You can think of these building blocks as data structures—in fact, they are distributed data structures. With these simple data structures under our belt, we'll use them in the next two chapters to achieve two different goals: synchronization and communication (the glue that ties processes in a distributed program together). Then, armed with techniques for sophisticated communication and synchronization, in Chapter 6 we will explore the most common application patterns used in space-based programming.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset