Java Design:
Building Better Apps and Applets

Introduction

This document is a mirror page!

This file is a ROUGH conversion of a JAVA DESIGN pre-production file into HTML, using HoTmeTaL Pro.

JAVA DESIGN includes over 170 illustrations. None are included here (HoTMeTaL Pro does not automatically convert .wmf artwork).

So these pages will give you a good idea about what the book is all about, yet is no substitute for the real thing (thank goodness!).

Title: JAVA DESIGN: Building Better Apps and Applets
Authors: Peter Coad and Mark Mayfield
ISBN: 0-13-271149-4

Back to Table of Contents
On to Chapter 1

Introduction

Building materials profoundly affect design techniques.

Home construction materials affect home design. Fabrics affect clothing design. And yes, programming construction materials (languages) affect software design.

In every field of human endeavor, new construction materials are followed by new design methods. Hence, "design with Java."

It's worth taking a closer look at Java, from a designer's perspective. What new building materials would it give us? How would those materials affect the way we think about, discuss, trade-off, and improve our designs?

Java was designed to prevent common mistakes in object-oriented design and programming (especially C++ design and programming).

Java design is profound. It has forever changed how we think about object models and scenarios. It makes object models and scenario views pluggable (unplug an object from one class; plug in an object from another class; and continue on your way -- as long as both classes implement the needed interface). Very significant indeed.

Design

Chapter 1, "Design by Example," delivers a practical "how to" guide for effective design. It introduces examples that wind their way through the entire book: a business example and a real-time example.

Design by Example.

Identify purpose and features.

Select classes.

Sketch a user interface.

Work out dynamics with scenarios.

Build an object model.

If you are already well-versed in object-oriented design, you might choose to just scan Chapter 1, and then proceed with Chapter 2.

Java-Inspired Design

Chapter 2, "Design with Composition (Rather than Inheritance)," establishes that composition is the norm, inheritance is the exception; composition is more flexible, inheritance is more rigid; composition is more encapsulated; inheritance is only somewhat encapsulated. It points out a five-fold checklist for deciding when it's a good idea to use inheritance, and (more often) when it's a good idea to avoid it.

Design with Composition, Rather than Inheritance.

Composition: the norm

Inheritance: the exception (and its risks)

Inheritance vs. interfaces

Five "must satisfy" criteria

Chapter 3, "Design with Interfaces," presents the most significant aspect of Java-inspired design: freedom from object connections that are hardwired to just one class of objects, freedom from scenario interactions that are hardwired to just one class of objects. For systems in which flexibility, extensibility, and pluggability are key issues, Java-style interfaces are a must. Indeed, the larger the system, and the longer the potential life span of a system, the more significant interface-centric scenario development becomes.

Design with Interfaces.

Factor-out repeaters.

Factor-out to a proxy.

Factor-out for analogous apps.

Factor-out for future expansion.

Chapter 4, "Design with Threads," brings out when to use concurrency and how to use it safely. Most designs must account for multiple streams of program execution; this chapter shows how to do that, safely. Threads give you the clean, simple way to design-in the main thing you want your application to do, along with other things that you'd like it to be aware of or check on from time-to-time.

Design with Threads.

How; why; when to avoid; how long

Sync: what's guaranteed, what's not

Shared value (and keeping out of trouble)

Shared resource (and keeping out of trouble)

Multiple clients, multiple threads within an object

Multiple thread objects, multiple threads within an object

Interface adapters

Chapter 5, "Design with Notification," examines how one object notifies others about a significant change. Passive notification is simple yet resource-intensive. Timer-based notification is a useful pattern. Yet active notification is most interesting; it's an essential ingredient for problem-domain object reuse; it's an essential ingredient for designing loosely-coupled subsystems. Java's own active notification mechanism (observable-observer) is defective; this chapter goes beyond that weakness, showing you how to really get the job done.

Design with Notification.

Three kinds: passive, time-based, active

Going beyond observable-observer

Observable components (composition and interfaces to the rescue)

Repeaters

Threaded-observable components

Several appendices follow Chapter 5:

A. Design Strategies

B Java Visibility.

A Design Book

We love Java programming. It's contagious. Way cool. And lots of fun.

Yet that is not the subject of this book.

This book is about design. Indeed, it is about better design strategies, inspired by the intrinsic language features found in Java.

These strategies may be applied in any design, even if the target language is not Java.

Java snippets, short and to-the-point examples and excerpts, appear throughout this book. These Java snippets include lots of comments. You can read along and understand the design issue, even without prior experience with the Java itself.

After a while, though, you might want to read a programming book on Java. We own a stack of them! Our personal favorites to date are:

Cornell, Gary and Cay Horstmann, Core Java. Prentice Hall, 1996.

This programming book has a good blend of illustrations and source code.

It includes quite a bit of material on threads, too.

Flanagan, David, Java in a Nutshell. O'Reilly & Associates, 1996.

This programming book is very source-code intensive. Very few illustrations

here. It includes lots and lots of well-documented Java source code.

The Companion CD-ROM

The companion CD-ROM includes:

Feedback and Hands-On Workshops

Please feel free to send in feedback-much appreciated. In addition, if you are interested in custom-in-house or CD-ROM workshops, please visit our web sites for more information.

Peter Coad

coad@oi.com www.oi.com

Mark Mayfield

cover Back to internet programming Links (ip-Links) page
Back to Java OO Design & Coding Standards (joodcs) page
Back to "Java Design" book page
Back to Table of Contents
Source http://www.oi.com/0.htm
On to Chapter 1

Home | Search | What's New | Workshops | Books
Software | Support | Free Goodies | Newsletters | Feedback