[Study Note] Design and Testability 20100423

[Jeremy’s Third Law of TDD: Test Small Before Testing Big]

Test Driven Development is an important and valueable tool to achieve rapid feedback cycles, but only if write and test software in small pieces.

  • Coding in an efficient manner, and sustaining that efficiency over time
  • Enabling continuous and adaptive design techniques
  • Designing an application that is resilient in the face of change
  • Faster removal of defects from code
  • Making an application easier and quicker to test

Case Study #1 Code from the Bottom Up

Purposely Designing with Test Driven Development

TDD is designing while coding.

class stereotypes

  1. Service providers – classes that perform a specific operations
  2. Information Holders – classes that have, or provide, data to other classes
  3. Coordinators – classes that coordinate the activities of other classes
  4. Controllers – classes that control the application flow

The key of doing emergent design is to focus on creating the service provider and information holder classes first that perform small tasks. After these classes are built and tested the construction of the coordinator and controller classes often turns into a simple game of “connect the dots”. Get the business logic and the workflow decisions complete first. Push off tasks like configuration and even data acccess closer to the end. Let the needs of business logic and workflow dictate the interface and design of ancillary services.

Drive design from the behavior of the business objects and then work forward to the service point and backwards to the data store.

posted on 2010-04-24 00:58  zhaorui  阅读(150)  评论(0编辑  收藏  举报

导航