File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes TDD, design, and architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "TDD, design, and architecture" Watch "TDD, design, and architecture" New topic
Author

TDD, design, and architecture

Allan Halme
Ranch Hand

Joined: Aug 22, 2003
Posts: 62
Hi Lasse,

What do you feel is the role of TDD in determining the design and architecture of an application?

You mention in a footnote that test-driven development, test-driven design, and test-first programming are all the same thing. I see clearly that test-driven development and test-driven programming are the same thing, but I feel that test-driven design is a broader issue.

At a certain level, TDD most definitely "drives" the design of the code, because of the refactoring that the tests enable you to do.

However, at a higher level of abstraction, there are architectural design decisions, patterns, and structures that--though they may and should evolve over time and during the project--are probably not best determined via the process of test-first programming.

Your thoughts?


<i>The lyf so short, the craft so long to lerne.</i> --Geoffrey Chaucer (c. 1343-1400)
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Allan Halme:
You mention in a footnote that test-driven development, test-driven design, and test-first programming are all the same thing. I see clearly that test-driven development and test-driven programming are the same thing, but I feel that test-driven design is a broader issue.

At a certain level, TDD most definitely "drives" the design of the code, because of the refactoring that the tests enable you to do.


Fully agreed. I consider all three names synonymous because the tests will affect and drive your design.

Originally posted by Allan Halme:
However, at a higher level of abstraction, there are architectural design decisions, patterns, and structures that--though they may and should evolve over time and during the project--are probably not best determined via the process of test-first programming.


Again, fully agreed. Well, mostly agreed.

The design I talk about in the context of TDD is low level design. It's about objects.

In addition to the everyday design that happens when test driving, in my opinion, you need to have an idea of the system or application architecture. While test driving, you simply work within the constraints of that architecture. When your code is telling you that the architecture is funky, it's time to revise the architecture. That, however, should be a team activity and not a decision of an individual developer.

The reason I said "mostly agreed" is because I consider design patterns to be in the domain of code, not architecture. Architectural patterns again is a bit different.

Originally posted by Allan Halme:
What do you feel is the role of TDD in determining the design and architecture of an application?

To summarize what I tried to say above, I see TDD's role being absolutely essential in determining the design of an application and less essential in determining the architecture of the application.

How does this thinking map to yours?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: TDD, design, and architecture