Women in Technology

Hear us Roar

  Agile User Interface Development
Subject:   smart object/thin view model
Date:   2004-11-18 09:00:43
From:   PaulHamill
This article suggests using a smart object/thin view model for development of GUI objects. It is consistent with MVC, because there is a model and a view, but has an important difference: the view does not contain any business logic or complex functionality that requires unit testing. This way, you only need to do TDD on the model. There is no need to jump through extra hoops (or use GUI testing tools) to test the generic GUI code in the view class.

For a similar perspective, see Michael Feather's well-known article
The Humble Dialog Box

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • smart object/thin view model
    2004-11-19 04:35:32  AndyP [View]

    How do you test that you view code contains no business logic? Surely TDD says you can't trust any code you aren't testing?
    • smart object/thin view model
      2004-11-29 06:52:41  ipreuss [View]

      You can't test that "view code contains no business logic". But you certainly can be quite sure that it doesn't contain business logic without having to write tests.

      And no, TDD doesn't say "you can't trust any code your aren't testing". Actually it explicitely says to not test code that "cannot possibly break", i.e. simple getters or setters.

      Last but not least, TDD is a tool, not a dogma.