object-oriented design patterns

15
Object-Oriented Design Patterns

Upload: clay

Post on 23-Feb-2016

29 views

Category:

Documents


0 download

DESCRIPTION

Object-Oriented Design Patterns. All about me. Lee Brandt – Gemini Blog: http://www.codebucket.org Shout Outs: Geeks With Blogs http://www.geekswithblogs.net Dot Net User’s Group http://www.kcdotnet.com http://groups.google.com/group/kcdotnet. Agenda. What Design Patterns are - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Object-Oriented Design Patterns

Object-Oriented Design Patterns

Page 2: Object-Oriented Design Patterns

All about me

Lee Brandt – GeminiBlog: http://www.codebucket.orgShout Outs:Geeks With Blogshttp://www.geekswithblogs.netDot Net User’s Grouphttp://www.kcdotnet.com http://groups.google.com/group/kcdotnet

Page 3: Object-Oriented Design Patterns

Agenda

What Design Patterns are Why you should know them The categories of Patterns The Patterns themselves Where you might (already) use them When NOT to use a Design Pattern

Page 4: Object-Oriented Design Patterns

What Are Design Patterns? Names for Commonly Solved Problems Elements of Reusable OO Software Gang of Four

Erich Gamma Richard Helm Ralph Johnson John Vlissides

Code Complete Steve McConnell

Patterns of Enterprise Architecture

Martin Fowler

Page 5: Object-Oriented Design Patterns

Why Should You Care?

Common Vocabulary Discussing software design Easy Understanding

Someone has already solved this problem

Proven Good Design Understanding others’ code

Page 6: Object-Oriented Design Patterns

Get to the Patterns Fat Boy. Pattern Categories

Creational Structural Behavioral Pastoral Pastoral-Comical Historical-Pastoral Tragical-Historical Tragical-Comical-Historical…

Page 7: Object-Oriented Design Patterns

Creational Patterns Factory Method

Used to create a concrete instance of a type Abstract Factory

Creates Families of like objects Builder

Used when an object can take multiple steps to instantiate

Prototype Creates an object by “copying” itself from a base

Singleton Ensures that only one instance of an object exists

Page 8: Object-Oriented Design Patterns

Structural Patterns Adapter

Makes an object of one interface look like another interface for the consuming client

Bridge Decouples an object’s interface from its implementation

Composite A tree structure of simple and composite objects

Decorator Add responsibilities to an object dynamically

Façade Single class that simplifies access to an entire subsystem

Flyweight A small instance managed by a list of state data

Proxy An object that stands in for another object

Page 9: Object-Oriented Design Patterns

Behavioral Patterns Chain of Responsibility

A way of passing a request between a chain of objects

Command Encapsulate a command request as an object

Interpreter A way to include language elements in a program

Iterator Sequentially access the elements of a collection

Mediator Defines simplified communication between classes

Page 10: Object-Oriented Design Patterns

Behavioral Patterns continued… Memento

Capture and restore an object's internal state Observer

A way of notifying change to a number of classes State

Changes an object’s behavior when its state changes Strategy

Encapsulates an algorithm inside a class Template Method

Defer the exact steps of an algorithm to a subclass Visitor

Defines a new operation to a class without change

Page 11: Object-Oriented Design Patterns

Adapter PatternConvert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.

Page 12: Object-Oriented Design Patterns

You already use patterns If you use:

.Net Framework Iterator – GetEnumerator() Composite – List Strategy – IComparable Observer – Event Handlers Chain Of Responsibility – Event Handlers

WCF / Web Services Proxy – Web Methods

Page 13: Object-Oriented Design Patterns

Continued…

Test-Driven or Behavior-Driven Development Bridge – Mock Objects

Dependency Injection Factory – DI Container Bridge – Interface -> Implementation

MVC/MVP Mediator – Presenter/Controller Strategy – Presenter/Controller Composite – View Observer – Model

Page 14: Object-Oriented Design Patterns

For More Info

Reading Design Patterns: Elements of Reusable

Object-Oriented Software by Erich Gamma, et al.

Head First Design Patterns by Eric Freeman & Elisabeth Freeman

C# Design Patterns by James W. Cooper Links

http://www.dofactory.com/Patterns/Patterns.aspx

http://c2.com/cgi/wiki?GangOfFour

Page 15: Object-Oriented Design Patterns

Questions??