1 Oct 2010 01:19
Re: Re: Does a focus on unit tests lead to violating YAGNI?
Ron Jeffries <ronjeffries <at> acm.org>
2010-09-30 23:19:11 GMT
2010-09-30 23:19:11 GMT
Hello, Stan. On Thursday, September 30, 2010, at 5:59:17 PM, you wrote: > Taking what you said, we can add to it to get another contradiction: > Never write code without a failing test > Never write a test without failing code No one actually says that, as far as I know. One writes tests for at least three reasons: One reason is because some capability does not exist, so we write a test that shows that, and that we use to determine when we're done implementing it. That's TDD. One also writes tests when one thinks that the code works but one is not as sure as one would like to be. Here, we're just beefing up the tests that protect us when we refactor. We don't /expect/ to find a bug, but sometimes we do. And one writes tests when a bug has been found, to isolate it and show when it is fixed. This is the "with failing code" case, I suppose. > When I first tried to write test-first, I had a big problem, > because I prided myself on having one test case per domain class, > and one test method per domain method - except for accessors, of > course :). So I had to do "design" before I wrote any tests. Yucky....(Continue reading)
>
> I hardly think so, because you look pretty smart already.
>
>> I agree with your overall assessment but I'm scratching my head to
>> come up with an example. Can we imagine a scenario?
>
> OK, what about this hypothetical scenario: A system admin is going on a
> business trip in a few weeks, and wants the web interface that he often
> uses customized in a version more usable on a cell phone browser rather
> than having to use the company laptop.
>
> For an experienced Agile team, this is just another change, even if
> they've never done a cell phone interface before. The code is already
> well factored such that putting a new front end is fairly
> straightforward; they just need to learns the ins and outs of what
> displays well on the small screen.
Having been in that situation myself (as the sys admin) I would never
allow the deveolpment team to fuck around with an interface that
monitors a live system just to make it prettier on my cell phone. I
would rather get myself a better cellphone, such as an iPhone where I
can have a half decent, fully featured browser. The one thing you do not
do when you are a system adinsitrator is fuck around with a system that
is up and running well just because you want a prettier interface to
RSS Feed