23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.1.3 Design Patterns<br />

One of the advantages of object-oriented design is that it facilitates reusable, robust,<br />

<strong>and</strong> adaptable software. Design<strong>in</strong>g good code takes more than simply underst<strong>and</strong><strong>in</strong>g<br />

object-oriented methodologies, however. It requires the effective use of objectoriented<br />

design techniques.<br />

Comput<strong>in</strong>g researchers <strong>and</strong> practitioners have developed a variety of organizational<br />

concepts <strong>and</strong> methodologies for design<strong>in</strong>g quality object-oriented software that is<br />

concise, correct, <strong>and</strong> reusable. Of special relevance to this book is the concept of a<br />

design pattern, which describes a solution to a "typical" software design problem.<br />

A pattern provides a general template for a solution that can be applied <strong>in</strong> many<br />

different situations. It describes the ma<strong>in</strong> elements of a solution <strong>in</strong> an abstract way<br />

that can be specialized for a specific problem at h<strong>and</strong>. It consists of a name, which<br />

identifies the pattern, a context, which describes the scenarios for which this pattern<br />

can be applied, a template, which describes how the pattern is applied, <strong>and</strong> a result,<br />

which describes <strong>and</strong> analyzes what the pattern produces.<br />

We present several design patterns <strong>in</strong> this book, <strong>and</strong> we show how they can be<br />

consistently applied to implementations of data structures <strong>and</strong> algorithms. These<br />

design patterns fall <strong>in</strong>to two groups—patterns for solv<strong>in</strong>g algorithm design<br />

problems <strong>and</strong> patterns for solv<strong>in</strong>g software eng<strong>in</strong>eer<strong>in</strong>g problems. Some of the<br />

algorithm design patterns we discuss <strong>in</strong>clude the follow<strong>in</strong>g:<br />

• Recursion (Section 3.5)<br />

• Amortization (Section 6.1.4)<br />

95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!