Your SlideShare is downloading. ×
Common design patterns (migang 16 May 2012)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Common design patterns (migang 16 May 2012)

2,874
views

Published on

A discussion of six common design patterns, when to use them, how they are implemented, and when to avoid them.

A discussion of six common design patterns, when to use them, how they are implemented, and when to avoid them.


0 Comments
10 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,874
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
80
Comments
0
Likes
10
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • 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
  • 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.
  • 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.
  • It’s possible for the new Singleton(); line to be called more than once.
  • http://en.wikipedia.org/wiki/File:Proxy_concept_en.svg
  • Apply patterns via refactoring,Not Big Design Up Front
  • Transcript

    • 1. Common Design Patterns Steve Smith @ardalis | ardalis.com Telerikhttp://flic.kr/p/4MEeVn
    • 2. http://flic.kr/p/8XgqKu
    • 3. http://flic.kr/p/6StgW5
    • 4. http://flic.kr/p/6UpMt9
    • 5. http://geekandpoke.typepad.com/geekandpoke/2011/04/design-patterns-are-still-useful.html
    • 6. Actual Usage http://twtpoll.com/r/t7jzrx
    • 7. (Of course there are many others!)
    • 8. 
    • 9. 
    • 10. Source: http://csharpindepth.com/Articles/General/Singleton.aspx
    • 11.    Shameless Plug: But why would you  Telerik JustMock can be intentionally write code usedcan mocktest with you to only and test certainSingletons tools? premium 
    • 12. http://flic.kr/p/6spkwo
    • 13.    
    • 14. 
    • 15.   
    • 16. “new” creates tight coupling between classeshttp://flic.kr/p/aN4Zv
    • 17.      
    • 18. Compile Time Runtime User Interface     Database
    • 19. Compile Time Runtime User Interface Helper Class Database
    • 20. Compile Time Runtime User Interface Core Infrastructure IFooRepository SqlFooRepository   Database
    • 21.     
    • 22.    
    • 23. 
    • 24. http://flic.kr/p/5Yb5i
    • 25.    
    • 26.  Pending Archived Published
    • 27. http://flic.kr/p/vGpC2
    • 28.      
    • 29. 
    • 30. Design Patterns in ActionCODE
    • 31.  
    • 32. 