SE2811 Week 7, Class 2 The Gang of Four and more … Lab Thursday: Quiz SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder.

Slides:



Advertisements
Similar presentations
GoF State Pattern Aaron Jacobs State(305) Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
Advertisements

Nevena Ackovska/Magdalena Kostoska Faculty of Computer Science and Engineering (FCSE) UKIM, Skopje, Macedonia 11 th DAAD Workshop on “Software Engineering.
Strategy Pattern1 Design Patterns 1.Strategy Pattern How to design for flexibility?
Week 8, Class 3: Model-View-Controller Model-View-Controller Why? What? How? Example: Barnyard Simon for the Web Question: Where should we use the command.
Design Patterns for Object Oriented systems CSC 515 Ashwin Dandwate.
Design Patterns Yes, they are important Robert Cotton April 23, 2009.
05/26/2004www.indyjug.net1 Indy Java User’s Group June Knowledge Services, Inc.
Design Patterns CS is not simply about programming
Design Patterns. What are design patterns? A general reusable solution to a commonly occurring problem. A description or template for how to solve a problem.
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
Spring 2010CS 2251 Design Patterns. Spring 2010CS 2252 What is a Design Pattern? "a general reusable solution to a commonly occurring problem in software.
Adapters Presented By Zachary Dea. Definition A pattern found in class diagrams in which you are able to reuse an ‘adaptee’ class by providing a class,
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
Builder A Creational Design Pattern A Presentation by Alex Bluhm And.
Design Patterns Discussion of pages: xi-11 Sections: Preface, Forward, Chapter
1 CSC 427: Data Structures and Algorithm Analysis Fall 2011 See online syllabus (also available through BlueLine): Course goals:
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Advanced topics in software engineering CSC532 Term Paper Design Patterns Harpreet Singh Submitted By:-
SE2811 Week 7, Class 1 Composite Pattern Applications Conceptual form Class structure Coding Example Lab Thursday: Quiz SE-2811 Slide design: Dr. Mark.
ISP666 MVC & Design Patterns. Outline Review Event Programming Model Model-View-Controller Revisit Simple Calculator Break Design Patterns Exercise.
DaveAndAl.net Do Application Design Patterns Make Sense in ASP.NET? Alex Homer You may like to write these down now...
January 12, Introduction to Design Patterns Tim Burke References: –Gamma, Erich, et. al. (AKA, The Gang of Four). Design Patterns: Elements of Reusable.
Patterns in programming 1. What are patterns? “A design pattern is a general, reusable solution to a commonly occurring problem in software. A design.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
CS 325: Software Engineering February 12, 2015 Applying Responsibility-Assignment Patterns Design Patterns Situation-Specific Patterns Responsibility-Assignment.
Mastergoal Machine Learning Environment Phase III Presentation Alejandro Alliana CIS895 MSE Project – KSU.
Behavioral Design Patterns Morteza Yousefi University Of Science & Technology Of Mazandaran 1of 27Behavioral Design Patterns.
CSE 403 Lecture 14 Design Patterns. Today’s educational objective Understand the basics of design patterns Be able to distinguish them from design approaches.
Mohammed Al-Dhelaan CSci 253 Object Oriented Design Instructor: Brad Taylor 06/02/2009 Factory Method Pattern.
Testing Extensible Design Patterns in OO Frameworks through Scenario Templates D.S. Sanders Software Verification & Validation.
Patterns in programming1. 2 What are patterns? Answers to common design problems. A language used by developers –To discuss answers to design problems.
05/26/2004www.indyjug.net1 Indy Java User’s Group May Knowledge Services, Inc.
CS 160: Software Engineering October 22 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
CS2852 Week 3, Class 2 Today Stacks Queues SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
CS2852 Week 5, Class 2 Today Queue Applications Circular Queue Implementation Testing SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
CS2852 Week 7, Class 1 Today Binary Search Tree Implementing add Implementing find Return Quiz 4 (second attempt) Both sections are graded SE-2811 Slide.
Week 7, Day 3 Half-Exam 2 A New Pattern SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
CS2852 Week 6, Class 2 Today Class exercise: Implementing a recursive method Binary Search Trees Tomorrow: Quiz at start of lab Implementing a recursive.
Week 5, Day 2: Decorator Decorators Muddiest Point Tomorrow: Quiz on lab reading: web.msoe.edu/hasker/se2811/labs/5/ SE-2811 Slide design:
Week 6, Day 3 The Gang of Four and more … A new design pattern SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
Week 7, Class 1: The Command Pattern (cont.) Get Ready for Poll Everywhere Labs 2 & 3 returned Lab 7 due this evening at 11pm Quiz tomorrow at start of.
Slide design: Dr. Mark L. Hornick
Week 10, Day 3 Review for the quarter SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
Week 9, Day 1 Proxy SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
Week 6, Class 3: Composite Swing composites File composites Computer composites SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
Week 4, Day 1: Singleton(s?) Singleton leftover Why singletons? How to make lazy initialization work multi- threaded? Observers Why observers? Class structure.
Week 5, Class 3: Decorators Lab questions? Example: Starbuzz coffee Basic Pattern More examples Design Principles Compare with alternatives SE-2811 Slide.
SE2811 Week 8 – Class 2 Re: Lab due tonight SE-2811 Slide design: Dr. Mark L. Hornick Much Content: Dr. Hornick Most Errors: Dr. Yoder 1.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Design Patterns: MORE Examples
The Object-Oriented Thought Process Chapter 15
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
MPCS – Advanced java Programming
Week 2, Day 1: The Factory Method Pattern
Design Patterns Introduction
Object Oriented Design Patterns - Creational Patterns
Week 7, Class 1: The Command Pattern (cont.)
Introduction to Design Patterns
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
Slide design: Dr. Mark L. Hornick
11. MVC SE2811 Software Component Design
Week 8, Class 3: Model-View-Controller
Slide design: Dr. Mark L. Hornick
Composite Design Pattern By Aravind Reddy Patlola.
11. MVC SE2811 Software Component Design
SE-1021 Software Engineering II
Slide design: Dr. Mark L. Hornick
Presentation transcript:

SE2811 Week 7, Class 2 The Gang of Four and more … Lab Thursday: Quiz SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1

The Gang of Four © Head First Design Patterns -- Eric and Elisabeth Freeman 2

The Gang of Four Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, 1994Erich GammaRichard HelmRalph JohnsonJohn Vlissides SE-2811 Dr. Mark L. Hornick 3 and more … Portland Pattern Repository ( Portland Pattern Repository (

Gang of Four Patterns 23 patterns (See handout) divided into three categories: Creational Involve object instantiation and all provide a way to decouple a client from the objects it needs to instantiate Behavioral Are concerned with how classes and objects interact and distribute responsibility Structural Let you compose classes or objects into larger structures 4

Patterns so far Strategy Singleton Factory Method Observer Decorator Composite Exercise: For each pattern, decide which category it falls in, and highlight it on the handout. SE-2811 Dr. Mark L. Hornick 5 Behavioral Structural Creational

SE-2811 Dr. Josiah Yoder 6 Behavioral Structural Creational

And more… The Portland Pattern Repository (at c2.com) contains all of the GoF patterns, and more … The Portland Pattern Repositoryc2.com ObjectPoolPattern – for reusing e.g. threads ObjectPoolPattern ExternalizeTheStack – For implementing recursion with a custom stack ExternalizeTheStack LockPattern – Temporarily lock (or perhaps queue?) changes to an object LockPattern SE-2811 Dr. Mark L. Hornick 7

Final Project From the syllabus… “…As a final assignment, students conduct research on software design patterns and present and demonstrate the results of their investigations to the class.” SE-2811 Dr. Mark L. Hornick 8

Choosing a Design Pattern (1) We would like to only create as many threads as we have cores on this machine… if part of our program wants a thread, it should go to one spot to get it. You are processing a file while reading it, and you would like to know what the next byte is that will be read, without “reading” it (so the next byte read will still give you that byte) SE-2811 Dr. Mark L. Hornick 9

Choosing a Design Pattern (2) You’ve got a class that implements Comparable, and it’s great for storing in VariousTrees, but for some rare objects, the Comparable option takes WAY too long. You’d like to modify the compare method so that if some fixed amount of time elapses, a runtime exception is thrown so you can handle the rogue objects. Only problem – you can’t modify the original class – it’s in compiled code. SE-2811 Dr. Mark L. Hornick 10

Choosing a Design Pattern (3) You want your clients to be able to write plugins to represent new shapes in your shape application. You don’t know what these shapes are (yet), but you want to be able to select them from a shape toolbar. You are designing a new version of Enterprise Architect. You would like to be able to represent various components of your program, such as classes and methods, modeling sub-classes naturally. SE-2811 Dr. Mark L. Hornick 11

Choosing a Design Pattern (4) Throughout your program, you would like to play sounds, but you only have one audio card. You are implementing a graphical user interface toolkit. You would like to create “sections of the screen” that can contain arbitrary buttons, text fields, etc. SE-2811 Dr. Mark L. Hornick 12

Choosing a Design Pattern (5) You have this great class (again, no source) that does cool stuff. But some methods take a long time to run. You’d like to have a version of that class which saves a computed value, and only recomputes the value if the state of the class changes. Depending on which operating system your File is on, it may be implemented differently. The user should get the right implementation automatically. SE-2811 Dr. Mark L. Hornick 13

SE-2811 Dr. Mark L. Hornick 14