Monday, 22 December 2008

Design Patterns Java™ Workbook - Part1

Today i started reading Design Patterns Java™ Workbook By Steven John Metsker.

Nice book written by Steven John Metsker.

I wanted to share few quotations found the book from the 1st 2 chapters.

1) A pattern is a way of doing something, or a way of pursuing an intent. This idea applies to cooking, making fireworks, developing software, and to any other craft. In any craft that is mature or that is starting to mature, you can find common, effective methods for achieving aims and solving problems in various contexts. The community of people who practice a craft usually invent jargon that helps them talk about their craft. This jargon often refers to patterns,or standardized ways of achieving certain aims. Writers document these patterns, helping to
standardize the jargon. Writers also ensure that the accumulated wisdom of a craft is available to future generations of practitioners.

2) Patterns are distillations of accumulated wisdom, providing a standard jargon and naming the concepts that experienced practitioners apply. The patterns in Design Patterns are among the most useful class-level patterns and are certainly worth learning.

3) Speaking abstractly, a class's interface is the collection of methods and fields that a class permits objects of other classes to access. This interface usually represents a commitment that the methods will perform the operation implied by their names and as specified by code comments and other documentation. A class's implementation is the code that lies within its methods.

4) A constant is a field that is static and final.

5) The basic purpose of a Java interface is to declare a set of methods that a class implements.This usually implies that the class provides the services that the method names suggest. An exception to this responsibility occurs when the interface lets an object register for event notification. In this situation, the client of the interface bears responsibility for calling the interface methods when the events implied by the method names occur. When you create a registration interface, it is useful to pair the interface with an abstract class that provides empty implementations of the interface methods, simplifying registration. Interfaces and classes can also collaborate in the use of constants, with interfaces providing better readability.

6) The intent of each design pattern is to solve a problem in a context. Interface-oriented patterns address contexts in which you need to define or to redefine access to the methods of a class or a group of classes. For example, when you have a class that performs a service you need but with method names that do not match a client's expectations, you can apply the ADAPTER pattern.

Glossary

ABSTRACT CLASS

A class that cannot be instantiated because it either contains abstract methods or is declared to be abstract.

ABSTRACT METHOD

A declaration of an operation that concrete subclasses must implement.

ALGORITHM

A procedure, or sequence of instructions, that accepts inputs and produces outputs.

No comments: