An Introduction to Design Patterns Brian Ordona. Programming: Constantly Searching for the Holy Grail  “There’s got to be a better way to do this!” 

Slides:



Advertisements
Similar presentations
UMBC Some Additional Patterns CMSC 432. UMBC More Patterns2 Introduction Over the next few lectures we’ll have an introduction to a number of patterns.
Advertisements

18-1 Verifying Object Behavior and Collaboration Role playing – the act of simulating object behavior and collaboration by acting out an object’s behaviors.
Introduction To System Analysis and Design
1 CS1001 Lecture Overview Homework 3 Homework 3 Project/Paper Project/Paper Object Oriented Design Object Oriented Design.
Dept. of Computer Engineering, Amirkabir University of Tech. 1 Design Patterns Dr. Noorhosseini Introduction.
Façade Pattern Jeff Schott CS590L Spring What is a façade? 1) The principal face or front of a building 2) A false, superficial, or artificial appearance.
Automatically Extracting and Verifying Design Patterns in Java Code James Norris Ruchika Agrawal Computer Science Department Stanford University {jcn,
Design Patterns William A. Hoffman NYU OOP Class.
CS350/550 Software Engineering Lecture 1. Class Work The main part of the class is a practical software engineering project, in teams of 3-5 people There.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
1 CS1001 Lecture Overview Object Oriented Design Object Oriented Design.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Façade Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented Design.
Singleton Christopher Chiaverini Software Design & Documentation September 18, 2003.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
SENG 422 Lab 2 Design Patterns Time: ELW B220 from (4:00 - 6:50) every Tuesday TA: Philip Baback Alipour Ph.D. Candidate in Electrical, Computer Engineering.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
Introduction To System Analysis and Design
Abstract Factory Design Pattern making abstract things.
Mediator Pattern and Multiuser Protection Billy Bennett June 8 th, 2009.
Chapter 6 Object-Oriented Java Script JavaScript, Third Edition.
1 ISA&D7‏/8‏/ ISA&D7‏/8‏/2013 Methodologies of the SDLC Traditional Approach to SDLC Object-Oriented Approach to SDLC CASE Tools.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Chapter 7 Software Engineering Introduction to CS 1 st Semester, 2015 Sanghyun Park.
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Facade Introduction. Intent Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
FacadeDesign Pattern Provide a unified interface to a set of interfaces in a subsystem. Defines a high level interface that makes the subsystem easier.
Design Patterns By Mareck Kortylevitch and Piotreck Ratchinsky.
CS616: Software Engineering Spring 2009 Design Patterns Sami Taha.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Java EE Patterns Dan Bugariu.  What is Java EE ?  What is a Pattern ?
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Design Patterns Introduction
1 Chapter 5:Design Patterns. 2 What are design pattern?  Schematic description of design solution to recurring problems in software design and,  Reusable.
Proxy Pattern defined The Proxy Pattern provides a surrogate or placeholder for another object to control access to it by creating a representative object.
Watching the movie the hard way…. Page 256 – Head First Design Patterns.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Object Oriented Programming. OOP  The fundamental idea behind object-oriented programming is:  The real world consists of objects. Computer programs.
Chapter 2 Principles of Programming and Software Engineering.
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming.
Basic Characteristics of Object-Oriented Systems
Software Construction Lab 05 Abstraction, Inheritance, and Polymorphism in Java.
 The Object Oriented concepts was evolved for solving complex problems. Object- oriented software development started in the 1980s. Object-oriented design.
Presented by FACADE PATTERN
Unit II-Chapter No. : 5- design Patterns
Chapter 5:Design Patterns
Software Design Patterns
MPCS – Advanced java Programming
Design Patterns Lecture part 2.
Software Design & Documentation
Introduction to Design Patterns
About the Presentations
Advanced Programming Behnam Hatami Fall 2017.
Software Engineering Lecture 7 - Design Patterns
Object Oriented Design Patterns - Structural Patterns
What is Singleton Category: Creational pattern
CS 350 – Software Design Singleton – Chapter 21
Generic Programming with Templates:
Chapter 8, Design Patterns Introduction
Presentation transcript:

An Introduction to Design Patterns Brian Ordona

Programming: Constantly Searching for the Holy Grail  “There’s got to be a better way to do this!”  The Mythical Man Month: F. Brooks – “No silver bullet,” but sees hope in Object Oriented Programming (OOP).

Object-Oriented Programming: Purpose  Provide a software solution to a defined problem through the simulation of real objects.  An example: Simulation of U.S. Senate decision making.  OK, you’ve created your objects, now what?!

Design Patterns: Purpose  Serves as an extension to OOP methodologies and techniques.  Essence: to organize code into logical constructs that attempt to achieve the following goals: 1.To complement OOP in facilitating the process of true simulation: OOP techniques dictate which objects will interact; Design patterns dictate how objects will interact (with each other and with real life). 2.To benefit to the programmer:  Better organization of code.  Facilitates the creation of reusable components.

The Design Patterns  Name  Primary Purpose  Simple (Theoretical) Example  Case Study (Practical) Example  Implementation: Main Features  3 or 4 patterns will be discussed: Singleton, Template Method, Façade, Mediator.

Case Studies  CS 631X (Software Design Methodologies) final project: Blackjack Simulator.  CS 615/616: Ear Training Application

Singleton  Purpose: Ensure that one and only one instance of a class is in use.  Example: Senate simulation – only one Vice President.  Case Study: The Card Deck object.  Implementation:  Constructor is private.  Contains a static reference to itself.  A single point of access to the Singleton object.

Template Method  Purpose: Defines a process, but gives control of each individual step to the programmer.  Example: A sorting application. public void SimpleSort() { receiveInput(); sortInput(); productOutput(); }

Template Method (cont.)  Case Study: An actual round of Blackjack.  Implementation:  The overall process is defined within the actual template method itself.  Define as abstract those methods where the programmer may want (or need) to provide custom implementation.

Template Method: Class Diagram

Facade  Purpose: Pools together the resources of a subsystem of classes in order to provide higher level functionality to a client class.  Example: A compiler.  Case Study: The “Virtual Pit Boss.”  Implementation:  The Façade calls methods on subsystem classes.  A client class calls methods on the Façade.  Loose coupling: distinct subsystem classes do not refer to each other.

Façade: BlackjackSession

Dealing a Card  NO! class Dealer { public Card deal() //Deal directly to player, NO! { player.addCard(Card); }  YES class BlackjackSession { public void play() //Façade calls methods on player and dealer. { Card dealtCard = dealer.deal(); player.addCard(dealtCard); }

Mediator  Purpose: Like the Façade, it controls the interaction between classes within a subsystem.  Difference: Façade = one-way communication, Mediator = two-way communication.  Case Study: GUI refresh methods within the Ear Training Application.  Implementation:  Loose coupling: distinct subsystem classes do not “confer” with each other, only with the Mediator.

Mediator: UPitchGUI2

Conclusion  Guaranteed, you have used design patterns even without knowing it.  Design patterns are born out of intuitive solutions to software problems: Pattern = Reoccurring Solutions that have been proven to work through experience.  The “discipline” of design patterns attempts to formalize these intuitive solutions into a methodology.