Your SlideShare is downloading. ×
0
Design Patterns   The core of Software architecture Creational Patterns- Part-1 By: Shahzad Sarwar
Agenda  - Future Architecture Tracks <ul><li>This is series of presentations covering Design patterns </li></ul><ul><li>Cr...
Agenda  - Future Architecture Tracks <ul><li>AJAX Design Patterns Part-4 (Later) </li></ul><ul><li>AJAX Level I  ,  AJAX L...
Design Pattern <ul><li>In software engineering, a  design pattern  is a general repeatable solution to a commonly occurrin...
Design Principles <ul><li>Robert Martin &quot;Agile Software Development: Principles, Patterns, and Practices“ </li></ul><...
Software Design Principles  <ul><li>Open Close Principle  </li></ul><ul><ul><li>Software entities like classes, modules an...
Software Design Principles <ul><li>Interface Segregation Principle  </li></ul><ul><ul><li>A class should have only one rea...
Singleton( Creational Patterns )  <ul><li>Ensure a class has only one instance and provide a global point of access to it....
Abstract Factory Design ( Creational Patterns )  <ul><li>Provide an interface for creating families of related or dependen...
Participants  <ul><li>The classes and/or objects participating in this pattern are:  </li></ul><ul><li>AbstractFactory    ...
Factory Method( Creational Patterns )  <ul><li>Define an interface for creating an object, but let subclasses decide which...
Participants  <ul><li>The classes and/or objects participating in this pattern are:  </li></ul><ul><li>Product    (Page)  ...
Prototype( Creational Patterns )  <ul><li>Specify the kind of objects to create using a prototypical instance, and create ...
Participants <ul><li>     The classes and/or objects participating in this pattern are:  </li></ul><ul><li>Prototype    (C...
Builder <ul><li>    Separate the construction of a complex object from its representation so that the same construction pr...
Participants <ul><li>The classes and/or objects participating in this pattern are:  </li></ul><ul><li>Builder    (VehicleB...
Criticism on Design Patterns  <ul><li>Targets the wrong problem  </li></ul><ul><li>Lacks formal foundations  </li></ul><ul...
Reference: <ul><li>www.dofactory.com   </li></ul><ul><li>www.oodesign.com </li></ul><ul><li>http://wiki.asp.net/page.aspx/...
Further Discussion <ul><li>A soft copy will be available at: </li></ul><ul><li>http:// softarchitect.wordpress.com </li></...
Upcoming SlideShare
Loading in...5
×

Design Pattern For C# Part 1

6,062

Published on

This is series of presentations covering Design patterns

<strong>Creational Patterns Part -1</strong> Abstract Factory , Builder , Factory Method , Prototype , Singleton
<strong>Structural Patterns Part-2 ( Later ) </strong> Adapter , Bridge , Composite , Decorator , Facade , Flyweight , Proxy
<strong>Behavioral Patterns Part-3 ( Later )</strong>
Chain of Resp , Command , Interpreter , Iterator
,Mediator , Memento , Observer , State , Strategy ,
Template Method , Visitor

<strong>AJAX Design Patterns Part-4 (Later)</strong>
AJAX Level I , AJAX Level II
AJAX Message Patterns
(Text Message , HTML Message , XML Message , XSL Message , JavaScript Msg , JSON Message , Custom Message )

<strong>Software AntiPatterns Part-5 (Later)</strong>

<strong>Software Refactoring Part-6 (Later)</strong>

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,062
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
407
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Design Pattern For C# Part 1"

  1. 1. Design Patterns The core of Software architecture Creational Patterns- Part-1 By: Shahzad Sarwar
  2. 2. Agenda - Future Architecture Tracks <ul><li>This is series of presentations covering Design patterns </li></ul><ul><li>Creational Patterns Part -1 </li></ul><ul><li>Abstract Factory  ,  Builder   ,  Factory Method   ,  Prototype   ,  Singleton </li></ul><ul><li>Structural Patterns Part-2 ( Later ) Adapter  ,   Bridge  ,  Composite  ,  Decorator  ,  Facade  ,  Flyweight   ,  Proxy </li></ul><ul><li>Behavioral Patterns Part-3 ( Later ) </li></ul><ul><li>Chain of Resp   ,  Command   ,  Interpreter  ,  Iterator   </li></ul><ul><li>  , Mediator  ,  Memento  ,  Observer  ,  State  ,  Strategy  ,  </li></ul><ul><li>Template Method  ,  Visitor </li></ul>
  3. 3. Agenda - Future Architecture Tracks <ul><li>AJAX Design Patterns Part-4 (Later) </li></ul><ul><li>AJAX Level I  ,  AJAX Level II </li></ul><ul><ul><li>AJAX Message Patterns </li></ul></ul><ul><ul><li>( Text Message  ,   HTML Message  ,  XML Message  ,   XSL Message   ,  JavaScript Msg  ,   JSON Message  ,  Custom Message   ) </li></ul></ul><ul><li>Software AntiPatterns Part-5 (Later) </li></ul><ul><li>Software Refactoring Part-6 (Later) </li></ul>
  4. 4. Design Pattern <ul><li>In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. </li></ul><ul><li>Types of Design Patterns: </li></ul><ul><li>Creational design patterns </li></ul><ul><li>Structural design patterns </li></ul><ul><li>Behavioral design patterns </li></ul>
  5. 5. Design Principles <ul><li>Robert Martin &quot;Agile Software Development: Principles, Patterns, and Practices“ </li></ul><ul><li>Characteristics of a bad design: </li></ul><ul><ul><li>Rigidity - It is hard to change because every change affects too many other parts of the system. </li></ul></ul><ul><ul><li>Fragility - When you make a change, unexpected parts of the system break. </li></ul></ul><ul><ul><li>Immobility - It is hard to reuse in another application because it cannot be disentangled from the current application. </li></ul></ul>
  6. 6. Software Design Principles <ul><li>Open Close Principle </li></ul><ul><ul><li>Software entities like classes, modules and functions should be open for extension but closed for modifications. </li></ul></ul><ul><li>Dependency Inversion Principle </li></ul><ul><ul><li>High-level modules should not depend on low-level modules. Both should depend on abstractions. </li></ul></ul><ul><ul><li>Abstractions should not depend on details. Details should depend on abstractions. </li></ul></ul>
  7. 7. Software Design Principles <ul><li>Interface Segregation Principle </li></ul><ul><ul><li>A class should have only one reason to change. </li></ul></ul><ul><ul><li>Tom DeMarco, His book Structured Analysis and Systems Specification, 1979. </li></ul></ul><ul><ul><li>Robert Martin reinterpreted the concept and defined the responsibility as a reason to change. </li></ul></ul>
  8. 8. Singleton( Creational Patterns ) <ul><li>Ensure a class has only one instance and provide a global point of access to it. </li></ul><ul><li>Participants </li></ul><ul><li>Examples </li></ul><ul><li>Singleton    (LoadBalancer) </li></ul><ul><ul><li>defines an Instance operation that lets clients access its unique instance. Instance is a class operation. </li></ul></ul><ul><ul><li>responsible for creating and maintaining its own unique instance. </li></ul></ul>
  9. 9. Abstract Factory Design ( Creational Patterns ) <ul><li>Provide an interface for creating families of related or dependent objects without specifying their concrete classes. </li></ul>
  10. 10. Participants <ul><li>The classes and/or objects participating in this pattern are: </li></ul><ul><li>AbstractFactory    (ContinentFactory) </li></ul><ul><ul><li>declares an interface for operations that create abstract products </li></ul></ul><ul><li>ConcreteFactory    (AfricaFactory, AmericaFactory) </li></ul><ul><ul><li>implements the operations to create concrete product objects </li></ul></ul><ul><li>AbstractProduct    (Herbivore, Carnivore) </li></ul><ul><ul><li>declares an interface for a type of product object </li></ul></ul><ul><li>Product    (Wildebeest, Lion, Bison, Wolf) </li></ul><ul><ul><li>defines a product object to be created by the corresponding concrete factory </li></ul></ul><ul><ul><li>implements the AbstractProduct interface </li></ul></ul><ul><li>Client    (AnimalWorld) </li></ul><ul><ul><li>uses interfaces declared by AbstractFactory and AbstractProduct classes </li></ul></ul><ul><li>Examples </li></ul>
  11. 11. Factory Method( Creational Patterns ) <ul><li>Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. </li></ul>
  12. 12. Participants <ul><li>The classes and/or objects participating in this pattern are: </li></ul><ul><li>Product    (Page) </li></ul><ul><ul><li>defines the interface of objects the factory method creates </li></ul></ul><ul><li>ConcreteProduct    (SkillsPage, EducationPage, ExperiencePage) </li></ul><ul><ul><li>implements the Product interface </li></ul></ul><ul><li>Creator    (Document) </li></ul><ul><ul><li>declares the factory method, which returns an object of type Product. Creator may also define a default implementation of the factory method that returns a default ConcreteProduct object. </li></ul></ul><ul><ul><li>may call the factory method to create a Product object. </li></ul></ul><ul><li>ConcreteCreator    (Report, Resume) </li></ul><ul><ul><li>overrides the factory method to return an instance of a ConcreteProduct. </li></ul></ul><ul><li>Examples </li></ul>
  13. 13. Prototype( Creational Patterns ) <ul><li>Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype. </li></ul>
  14. 14. Participants <ul><li>     The classes and/or objects participating in this pattern are: </li></ul><ul><li>Prototype    (ColorPrototype) </li></ul><ul><ul><li>declares an interface for cloning itself </li></ul></ul><ul><li>ConcretePrototype    (Color) </li></ul><ul><ul><li>implements an operation for cloning itself </li></ul></ul><ul><li>Client    (ColorManager) </li></ul><ul><ul><li>creates a new object by asking a prototype to clone itself </li></ul></ul><ul><li>Examples </li></ul>
  15. 15. Builder <ul><li>    Separate the construction of a complex object from its representation so that the same construction process can create different representations. </li></ul>
  16. 16. Participants <ul><li>The classes and/or objects participating in this pattern are: </li></ul><ul><li>Builder    (VehicleBuilder) </li></ul><ul><ul><li>specifies an abstract interface for creating parts of a Product object </li></ul></ul><ul><li>ConcreteBuilder    (MotorCycleBuilder, CarBuilder, ScooterBuilder) </li></ul><ul><ul><li>constructs and assembles parts of the product by implementing the Builder interface </li></ul></ul><ul><ul><li>defines and keeps track of the representation it creates </li></ul></ul><ul><ul><li>provides an interface for retrieving the product </li></ul></ul><ul><li>Director    (Shop) </li></ul><ul><ul><li>constructs an object using the Builder interface </li></ul></ul><ul><li>Product    (Vehicle) </li></ul><ul><ul><li>represents the complex object under construction. ConcreteBuilder builds the product's internal representation and defines the process by which it's assembled </li></ul></ul><ul><ul><li>includes classes that define the constituent parts, including interfaces for assembling the parts into the final result </li></ul></ul><ul><li>Examples </li></ul>
  17. 17. Criticism on Design Patterns <ul><li>Targets the wrong problem </li></ul><ul><li>Lacks formal foundations </li></ul><ul><li>Leads to inefficient solutions </li></ul><ul><li>Does not differ significantly from other abstractions </li></ul>
  18. 18. Reference: <ul><li>www.dofactory.com </li></ul><ul><li>www.oodesign.com </li></ul><ul><li>http://wiki.asp.net/page.aspx/276/design-patterns/ </li></ul><ul><li>http://sourcemaking.com/design_patterns </li></ul>
  19. 19. Further Discussion <ul><li>A soft copy will be available at: </li></ul><ul><li>http:// softarchitect.wordpress.com </li></ul><ul><li>For Future discussion, join </li></ul><ul><li>http:// tech.groups.yahoo.com/group/SoftArchitect / </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×