Шаблоны проектирования ООП. Принципы ООП Инкапсуляция Наследование Полиморфизм Абстракция данных.

Slides:



Advertisements
Similar presentations
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Creational Patterns - Page L4-1 PS95&96-MEF-L11-1 Dr. M.E. Fayad Creationa l Paradigm.
Advertisements

T O K ILL A S INGLETON F ACTORY M ETHOD P ATTERN Josh Mason 6/18/09.
Design Patterns CS 406 Software Engineering I Fall 2001 Aditya P. Mathur Purdue University October 30, 2001.
Chapter 8, Object Design: Design Patterns II Using UML, Patterns, and Java Object-Oriented Software Engineering.
Factory Pattern Building Complex Objects. New is an implementation  Calling “new” is certainly coding to an implementation  In fact, it’s always related.
Plab – Tirgul 12 Design Patterns
. Plab – Tirgul 12 Design Patterns. Design Patterns u The De-Facto Book on Design Patterns:
Design Patterns A brief introduction to what they are, why they are useful, and some examples of those that are commonly used.
CS CS 5150 Software Engineering Lecture 17 Object Oriented Design 3.
5/08 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.
Nov, 1, Design Patterns PROBLEM CONTEXT SOLUTION A design pattern documents a proven solution to a recurring problem in a specific context and its.
© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.1 Roadmap  Generics  Abstract Factory  Annotations  Model-Driven Engineering.
1 CS 501 Spring 2008 CS 501: Software Engineering Lectures 17 & 18 Object Oriented Design 3 & 4.
Oct, 16, Design Patterns PROBLEM CONTEXT SOLUTION A design pattern documents a proven solution to a recurring problem in a specific context and.
1 Creational Patterns CS : Software Design Winter /T8.
CS CS 5150 Software Engineering Lecture 16 Object Oriented Design 2.
Creational Patterns: The Abstract Factory CSE 335 Spring 2008 E. Kraemer.
CS CS 5150 Software Engineering Lecture 16 Object Oriented Design 2.
1 CS 501 Spring 2007 CS 501: Software Engineering Lectures 17 & 18 Object Oriented Design 3 & 4.
© SERG Software Design (OOD Patterns) Object-Oriented Design Patterns Topics in Object-Oriented Design Patterns Compliments of Spiros Mancoridis Material.
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University The Abstract Factory Pattern.
Builder A Creational Design Pattern A Presentation by Alex Bluhm And.
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 8, Object Design: Reuse and Patterns III.
1 ECE 355: Software Engineering CHAPTER 8 Instructor Kostas Kontogiannis.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 8, Object Design: Reuse and Patterns III.
Abstract Factory Design Pattern making abstract things.
Software Components Creational Patterns.
Abstract Factory Abstract Factory using Factory Method.
Proxy Pattern: Motivation
By James Sheets. An object creational pattern. Separates the construction of a complex object from its representation so that the same construction process.
CS 210 Review Session October 5 th, Head First Design Patterns Chapter 4 Factory Pattern.
CDP-1 9. Creational Pattern. CDP-2 Creational Patterns Abstracts instantiation process Makes system independent of how its objects are –created –composed.
Design Pattern Dr. Zhen Jiang West Chester University url:
Design Patterns -- Omkar. Introduction  When do we use design patterns  Uses of design patterns  Classification of design patterns  Creational design.
Creational Patterns
Define an interface for creating an object, but let subclasses decide which class to instantiate.
Creational Pattern: Factory Method At times, a framework is needed to standardize the behavior of objects that are used in a range of applications, while.
Builder An Object Creational Pattern Tim Rice CSPP51023 March 2, 2010.
ANU COMP2110 Software Design in 2004 Lecture 17Slide 1 COMP2110 in 2004 Software Design Lecture 17: Software design patterns (4) 1The Abstract Factory.
Creational Design Patterns Yaodong Bi December 21, 2015December 21, 2015December 21, 2015.
Introduction to Patterns. Introduction to Patterns Pattern: Webster definition of Pattern: Something regarded as a normative example to be copied.
24-Feb-2005 Ruben Leivas Ledo - iCSC 1 Design Patterns Ruben Leivas Ledo Internet Services Group CERN – Geneva (CH)
The Factory Method Pattern (Creational) ©SoftMoore ConsultingSlide 1.
Advanced Object-oriented Design Patterns Creational Design Patterns.
Singleton Pattern Presented By:- Navaneet Kumar ise
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
Reference – Object Oriented Software Development Using Java - Jia COP 3331 Object Oriented Analysis and Design Chapter 10 – Patterns Jean Muhammad.
The Abstract Factory Pattern (Creational) ©SoftMoore ConsultingSlide 1.
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
Abstract Factory Pattern Jiaxin Wang CSPP Winter 2010.
Abstract Factory pattern Intent Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Overview of Design Patterns
Design Patterns A brief introduction to what they are, why they are useful, and some examples of those that are commonly used.
Chapter 8, Object Design: Reuse and Patterns III
Prof. Chen, Kung (Creational) Design Patterns May 12, 2014
Design Pattern Catalogues
Factory Patterns 1.
How to be a Good Developer
Creational Design Patterns
JAVA Design Patterns.
What is a Design Pattern
Object-Oriented Design Patterns
ABSTRACT FACTORY.
Design Patterns - A few examples
Software Engineering Lecture 7 - Design Patterns
Design Patterns Outline
Ms Munawar Khatoon IV Year I Sem Computer Science Engineering
Creational Patterns.
Presentation transcript:

Шаблоны проектирования ООП

Принципы ООП Инкапсуляция Наследование Полиморфизм Абстракция данных

Паттерны Основные шаблоны (Fundamental) Порождающие шаблоны проектирования (Creational) Структурные шаблоны (Structural) Поведенческие шаблоны (Behavioral) Шаблоны параллельного программирования (Concurrency) MVC Enterprise И тд.

Основные шаблоны (Fundamental) Delegation pattern/Шаблон делегирования Functional design/Шаблон функционального дизайна Immutable/Неизменяемый объект Interface Property Container

Порождающие шаблоны проектирования (Creational) Abstract Factory Builder Factory Method Lazy initialization Multiton Object Pool Prototype Resource acquisition is initialization (RAII) Singleton

Abstract Factory abstract class AbstractFactory { public abstract AbstractProductA CreateProductA(); public abstract AbstractProductB CreateProductB(); } class ConcreteFactory1 : AbstractFactory { public override AbstractProductA CreateProductA() { return new ProductA1(); } public override AbstractProductB CreateProductB() { return new ProductB1(); } abstract class AbstractProductB { public abstract void Interact(AbstractProductA a); } class Client { private AbstractProductA abstractProductA; private AbstractProductB abstractProductB; public Client(AbstractFactory factory) { abstractProductB = factory.CreateProductB(); abstractProductA = factory.CreateProductA(); } public void Run() { abstractProductB.Interact(abstractProductA); } public static void Main() { AbstractFactory factory1 = new ConcreteFactory1(); Client c1 = new Client(factory1); c1.Run(); }

Abstract Factory

Factory Method using System; class MainApp { static void Main() { Creator[] creators = new Creator[2]; creators[0] = new ConcreteCreatorA(); creators[1] = new ConcreteCreatorB(); foreach(Creator creator in creators) { Product product = creator.FactoryMethod(); Console.WriteLine("Created {0}", product.GetType().Name); } // Wait for user Console.Read(); } abstract class Product{ } class ConcreteProductA : Product { } class ConcreteProductB : Product { } abstract class Creator { public abstract Product FactoryMethod(); } class ConcreteCreatorA : Creator { public override Product FactoryMethod() { return new ConcreteProductA(); } class ConcreteCreatorB : Creator { public override Product FactoryMethod() { return new ConcreteProductB(); }

Factory Method

Builder abstract class Builder { public abstract void BuildPartA(); public abstract void BuildPartB(); public abstract Product GetResult(); } class ConcreteBuilder1 : Builder { private readonly Product product = new Product(); public override void BuildPartA() { product.Add("PartA"); } public override void BuildPartB() { product.Add("PartB"); } public override Product GetResult() { return product; } }

Builder