Design Patterns - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Design Patterns

Description:

Design Patterns & Testability. Principles for developing high quality software. 26 ... Jeremy D. Miller. http://codebetter.com/blogs/jeremy.miller/default.aspx ... – PowerPoint PPT presentation

Number of Views:249
Avg rating:3.0/5.0
Slides: 19
Provided by: dennis116
Category:

less

Transcript and Presenter's Notes

Title: Design Patterns


1
Design Patterns Testability
  • Principles for developing high quality software
  • 26 maart 2009
  • Dennis Doomen

2
About Me
26 maart 2009
Dennis Doomen
3
Contents
  • 1830 2100
  • The boring stuff
  • The fun stuff
  • The future
  • 1930 1945
  • Break

4
Goal
  • Michael Feathers
  • I don't care how good you think your design is.
    If I can't walk in and write a test for an
    arbitrary method of yours in five minutes its not
    as good as you think it is, and whether you know
    it or not, you're paying a price for it.

26 maart 2009
Dennis Doomen
5
How?
  • Use coding guidelines
  • Apply common design principles
  • Use Design Patterns
  • Socialize system design architecture
  • Test Driven Development
  • Refactoring

26 maart 2009
Dennis Doomen
6
Coding Practices
  • Avoid
  • God classes
  • Long methods
  • Overengineering
  • Micromanaging performance
  • Duplication
  • Bad or misleading variable names
  • Use
  • Coding Guidelines

7
Design Principles
  • Single Responsibility Principle
  • Decrease Coupling, Increase Cohesion
  • Open Closed Principle (open for extension, closed
    for modification)
  • Liskov Substitution Pattern
  • The Law Of Demeter
  • Last Responsible Moment a.k.a. Reversability
  • YAGNI
  • Query Command Separation
  • Tell, Don't Ask

26 maart 2009
Dennis Doomen
8
Design Patterns
  • solve common problems
  • help communicate your choices
  • improve object-oriented design

9
Design Patterns
  • Design Patterns Elements of Reusable
    Object-Oriented Software
  • Eric Gamma, Richard Helm, Ralph Johnson, John
    Vlissides

10
Design Patterns
  • Patterns of Enterprise Application Architecture
  • Martin Fowler

11
Design Patterns
  • Applying Domain-Driven Design and Patterns
  • Jimmy Nilsson

12
Test Driven Design
  • is a design process, not a testing process
  • Unit tests are the first users of your API
  • Unit tests provide documentation
  • If TDD hurts, youre doing it wrong
  • Red-Green-Refactor

26 maart 2009
Dennis Doomen
13
Test Principles
  • Test should be
  • Repeatable
  • Easy to write
  • Easy to understand
  • Intention revealing
  • Fast
  • State-based versus interaction-based testing
  • Mocking
  • Don't mock chatty interfaces (e.g. pass
    ScreenState to View)
  • Don't have more than 2-3 mocks per test
  • Only mock your nearest neighbors
  • Test small before testing big
  • Test what you know now (and assemble the rest
    from those pieces)

26 maart 2009
Dennis Doomen
14
Test Principles
  • Keep your tail short
  • Isolate the ugly stuff
  • Keep out of the debugger jail
  • Push, don't pull

26 maart 2009
Dennis Doomen
15
Test Patterns
  • xUnit Test Patterns, Refactoring Test Code
  • Gerard Meszaros

16
Demo
  • 26 maart 2009
  • Dennis Doomen

17
Whats Next?
  • Domain Driven Design
  • Behavior Driven Design

26 maart 2009
Dennis Doomen
18
Resources
  • Jeremy D. Millerhttp//codebetter.com/blogs/jerem
    y.miller/default.aspxhttp//msdn.microsoft.com/en
    -us/magazine/cc720886.aspx
  • C 3.0 Coding Guidelineshttp//blog.avivasolution
    s.nl/archive/2009/03/06/new-coding-guidelines-for-
    c-3-0.aspx
  • Behavior Driven Design (Scott Belware)http//www.
    code-magazine.com/article.aspx?quickid0805061

26 maart 2009
Dennis Doomen
Write a Comment
User Comments (0)
About PowerShow.com