Presentation is loading. Please wait.

Presentation is loading. Please wait.

Design Patterns in Java Chapter 1 Introduction Summary prepared by Kirk Scott 1.

Similar presentations


Presentation on theme: "Design Patterns in Java Chapter 1 Introduction Summary prepared by Kirk Scott 1."— Presentation transcript:

1 Design Patterns in Java Chapter 1 Introduction Summary prepared by Kirk Scott 1

2 Intended Audience, Coverage, etc. The classic book, Design Patterns, was written by Gamma, Helm, Johnson, and Vlissides This book covers the same set of 23 patterns The book is intended for software programmers/developers who know Java and want to improve their skills as designers 2

3 What is a Pattern? A pattern is a way of doing something It can be thought of as a technique for accomplishing some goal This book dwells on the intent of patterns as an organizing characteristic 3

4 Where do Patterns Come From? Software development is repetitive: Quite often, different programmers have to solve the same problem Experienced programmers have compared notes and discovered that they arrived at common solutions to the same problem Over time, these common solutions, have been documented as the best know approach to solving a given problem 4

5 Why Design Patterns? Observe that in school, you learn to program first and learn about design later When you compare your solution to a problem with someone else’s solution, you may realize that the other solution is simpler, more efficient, or more desirable in some other way In practice, it is helpful to have knowledge of design before trying to code a solution to a problem 5

6 Why Design Patterns? Cont’d. Design patterns are one step up from straight code writing They represent recognized software solutions in terms of (small) collections of classes related in a certain way and containing certain sets of methods It is important to keep in mind that the implementation is not the pattern—a pattern is the abstract design which embodies the intent 6

7 Why Design Patterns? Cont’d. Design patterns have been developed most extensively in the object-oriented realm The authors point out that there are currently over 100 documented design patterns The 23 covered in the book have been chosen for historic reasons They are certainly worth knowing, whether they are absolutely the most important 7

8 Why Design Patterns? Cont’d. In particular, whether the most important or not, the 23 chosen patterns provide a broad introduction to and illustration of what patterns are and what good they are The authors assert that if a person wants to become a good Java programmer, it is necessary to study design patterns Design patterns are the first step out of the swamp of syntax that an introduction to programming is 8

9 Why Java? Java is a consolidation language This means that it is a kitchen sink language in the footsteps of C and C++, and for this reason, if no other, it is popular The object-oriented programming is based on classes and instances, and this paradigm is currently the most popular approach to implementing graphical user interfaces, for example Java’s characteristics make it likely that future popular languages will follow in Java’s footsteps 9

10 UML Implementations of patterns are done in code However, the pattern itself consists of the relationships among classes and so on UML is one of several notations for diagramming notations, but it is certainly a popular one The point is that some abstract representation of patterns is desirable, rather than appealing always to the code of a particular implementation 10

11 Challenges The book contains questions These may be short answer questions They may also be programming questions based on the book’s example code This course will not give these challenges as assignments Instead, the challenges and the authors’ solutions will be examined to see what can be gained from them 11

12 The Organization of the Book The patterns in a book of this kind could be given in the same order as the original design patterns book They could also be grouped together according to similarity in structure This book organizes the patterns according to the intent which the authors ascribe to them 12

13 The Organization of This Book, cont’d. This raises the question of how to classify intent The authors suggest that categories of patterns can be recognized according to how the patterns make it possible to go beyond the basic characteristics built into the structure of Java They use as an initial example the idea of interfaces 13

14 The Organization of This Book, cont’d. Suppose you have a class/method which requires an object of a class which implements a given interface Suppose that you would like to apply the above to an object of a class which does not implement the required interface Short of rewriting the given class, what approach could be taken? 14

15 The Organization of This Book, cont’d. The answer is that there is a pattern known as the Adapter pattern (not to be confused with adapter classes in Java) which accomplishes this goal The Adapter pattern, and others with similar intents, are classified in an intent category known as Interfaces To recapitulate, these patterns help the programmer accomplish things using interfaces, going beyond the syntax provided in Java 15

16 The Organization of This Book, cont’d. The book classifies patterns into these five categories: – Interfaces – Responsibility – Construction – Operations – Extensions 16

17 The Organization of This Book, cont’d. The book, as a consequence is organized in the same way The authors admit that various patterns may fit more than one category In such cases, the pattern is given in detail in the first category where it fits, and is mentioned briefly in subsequent sections The classification of patterns is not an absolute, but some classification is useful and necessary, and is a starting point for suggesting alternative classifications 17

18 The Organization of This Book, cont’d. What follows is a complete preview of the contents of the book Intent Category: Interfaces. Patterns: Adapter, Façade, Composite, Bridge Intent Category: Responsibility. Patterns: Singleton, Observer, Mediator, Proxy, Chain of Responsibility, Flyweight 18

19 The Organization of This Book, cont’d. Intent Category: Construction. Patterns: Builder, Factory Method, Abstract Factory, Prototype, Memento Intent Category: Operations. Patterns: Template Method, State, Strategy, Command, Interpreter Intent Category: Extensions. Patterns: Decorator, Iterator, Visitor 19

20 Welcome to Oozinoz! The book’s examples are based on an integrated code base which is collectively known as Oozinoz (oohs and ahs), which deals with software needed for the production of fireworks The authors’ examples will be studied, but as noted already, the challenges will not be given as assignments 20

21 Summary This is the book’s summary of the chapter, verbatim: – Patterns are distillations of accumulated wisdom that provides a standard jargon, naming the concepts that experienced practitioners apply. – The patterns in the classic book Design Patterns are among the most useful class-level patterns and are certainly worth learning. 21

22 Summary, cont’d. – This book explains the same patterns as those documented in Design Patterns but uses Java and its libraries for its examples and challenges. – By working through the challenges in this book, you will learn to recognize and apply an important part of the wisdom of the software community. 22

23 The End 23


Download ppt "Design Patterns in Java Chapter 1 Introduction Summary prepared by Kirk Scott 1."

Similar presentations


Ads by Google