1 / 23

Design Patterns in Java Chapter 1 Introduction

Design Patterns in Java Chapter 1 Introduction. Summary prepared by Kirk Scott. 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

astra
Download Presentation

Design Patterns in Java Chapter 1 Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Design Patterns in JavaChapter 1Introduction Summary prepared by Kirk Scott

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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

  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?

  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

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

  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

  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

  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

  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

  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.

  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.

  23. The End

More Related