SlideShare a Scribd company logo
Common Design Patterns



       Steve Smith
       @ardalis | ardalis.com
       Telerik
http://flic.kr/p/4MEeVn
http://flic.kr/p/8XgqKu
http://flic.kr/p/6StgW5
http://flic.kr/p/6UpMt9
http://geekandpoke.typepad.com/geekandpoke/2011/04/design-patterns-are-still-useful.html
Actual Usage   http://twtpoll.com/r/t7jzrx
(Of course there are many others!)
Common design patterns (migang 16 May 2012)







Common design patterns (migang 16 May 2012)









Source: http://csharpindepth.com/Articles/General/Singleton.aspx

    
    




           Shameless Plug:
           But why would you
    
        Telerik JustMock can be
        intentionally write code
         usedcan mocktest with
         you to only and test
        certainSingletons tools?
                 premium

    



http://flic.kr/p/6spkwo







    
    
    
Common design patterns (migang 16 May 2012)












    






    
“new” creates tight coupling
                         between classes




http://flic.kr/p/aN4Zv





    
    
    



    
    
Compile Time

          Runtime


        User Interface

    
    



    
    
          Database
Compile Time

        Runtime


    User Interface





     Helper Class





      Database
Compile Time

                                Runtime

                   User Interface



           Core              Infrastructure
        IFooRepository      SqlFooRepository

    

    
                     Database
Common design patterns (migang 16 May 2012)
Common design patterns (migang 16 May 2012)
Common design patterns (migang 16 May 2012)

    
    



    



    
Common design patterns (migang 16 May 2012)







    
    
    
Common design patterns (migang 16 May 2012)







Common design patterns (migang 16 May 2012)
http://flic.kr/p/5Yb5i








    
    
    
Common design patterns (migang 16 May 2012)




               Pending




    Archived             Published
http://flic.kr/p/vGpC2



    



    



    
    
    





Design Patterns in Action

CODE











    











More Related Content

Viewers also liked (20)

PPTX
Breaking Dependencies to Allow Unit Testing
Steven Smith
 
PPTX
Improving the Quality of Existing Software - DevIntersection April 2016
Steven Smith
 
PPTX
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Steven Smith
 
PPTX
Improving the Quality of Existing Software
Steven Smith
 
PPTX
Common asp.net design patterns aspconf2012
Steven Smith
 
PPTX
Domain events
Steven Smith
 
PPTX
Common ASP.NET Design Patterns - Telerik India DevCon 2013
Steven Smith
 
PPTX
My Iraq Experience
Steven Smith
 
PPTX
Improving the Quality of Existing Software
Steven Smith
 
PPTX
Decoupling with Domain Events
Steven Smith
 
PPTX
Refactoring with SOLID - Telerik India DevCon 2013
Steven Smith
 
PDF
Introducing Pair Programming
Steven Smith
 
PPTX
Advanced Object-Oriented/SOLID Principles
Jon Kruger
 
PPTX
Refactoring Applications using SOLID Principles
Steven Smith
 
PDF
Add Some DDD to Your ASP.NET MVC, OK?
Steven Smith
 
PPTX
S.O.L.I.D. Principles for Software Architects
Ricardo Wilkins
 
PPT
SOLID Design Principles
Andreas Enbohm
 
PPTX
The SOLID Principles Illustrated by Design Patterns
Hayim Makabee
 
PDF
Domain-Driven Design with ASP.NET MVC
Steven Smith
 
PDF
SOLID Principles and Design Patterns
Ganesh Samarthyam
 
Breaking Dependencies to Allow Unit Testing
Steven Smith
 
Improving the Quality of Existing Software - DevIntersection April 2016
Steven Smith
 
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Steven Smith
 
Improving the Quality of Existing Software
Steven Smith
 
Common asp.net design patterns aspconf2012
Steven Smith
 
Domain events
Steven Smith
 
Common ASP.NET Design Patterns - Telerik India DevCon 2013
Steven Smith
 
My Iraq Experience
Steven Smith
 
Improving the Quality of Existing Software
Steven Smith
 
Decoupling with Domain Events
Steven Smith
 
Refactoring with SOLID - Telerik India DevCon 2013
Steven Smith
 
Introducing Pair Programming
Steven Smith
 
Advanced Object-Oriented/SOLID Principles
Jon Kruger
 
Refactoring Applications using SOLID Principles
Steven Smith
 
Add Some DDD to Your ASP.NET MVC, OK?
Steven Smith
 
S.O.L.I.D. Principles for Software Architects
Ricardo Wilkins
 
SOLID Design Principles
Andreas Enbohm
 
The SOLID Principles Illustrated by Design Patterns
Hayim Makabee
 
Domain-Driven Design with ASP.NET MVC
Steven Smith
 
SOLID Principles and Design Patterns
Ganesh Samarthyam
 

Similar to Common design patterns (migang 16 May 2012) (20)

PPTX
Architecture and design
himanshu_airon
 
PPT
5 Design Patterns Explained
Prabhjit Singh
 
PPTX
Day5
madamewoolf
 
PPTX
Sofwear deasign and need of design pattern
chetankane
 
PPTX
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Steven Smith
 
PPTX
Gof design patterns
Srikanth R Vaka
 
PDF
Software Patterns
Artem Tabalin
 
PPTX
Day1
madamewoolf
 
PPT
Designingapplswithnet
DSK Chakravarthy
 
PPTX
Sda 9
AmberMughal5
 
PPTX
Women Who Code Belfast: Introduction to Design patterns
Jackie Pollock
 
PPT
Design pattern
Mallikarjuna G D
 
PPTX
PATTERNS02 - Creational Design Patterns
Michael Heron
 
DOCX
Mastering the Craft: Types of Patterns in C#
StudySection
 
PPTX
Sda 8
AmberMughal5
 
PPTX
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Luis Valencia
 
PPT
Software Design Patterns
Satheesh Sukumaran
 
PPT
Software Design Patterns
Satheesh Sukumaran
 
PPTX
Design pattern of software words computer .pptx
muslimpari2503
 
PPTX
OOPSDesign PPT ( introduction to opps and design (
bhfcvh531
 
Architecture and design
himanshu_airon
 
5 Design Patterns Explained
Prabhjit Singh
 
Sofwear deasign and need of design pattern
chetankane
 
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Steven Smith
 
Gof design patterns
Srikanth R Vaka
 
Software Patterns
Artem Tabalin
 
Designingapplswithnet
DSK Chakravarthy
 
Women Who Code Belfast: Introduction to Design patterns
Jackie Pollock
 
Design pattern
Mallikarjuna G D
 
PATTERNS02 - Creational Design Patterns
Michael Heron
 
Mastering the Craft: Types of Patterns in C#
StudySection
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Luis Valencia
 
Software Design Patterns
Satheesh Sukumaran
 
Software Design Patterns
Satheesh Sukumaran
 
Design pattern of software words computer .pptx
muslimpari2503
 
OOPSDesign PPT ( introduction to opps and design (
bhfcvh531
 
Ad

More from Steven Smith (7)

PPTX
Clean architecture with asp.net core by Ardalis
Steven Smith
 
PDF
Finding Patterns in the Clouds - Cloud Design Patterns
Steven Smith
 
PPTX
Introducing domain driven design - dogfood con 2018
Steven Smith
 
PPTX
Introducing Domain Driven Design - codemash
Steven Smith
 
PPTX
Most Useful Design Patterns
Steven Smith
 
PPTX
Improving the Design of Existing Software
Steven Smith
 
PPTX
Introducing ASP.NET Core 2.0
Steven Smith
 
Clean architecture with asp.net core by Ardalis
Steven Smith
 
Finding Patterns in the Clouds - Cloud Design Patterns
Steven Smith
 
Introducing domain driven design - dogfood con 2018
Steven Smith
 
Introducing Domain Driven Design - codemash
Steven Smith
 
Most Useful Design Patterns
Steven Smith
 
Improving the Design of Existing Software
Steven Smith
 
Introducing ASP.NET Core 2.0
Steven Smith
 
Ad

Recently uploaded (20)

PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 

Common design patterns (migang 16 May 2012)

Editor's Notes

  • #3: General, reusable solutions to common problemsNot a complete, finished solutionA template, recipe, or approach to solving certain problemsEach has a specific name, so we can discuss common elements of design using a common vocabulary
  • #4: Learning anything – a musical chord, a martial arts technique, etc.Zero: You used a what? Never heard of it.Awakening:Wow, I just learned how XYZ pattern can improve my design. I’m not really sure where it would work in my code, but I’m definitely looking.Overzealous:I totally “get” the XYZ pattern; I’m adding it everywhere I can shoehorn it into my code. My design’s gonna be better now, for sure!Mastery: In response to some specific design pain points, the XYZ pattern was a logical next step and was achieved through a simple refactoring.
  • #5: Design pattern names provide placeholders or complex abstractions and sets of refactorings. Consider the difference between:We have some tight coupling to the database here. We can probably fix it if we apply these refactorings;extract an interface, extract a method, Extract a class,Replace local with parameterORLet’s apply the Repository pattern to fix it.
  • #11: It’s possible for the new Singleton(); line to be called more than once.
  • #29: http://en.wikipedia.org/wiki/File:Proxy_concept_en.svg
  • #40: Apply patterns via refactoring,Not Big Design Up Front