Expect problems and eat them for breakfast.
--Your friends at LectureNotes

Note for DESIGN PATTERN - dp By JNTU Heroes

  • Note
  • Jawaharlal Nehru Technological University Anantapur (JNTU) College of Engineering (CEP), Pulivendula, Pulivendula, Andhra Pradesh, India - JNTUACEP
  • 5 Topics
  • 128 Offline Downloads
  • Uploaded 2 years ago
Jntu Heroes
Jntu Heroes
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-2

CONTENTS UNIT-I Introduction: 1. 2. 3. 4. 5. 6. 7. 8. What is a design pattern? Design patterns in Smalltalk MVC Describing Design Patterns The Catalog of Design Patterns Organizing the Catalog How Design Patterns Solve Design Problems How to Select a Design Pattern How to use a Design Pattern. UNIT-II A Case Study: 1. Designing a Document Editor Design Problems, 2. Document Structure 3. Formatting 4. Embellishing the User Interface 5. Supporting Multiple Look-and Feel Standards 6. Supporting Multiple Window Systems, 7. User Operations Spelling Checking and Hyphenation, 8. Summary. 9. Creational Patterns: Abstract Factory 10. Builder 11. Factory Method 12. Prototype 13. Singleton 14. Discussion of Creational Patterns UNIT-III Structural Pattern Part-I : 1. Adapter 2. Bridge 3. Composite Structural Pattern Part-II : 1. 2. 3. 4. Decorator Façade Flyweight Proxy 2

Text from page-3

UNIT-IV Behavioural Patterns Part-I : 1. Chain of Responsibility 2. Command 3. Interpreter 4. Iterator Behavioural Patterns Part-II : 1. Mediator 2. Memento 3. Observer UNIT-V Behavioural Patterns Part-II (cont’d): 1. 2. 3. 4. 5. State Strategy Template Method Visitor Discussion of Behavioral Patterns 6. What to Expect from Design Patterns 7. A Brief History 8. The Pattern Community An Invitation 9. A Parting Thought UNIT -I 3

Text from page-4

Introduction What is a Design Pattern? • Each pattern Describes a problem which occurs over and over again in our environment ,and then describes the core of the problem • Novelists, playwrights and other writers rarely invent new stories. • Often ideas are reused, such as the “Tragic Hero” from Hamlet or Macbeth. • Designers reuse solutions also, preferably the “good” ones – Experience is what makes one an ‘expert’ • Problems are addressed without rediscovering solutions from scratch. “My wheel is rounder. Design Patterns are the best solutions for the re-occurring problems in the application programming environment. • Nearly a universal standard. • Responsible for design pattern analysis in other areas, including GUIs. • Mainly used in Object Oriented programming. Design Pattern Elements 1. Pattern Name Handle used to describe the design problem. Increases vocabulary. Eases design discussions. Evaluation without implementation details. 2. Problem Describes when to apply a pattern. May include conditions for the pattern to be applicable. Symptoms of an inflexible design or limitation. 3. Solution Describes elements for the design. Includes relationships, responsibilities, and collaborations. Does not describe concrete designs or implementations. A pattern is more of a template. 4. Consequences 4

Text from page-5

Results and Trade Offs. Critical for design pattern evaluation. Often space and time trade offs. Language strengths and limitations. (Broken into benefits and drawbacks for this discussion). Design patterns can be subjective. One person’s pattern may be another person’s primitive building block. The focus of the selected design patterns are: Object and class communication. Customized to solve a general design problem. Solution is context specific. Design patterns in Smalltalk MVC:  The Model/View/Controller triad of classes is used to build user interfaces in Smalltalk-80  MVC consists of three kinds of objects.  M->>MODEL is the Application object.  V->>View is the screen presentation.  C->>Controller is the way the user interface reacts to user input MVC decouples to increase flexibility and reuse. MVC decouples views and models by establishing a subscribe/notify protocol between them. A view must ensure that its appearance must reflects the state of the model. Whenever the model’s data changes, the model notifies views that depends on it. You can also create new views for a model without Rewriting it.  The below diagram shows a model and three views.  The model contains some data values, and the views defining a spreadsheet, histogram, and pie chart display these data in various ways.  The model communicates with it’s values change, and the views communicate with the model to access these values.  Feature of MVC is that views can be nested. 5

Lecture Notes