Design Patterns For 70% Of Programmers In The World
Upcoming SlideShare
Loading in...5
×
 

Design Patterns For 70% Of Programmers In The World

on

  • 29,744 views

This presentation is for everyone who wants to understand design patterns

This presentation is for everyone who wants to understand design patterns

For downloading the presentation, visit http://www.domaindrivendesign.info

Statistics

Views

Total Views
29,744
Views on SlideShare
29,140
Embed Views
604

Actions

Likes
91
Downloads
1,720
Comments
8

43 Embeds 604

http://blogs.msdn.com 159
http://www.domaindrivendesign.info 111
http://www.slideshare.net 71
http://betorbluff.blogspot.com 60
http://localhost 37
http://betorbluff.blogspot.in 27
http://ysaurabh.blogspot.in 22
http://betorbluff.blogspot.com.br 18
http://ysaurabh.blogspot.com 11
http://vermasaurabh.blogspot.com 10
http://sachinthamke.blogspot.com 9
http://www.betorbluff.com 6
http://betorbluff.blogspot.co.uk 6
http://cplusplus4u.blogspot.com 5
http://betorbluff.com 5
http://shuherus.blogspot.com 5
http://sachinthamke.blogspot.in 4
http://betorbluff.blogspot.com.au 3
http://static.slideshare.net 3
http://paper.li 3
http://betorbluff.blogspot.be 3
http://www.sachinthamke.blogspot.com 2
http://209.85.141.104 2
http://www.sachinthamke.blogspot.in 2
http://javainlarge.blogspot.com 2
http://betorbluff.blogspot.mx 1
http://betorbluff.blogspot.se 1
http://72.14.253.104 1
http://betorbluff.blogspot.de 1
http://betorbluff.blogspot.ro 1
http://betorbluff.blogspot.fr 1
http://popflycreator.com 1
http://ysaurabh.blogspot.com.au 1
http://static.slidesharecdn.com 1
http://blogs.gotdotnet.com 1
http://www.google.com 1
http://javainlarge.blogspot.in 1
http://webcache.googleusercontent.com 1
http://ysaurabh.blogspot.de 1
http://www.identy.org 1
http://fbweb-test.comoj.com 1
http://www.noderelay.com 1
http://betorbluff.blogspot.com.ar 1
More...

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Wow, slide 23 has lots of ugly if then branches
    Are you sure you want to
    Your message goes here
    Processing…
  • Thanks a lot to everyone; will soon be posting - project management for 70 percent programmers in the world
    Are you sure you want to
    Your message goes here
    Processing…
  • Please allow download
    Are you sure you want to
    Your message goes here
    Processing…
  • Good one..
    Are you sure you want to
    Your message goes here
    Processing…
  • I like it so much.Thanks a lot.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Design Patterns For 70% Of Programmers In The World Design Patterns For 70% Of Programmers In The World Presentation Transcript

  • Design Patterns for 70% of genious programmers Aamir Khan Solution Architect
  • Design Patterns for 70% of programmers in the world Saurabh Verma Solution Architect I blog at http://www.domaindrivendesign.info
  • Agenda
    • Do you OOPs?
    • Design Patterns? Why
    • Design Patterns? What
    • Design Patterns? How
    • I hate my job
  • Normal Classes vs Abstract Classes vs Interfaces Normal Class: This is a normal class  Abstract Class: These cannot be instantiated directly. They may provide partial implementations and exists solely for the purpose of inheritance. Interfaces: Defines a contract. Concrete implementations needs to implement each property and method as per contract. Shut up ! We know all this
  • Million Dollar Question? What is Why?
  • Normal Class vs Abstract Class? If a particular class is a entity which is not required to be instantiated by the application directly, go for Abstract Class Employee can be abstract class
  • Abstract Class vs Interfaces? If a particular class contains any default behavior, go for Abstract Class If every concrete class has its own implementation, go for Interfaces Work – Management, Programming
  • MOVIES & ACTORS Shahrukh Khan Salman Khan riding bike Actors in a Movie
  • IS-A vs HAS-A vs CAN-DO IS-A Inheritance Shahrukh Khan is an ACTOR HAS-A Composition Movie has ACTORS CAN-DO Interfaces Salman Khan can DRIVE BIKE IS-A Inheritance Shahrukh Khan is an ACTOR HAS-A Composition Movie has ACTORS CAN-DO Interfaces Salman Khan can DRIVE BIKE
  • What is a Pattern
    • An 'element of reusable software’
    • A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem in object-oriented systems.
    • It describes the problem, the solution, when to apply the solution, and its consequences.
    • It also gives implementation hints and examples. The solution is a general arrangement of objects and classes that solve the problem. The solution is customized and implemented to solve the problem in a particular context.
  • History of Software Patterns
  • What Wikipedia says,
    • A design pattern is a general repeatable solution to a commonly occurring problem in software design.
    • A design pattern is not a finished design that can be transformed directly into code.
    • Algorithms are not thought of as design patterns.
  • Let’s understand design patterns by purpose
  • Let’s understand the purpose + Creational Patterns Structural Patterns Final Product Behavioral Patterns
  • Let’s understand the purpose
  • Design Patterns as per their PURPOSE
  • Creational Patterns
  • Factory Method
  • Factory Method
    • Define an interface for creating an object, but let subclass decide which class to instantiate
    • Prevents creation of any additional instances, while simultaneously allowing global access
    • Creation can be delayed until it is actually required
  • Factory Method System.Data.SqlClient.SqlClientFactory
  • Abstract Factory Pattern
  • Abstract Factory Pattern
    • Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
    • Provides creation of families of related or dependent objects without specifying their concrete class
  • Abstract Factory Method System.Data.Common.DbProviderFactories
  • Singleton Pattern
  • Singleton Pattern
    • Ensure a class has only one instance, and provide a global point to it.
    • Prevents creation of any additional instances, while simultaneously allowing global access
    • Creation can be delayed until it is actually required
  • Singleton Pattern System.Data.SqlClient.SqlClientFactory
  • Structural Patterns
  • Façade Pattern
  • Façade Pattern
    • Provide a unified interface to set of interfaces in a subsystem.
    • Is generally one side of the exterior of a building, especially the front
    • Origin from a FRENCH word means “face” or “front”
  • Façade Pattern Its all about the service
  • Decorator Pattern
  • Decorator Pattern
    • Attach additional responsibilities to an object dynamically.
    • Flexible alternative to subclassing for extending functionality
    • Allows dynamic and transparent addition and removal of responsibilities without affecting object
    simple actress ( act ) in role of modern girl (go out and act ) in role of homely girl (be in home and act )
  • Decorator Pattern System.IO.BufferedStream:Stream
  • Composite Pattern
  • Composite Pattern
    • Compose objects into tree structures to represent part-whole hierarchies
    • When dealing with collections of objects, there are often operations that are appropriate for both a single object and the entire collection
    • Treats individual objects and composition of objects uniformly
    • Example:
    • Every object “IS-A” shape
    • Every shape “HAS-A” draw behavior
  • Composite Pattern System.Web.UI.Control (Render Mechanism)
  • Composite Pattern
  • Adapter Pattern
  • Adapter Pattern
    • Convert the interface of a class into another interface clients expect
    • Lets classes work together that couldn’t work otherwise
    • Works good for making compliance
    Application Framework Adapter Legacy Component
  • Adapter Pattern GearsTypelib.HtmlDialogHostClass (Interop.GearsTypelib)
  • Decorator vs Adapter Decorator looks like Adapter which “decorates” an existing class to make it compatible. Though, Decorator doesn’t wants you to decorate every method in the Adapted class. But who has stopped from doing it. “ Never underestimate the power of a developer”
  • Decorator vs Façade Façade is a way of hiding a complex system inside a simpler interface, whereas Decorator adds function by wrapping a class.
  • Behavioural Patterns
  • Command Pattern
  • Command Pattern
    • Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests.
    • If all commands can service a specific request, they can be entertained by the invoker
    • Concrete command performs the action on Receiver
    • Encapsulate method invocation
    One Receiver and Multiple actions
  • Command Pattern System.ComponentModel.Design.MenuCommand
  • Command Pattern Saurabh.Learning.DesignPatterns.Patterns.CommandPattern
  • Strategy Pattern
  • Strategy Pattern
    • Define strategies for a performing a behavior and change them dynamically as per requirement
    • This lets the algorithm vary independently from clients that uses it
    • It is about choice, which affects outcomes
  • Strategy Pattern System.Collections.ArrayList
  • Template Method
  • Template Method
    • Define the skeleton of an algorithm in an operations, deferring some steps to subclass
    • Main algorithm skeleton is defined in a base class and subclasses can then plug in their own details without affecting the algorithm itself
    • Uses Inheritance – Abstract Class defines the template (algorithm) and Concrete class manages the implementation.
    • Template uses the implementation on demand
  • Template Method
  • Strategy Pattern vs Template Method
    • Strategy allows callers to change the algorithm or order of steps whereas Template method allow steps to be modified
    • Strategy uses Interfaces whereas Template method uses Inheritance
  • I hate my job
  • Top 5 ADVICES NOT TO FOLLOW
  • Reflect when you want 
  • Answers, anybody?
  • CONTENT STOLEN FROM  BOOKS: Head First Design Patterns Design Patterns in C# Design Patterns WEBSITES: Wikipedia, MSDN, doFactory and GOOGLE
  • Learn it all, at my blog http://www.domaindrivendesign.info Don’t contact me at, saurabh.net [at] gmail.com Saurabh Verma Solution Architect