On 7/5/23 9:56 AM, Sleepyfox wrote:
The original proposition, partly, as stated is:
One can learn design skill by practising TDD, and I consider this a kind of pracitisng TDD "well"
I feel this falls into the trap of not being clear about what we mean
when we say TDD.
If one defines TDD as a process. Red, Green, Refactor.
First write a failing test.
Only write enough code to make the test pass.
Etc...
It seems to me that refactoring is the part of the TDD process where
we "improve the design of the running, tested code without changing
its functionality".
How can we improve the design, unless we already know what constitutes
good design, and what constitutes bad design? TDD itself doesn't tell
us, it is just a process. We must obtain the sensibilities of design
elsewhere.
The major point of software design is to make the code easy to understand, and therefore easy to work on. I learned enough about software design from writing essays in English classes and from Larry Constantine's work on coupling and cohesion that I could realize what changes were making it easier and harder to reason about the code.
I see one exception to this: design for testing. The act of trying to
write tests for code that is not designed for testing, using patterns
that we are familiar with that do not promote design for testing, will
make life painful. If we listen to our tests then we will try and
remove this pain, and by doing so blunder randomly into patterns that
promote design for testability.
In all other ways however I cannot see how good design sensibilities are taught by the TDD process. They must be learned elsewhere.
Au contraire. I think you just have to pay attention as you work, and be willing to back up and try something different.
I concede that there are probably things I might not be considering.
If someone has some proof of 'emergent properties of a simple system'
that show good design emerges from repeated application of the TDD
process without any external input (in terms of design), I would be
most interested.
TDD at least fulfils the requirement of fast feedback for a Chaotic system.
Fox
---
- George
--
----------------------------------------------------------------------
* George Dinwiddie *
Software Development
Consultant and Coach
----------------------------------------------------------------------