Programming with Patterns Jeremy Cronan Alliance Safety Council

Slides:



Advertisements
Similar presentations
Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
Advertisements

 Recent researches show that predicative programming can be used to specify OO concepts including classes, objects, interfaces, methods, single and multiple.
18-1 Verifying Object Behavior and Collaboration Role playing – the act of simulating object behavior and collaboration by acting out an object’s behaviors.
March Ron McFadyen1 Design Patterns In software engineering, a design pattern is a generally repeatable solution to a commonly-occurring problem.
Design Patterns Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
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.
March Ron McFadyen1 Design Patterns In software engineering, a design pattern is a generally repeatable solution to a commonly-occurring problem.
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.
Chapter 26 Applying Gang of Four Design Patterns 1CS6359 Fall 2012 John Cole.
CERN – European Organization for Nuclear Research GS Department – Administrative Information Services Design Patterns in Groovy Nicolas Décrevel Advanced.
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Idioms and Patterns polymorphism -- inheritance and delegation idioms -- realizing.
Behavioral Patterns  Behavioral patterns are patterns whose purpose is to facilitate the work of algorithmic calculations and communication between classes.
Design Patterns.
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.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
CS 210 Introduction to Design Patterns September 28 th, 2006.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Design Pattern. The Observer Pattern The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Patterns in programming 1. What are patterns? “A design pattern is a general, reusable solution to a commonly occurring problem in software. A design.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
CS 210 Adapter Pattern October 19 th, Adapters in real life Page 236 – Head First Design Patterns.
ECE450S – Software Engineering II
Patterns in programming1. 2 What are patterns? Answers to common design problems. A language used by developers –To discuss answers to design problems.
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
Title Carolina First Steering Committee October 9, 2010 Online Voting System Design Yinpeng Li and Tian Cao May 3, 2011.
Design Patterns Singleton & Factory Pattern Eriq Muhammad Adams J. Mail : | Blog :
Creational Patterns
Design Patterns. OO-Concepts Don’t rewrite code Encapsulation Inheritance Write flexible code.
Programmeerimine Delphi keskkonnas MTAT Programmeerimine Delphi keskkonnas MTAT Jelena Zaitseva
FACTORY METHOD. Design Pattern Space Purpose ScopeCreationalStructuralBehavioral ClassFactory MethodAdapterInterpreter Template Method ObjectAbstract.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Design Pattern. Definition: A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
CS 210 Final Review November 28, CS 210 Adapter Pattern.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
Design Patterns Introduction
Using Software Design Patterns Bill Anderson. About me Fox developer since 1987 Fox developer since 1987 Program Director, Los Angeles Visual Foxpro Developers.
Design Patterns SE464 Derek Rayside images from NetObjectives.com & Wikipedia.
Java Design Patterns Java Design Patterns. What are design patterns? the best solution for a recurring problem a technique for making code more flexible.
BEHAVIORAL PATTERNS 13-Sep-2012 Presenters Sanjeeb Kumar Nanda & Shankar Gogada.
Example to motivate discussion We have two lists (of menu items) one implemented using ArrayList and another using Arrays. How does one work with these.
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.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
CSE 332: Design Patterns (Part II) Last Time: Part I, Familiar Design Patterns We’ve looked at patterns related to course material –Singleton: share a.
StarBuzz Coffee Recipe Boil some water Brew coffee in boiling water Pour coffee in cup Add sugar and milk Tea Recipe Boil some water Steep tea in boiling.
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
An object's behavior depends on its current state. Operations have large, multipart conditional statements that depend on the object's state.
Chapter 10 Design Patterns.
Chapter 5:Design Patterns
Software Design Patterns
Don’t reinvent the wheel
MPCS – Advanced java Programming
Design Patterns Lecture part 2.
Introduction to Design Patterns
Behavioral Design Patterns
Design Patterns with C# (and Food!)
object oriented Principles of software design
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
Presented by Igor Ivković
Design Patterns in Game Design
Object Oriented Design Patterns - Structural Patterns
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Presented by Igor Ivković
Presentation transcript:

Programming with Patterns Jeremy Cronan Alliance Safety Council

What is a Design Pattern? A general reusable solution to a commonly occurring problem. It is a description or template for how to solve a problem that can be used in many different situations. It is not directions on how to exactly create code

Commonly used Patterns Observer Pattern Decorator Pattern Adapter and Facade Patterns Factory Pattern Command Pattern

Observer Pattern Pattern that uses Publishers and Subscribers where the subscribers register with the publisher and the publisher pushes all changes to the subscribers. One to many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically. Common Everyday example: Cell Phone Notifications

News Site Cell 1 Cell 3 Cell 2 Each Cell Registers with News Site

News Site Cell 1 Cell 3 Cell 2 News Site sends to all registered Cells

News Site Cell 1 Cell 3 Cell 2 Cell 2 unregisters from notifications

News Site Cell 1 Cell 3 Cell 2 News Site sends to all registered Cells (not Cell 2 since unregistered)

Decorator Pattern Attaching of additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. Common Everyday example: Calculating prices for drink coffee drinks with additions.

Adapter, and Facade Patterns Adapter Pattern: converts the interface of an object into another interface the client expects. Façade Pattern: provides a unified interface to a set of interfaces in subsystem.

PatternIntent DecoratorCoverts one interface to another AdapterDoesn’t alter the interface but adds responsibility FaçadeMakes an interface simpler

Factory Pattern Interface for creating an object, but lets subclasses decide which class to instantiate. Class defers instantiation to subclasses. Common Everyday example: Exporting different reports from a website

Attendance Report Expiration Report Cost Report void ExportToPDF() Each procedure has duplicate code to export the report to PDF after building grid of report

Attendance Report Expiration Report Cost Report void ExportToPDF() Each procedure calls a centralized procedure, passing a Factory that knows how to build the report TO CENTRALIZE CODE: void ExportReport(IFactory reqFactory) IFactory AttendanceFactory() IFactory ExpirationFactory() IFactory CostFactory()

Command Patterns Encapsulates a request as an object, which lets you parameterize other objects with different requests, queue or log requests, and support undo operations. Common Everyday example: Remote Controls

Other types of Patterns Singleton Pattern Template Method Pattern State Pattern Proxy Pattern Compound Patterns Bridge Patterns Etc.

Questions? Reference: Head First Design Patterns by Eric Freeman and Elisabeth Freeman Jeremy Cronan Alliance Safety Council