Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #40966 > unrolled thread

TDD can be useful even when it doesn't achieve what you want

Started byJuha Nieminen <nospam@thanks.invalid>
First post2016-02-15 21:49 +0000
Last post2016-02-18 21:30 +0000
Articles 20 on this page of 75 — 11 participants

Back to article view | Back to comp.lang.c++


Contents

  TDD can be useful even when it doesn't achieve what you want Juha Nieminen <nospam@thanks.invalid> - 2016-02-15 21:49 +0000
    Re: TDD can be useful even when it doesn't achieve what you want Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-02-15 21:56 +0000
      Re: TDD can be useful even when it doesn't achieve what you want Juha Nieminen <nospam@thanks.invalid> - 2016-02-16 09:09 +0000
    Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-15 23:59 +0100
      Re: TDD can be useful even when it doesn't achieve what you want Juha Nieminen <nospam@thanks.invalid> - 2016-02-16 09:12 +0000
        Re: TDD can be useful even when it doesn't achieve what you want Öö Tiib <ootiib@hot.ee> - 2016-02-16 03:08 -0800
        Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-16 17:16 +0100
          Re: TDD can be useful even when it doesn't achieve what you want Juha Nieminen <nospam@thanks.invalid> - 2016-02-17 11:26 +0000
            Re: TDD can be useful even when it doesn't achieve what you want Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-02-17 16:55 +0000
              Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 08:00 +1300
            Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-17 18:57 +0100
              Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 08:02 +1300
                Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-17 20:11 +0100
                  Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 08:23 +1300
                    Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-17 20:32 +0100
                      Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 08:54 +1300
                      Re: TDD can be useful even when it doesn't achieve what you want Cholo Lennon <chololennon@hotmail.com> - 2016-02-17 17:19 -0300
                        Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 10:28 +1300
                  Re: TDD can be useful even when it doesn't achieve what you want legalize+jeeves@mail.xmission.com (Richard) - 2016-02-17 21:28 +0000
              Re: TDD can be useful even when it doesn't achieve what you want legalize+jeeves@mail.xmission.com (Richard) - 2016-02-17 21:08 +0000
                Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-17 23:08 +0100
                  Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 11:19 +1300
                    Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-18 08:33 +0100
                      Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 20:42 +1300
                        Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 20:45 +1300
                          Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-18 08:58 +0100
                            Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 23:24 +1300
                        Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-18 08:58 +0100
                          Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 21:17 +1300
                            Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-18 09:22 +0100
                              Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 21:28 +1300
                                Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-18 09:39 +0100
                                  Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 23:22 +1300
                                    Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-18 11:57 +0100
                                      Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-19 09:29 +1300
                                        Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-18 22:00 +0100
                                          Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-19 10:10 +1300
                                            Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-18 23:15 +0100
                                              Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-20 11:22 +1300
                                                Re: TDD can be useful even when it doesn't achieve what you want legalize+jeeves@mail.xmission.com (Richard) - 2016-02-19 22:39 +0000
                                                  Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-20 00:20 +0100
                                                    Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-20 13:16 +1300
                                                      Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-20 09:07 +0100
                                                        Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-20 21:17 +1300
                                                          Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-20 09:53 +0100
                                                            Re: TDD can be useful even when it doesn't achieve what you want Öö Tiib <ootiib@hot.ee> - 2016-02-20 04:24 -0800
                                                              Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-20 14:08 +0100
                                                        Re: TDD can be useful even when it doesn't achieve what you want legalize+jeeves@mail.xmission.com (Richard) - 2016-02-21 01:19 +0000
                                                          Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-21 09:29 +0100
                                                            Re: TDD can be useful even when it doesn't achieve what you want Paul Sinnett <paul.sinnett@gmail.com> - 2016-02-21 08:08 -0800
                                                            Re: TDD can be useful even when it doesn't achieve what you want legalize+jeeves@mail.xmission.com (Richard) - 2016-02-22 05:07 +0000
                                                              Re: TDD can be useful even when it doesn't achieve what you want Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-02-22 19:44 +0000
                                                                Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-23 08:58 +1300
                                                                  Re: TDD can be useful even when it doesn't achieve what you want Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-02-22 20:13 +0000
                                                                    Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-23 09:19 +1300
                                                                      Re: TDD can be useful even when it doesn't achieve what you want Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-02-22 20:21 +0000
                                                                Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-22 21:18 +0100
                                                                  Re: TDD can be useful even when it doesn't achieve what you want Juha Nieminen <nospam@thanks.invalid> - 2016-02-23 09:14 +0000
                                                                    Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-23 22:21 +1300
                                                                      Re: TDD can be useful even when it doesn't achieve what you want Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-02-23 17:33 +0000
                                                                        Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-23 19:28 +0100
                                                                        Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-24 08:43 +1300
                                                                          Re: TDD can be useful even when it doesn't achieve what you want Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-02-23 20:13 +0000
                                                                            Re: TDD can be useful even when it doesn't achieve what you want Gareth Owen <gwowen@gmail.com> - 2016-02-23 20:53 +0000
                                                                              Re: TDD can be useful even when it doesn't achieve what you want legalize+jeeves@mail.xmission.com (Richard) - 2016-02-24 17:12 +0000
                                                                                Re: TDD can be useful even when it doesn't achieve what you want Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-02-24 18:05 +0000
                                                                            Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-24 09:53 +1300
                                                                              Re: TDD can be useful even when it doesn't achieve what you want Gareth Owen <gwowen@gmail.com> - 2016-02-23 21:09 +0000
                                                                                Re: TDD can be useful even when it doesn't achieve what you want David Brown <david.brown@hesbynett.no> - 2016-02-23 22:22 +0100
                                                        Re: TDD can be useful even when it doesn't achieve what you want legalize+jeeves@mail.xmission.com (Richard) - 2016-02-21 01:21 +0000
                            Re: TDD can be useful even when it doesn't achieve what you want Ian Collins <ian-news@hotmail.com> - 2016-02-18 21:24 +1300
                    Re: TDD can be useful even when it doesn't achieve what you want Vir Campestris <vir.campestris@invalid.invalid> - 2016-02-18 21:27 +0000
                  Re: TDD can be useful even when it doesn't achieve what you want legalize+jeeves@mail.xmission.com (Richard) - 2016-02-18 17:48 +0000
                    Re: TDD can be useful even when it doesn't achieve what you want Wouter van Ooijen <wouter@voti.nl> - 2016-02-18 19:04 +0100
            Re: TDD can be useful even when it doesn't achieve what you want Vir Campestris <vir.campestris@invalid.invalid> - 2016-02-18 21:30 +0000

Page 1 of 4  [1] 2 3 4  Next page →


#40966 — TDD can be useful even when it doesn't achieve what you want

FromJuha Nieminen <nospam@thanks.invalid>
Date2016-02-15 21:49 +0000
SubjectTDD can be useful even when it doesn't achieve what you want
Message-ID<n9th55$slr$1@adenine.netfront.net>
As a contrast to the recent "TDD is harmful" thread, I would like to
recount something I thought of recently in regards to a situation
where TDD doesn't actually achieve what you want, but can still make
your code better regardless.

Suppose you have a problem like this: You have made a small class
that opens a file (for example an image file) and does something with
it. One of the things you want to test is that the class actually ends
up closing the file (at the latest when it's destroyed). How would you
test this?

Since you are TDD-conscious, mock objects come to you naturally.
Therefore the solution seems to be clear: You have to make a mock
object that behaves like a file handle. To do this, you have to change
the class so that it takes a more abstract file handle than eg. a FILE*
or a std::istream. Once this is done, you can easily create a test to
make sure that your file-handling class ends up eventually closing the
file (by creating a mock file handler object that makes this check and
giving it to the class.)

However, there's a problem here: How do we now test that this abstract
file handle (which itself uses eg a FILE* or a std::istream) ends up
closing the file (at the latest when it's destroyed)? We realize that
all we have done is just transfer the problem to another class, and we
have ended up in an ouroboros situation. How could we test this? Create
yet *another* abstract file handle which we can mock? That wouldn't make
much sense since we just did exactly that, and it didn't really help.
We would just be in a vicious cycle.

So TDD didn't actually help us solve the actual problem we were trying
to solve.

*However* TDD *did* help us, in a natural way, to make our original class
better. That's because now it's more abstract and flexible. We have
changed it from being hard-coded to use a standard file handle into
being abstract, which makes it more flexible. (After all, it now supports
other types of input for the data it needs to read. We can now make
all kinds of abstract "file handle" objects that feed it data from
whatever other resource that might not be a file.)

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [next] | [standalone]


#40967

FromMr Flibble <flibbleREMOVETHISBIT@i42.co.uk>
Date2016-02-15 21:56 +0000
Message-ID<7YOdnecP3Nw21F_LnZ2dnUU7-fednZ2d@giganews.com>
In reply to#40966
On 15/02/2016 21:49, Juha Nieminen wrote:
> As a contrast to the recent "TDD is harmful" thread, I would like to
> recount something I thought of recently in regards to a situation
> where TDD doesn't actually achieve what you want, but can still make
> your code better regardless.
>
> Suppose you have a problem like this: You have made a small class
> that opens a file (for example an image file) and does something with
> it. One of the things you want to test is that the class actually ends
> up closing the file (at the latest when it's destroyed). How would you
> test this?
>
> Since you are TDD-conscious, mock objects come to you naturally.
> Therefore the solution seems to be clear: You have to make a mock
> object that behaves like a file handle. To do this, you have to change
> the class so that it takes a more abstract file handle than eg. a FILE*
> or a std::istream. Once this is done, you can easily create a test to
> make sure that your file-handling class ends up eventually closing the
> file (by creating a mock file handler object that makes this check and
> giving it to the class.)
>
> However, there's a problem here: How do we now test that this abstract
> file handle (which itself uses eg a FILE* or a std::istream) ends up
> closing the file (at the latest when it's destroyed)? We realize that
> all we have done is just transfer the problem to another class, and we
> have ended up in an ouroboros situation. How could we test this? Create
> yet *another* abstract file handle which we can mock? That wouldn't make
> much sense since we just did exactly that, and it didn't really help.
> We would just be in a vicious cycle.
>
> So TDD didn't actually help us solve the actual problem we were trying
> to solve.
>
> *However* TDD *did* help us, in a natural way, to make our original class
> better. That's because now it's more abstract and flexible. We have
> changed it from being hard-coded to use a standard file handle into
> being abstract, which makes it more flexible. (After all, it now supports
> other types of input for the data it needs to read. We can now make
> all kinds of abstract "file handle" objects that feed it data from
> whatever other resource that might not be a file.)

I am, and I am sure many others are, quite capable of creating 
appropriate abstractions without using TDD.

/Flibble

[toc] | [prev] | [next] | [standalone]


#40980

FromJuha Nieminen <nospam@thanks.invalid>
Date2016-02-16 09:09 +0000
Message-ID<n9up0s$o3r$1@adenine.netfront.net>
In reply to#40967
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> wrote:
> I am, and I am sure many others are, quite capable of creating 
> appropriate abstractions without using TDD.

You are missing the point.

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#40969

FromWouter van Ooijen <wouter@voti.nl>
Date2016-02-15 23:59 +0100
Message-ID<56c2586d$0$12445$e4fe514c@newszilla.xs4all.nl>
In reply to#40966
Op 15-Feb-16 om 10:49 PM schreef Juha Nieminen:
> As a contrast to the recent "TDD is harmful" thread, I would like to
> recount something I thought of recently in regards to a situation
> where TDD doesn't actually achieve what you want, but can still make
> your code better regardless.
>
> Suppose you have a problem like this: You have made a small class
> that opens a file (for example an image file) and does something with
> it. One of the things you want to test is that the class actually ends
> up closing the file (at the latest when it's destroyed). How would you
> test this?
>
> Since you are TDD-conscious, mock objects come to you naturally.
> Therefore the solution seems to be clear: You have to make a mock
> object that behaves like a file handle. To do this, you have to change
> the class so that it takes a more abstract file handle than eg. a FILE*
> or a std::istream. Once this is done, you can easily create a test to
> make sure that your file-handling class ends up eventually closing the
> file (by creating a mock file handler object that makes this check and
> giving it to the class.)
>
> However, there's a problem here: How do we now test that this abstract
> file handle (which itself uses eg a FILE* or a std::istream) ends up
> closing the file (at the latest when it's destroyed)? We realize that
> all we have done is just transfer the problem to another class, and we
> have ended up in an ouroboros situation. How could we test this? Create
> yet *another* abstract file handle which we can mock? That wouldn't make
> much sense since we just did exactly that, and it didn't really help.
> We would just be in a vicious cycle.
>
> So TDD didn't actually help us solve the actual problem we were trying
> to solve.
>
> *However* TDD *did* help us, in a natural way, to make our original class
> better. That's because now it's more abstract and flexible. We have
> changed it from being hard-coded to use a standard file handle into
> being abstract, which makes it more flexible. (After all, it now supports
> other types of input for the data it needs to read. We can now make
> all kinds of abstract "file handle" objects that feed it data from
> whatever other resource that might not be a file.)
>

TDD might have helped *you* in *this case*, but so would any 
design/development method that pays attention to testability. (And on 
top of that, any design method that pays attention to abstraction and 
re-use).

Wouter van Ooijen

[toc] | [prev] | [next] | [standalone]


#40981

FromJuha Nieminen <nospam@thanks.invalid>
Date2016-02-16 09:12 +0000
Message-ID<n9up6c$ou6$1@adenine.netfront.net>
In reply to#40969
Wouter van Ooijen <wouter@voti.nl> wrote:
> TDD might have helped *you* in *this case*, but so would any 
> design/development method that pays attention to testability. (And on 
> top of that, any design method that pays attention to abstraction and 
> re-use).

How many of those methods actually induce you to both increase the
abstraction of your designs and create tests for your modules at
the same time?

Why this hate of TDD? I don't understand.

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#40982

FromÖö Tiib <ootiib@hot.ee>
Date2016-02-16 03:08 -0800
Message-ID<73dc32d6-027f-475c-8bf1-bb87d6fddb65@googlegroups.com>
In reply to#40981
On Tuesday, 16 February 2016 11:12:56 UTC+2, Juha Nieminen  wrote:
> Wouter van Ooijen <wouter@voti.nl> wrote:
> > TDD might have helped *you* in *this case*, but so would any 
> > design/development method that pays attention to testability. (And on 
> > top of that, any design method that pays attention to abstraction and 
> > re-use).
> 
> How many of those methods actually induce you to both increase the
> abstraction of your designs and create tests for your modules at
> the same time?
> 
> Why this hate of TDD? I don't understand.

I think that it is like always when some sort of process, method,
technique or tool is too inconvenient, badly supported, misapplied 
and/or overused somehow.

To be more concrete:
* They do not  do not test units in isolation (typically because testing
framework is weak).
* They handwrite (or manually correct) lot of mocks, fakes and dummies
(typically because testing framework is weak).
* The tests look like cryptic garbage (typically because testing framework
used has verbose and complex setup interface).  
* One test checks too several things so it is hard to say what it tests 
without using word "and" several times (typically because of one or 
more from previous issues).
* TDD (as silver bullet tool and design process) is valued over 
individuals and interactions within organization.
* Unit test code coverage (as the holy metric of quality) is valued over
working software within organization.   
* and/or other such issues.  

These are called as strawmen but are likely real issues because It can take
time, debates, work and effort to get corrected. Only few (one?) of such 
issues is plenty for someone to become toxic.

[toc] | [prev] | [next] | [standalone]


#40986

FromWouter van Ooijen <wouter@voti.nl>
Date2016-02-16 17:16 +0100
Message-ID<56c34b5c$0$18569$e4fe514c@newszilla.xs4all.nl>
In reply to#40981
Op 16-Feb-16 om 10:12 AM schreef Juha Nieminen:
> Wouter van Ooijen <wouter@voti.nl> wrote:
>> TDD might have helped *you* in *this case*, but so would any
>> design/development method that pays attention to testability. (And on
>> top of that, any design method that pays attention to abstraction and
>> re-use).
>
> How many of those methods actually induce you to both increase the
> abstraction of your designs and create tests for your modules at
> the same time?
>
> Why this hate of TDD? I don't understand.

TDD is just a term/word/phrase, nothing to hate or love. What I don't 
like is the set of 3 rules. (And the implied 4'th rule, that someone who 
doesn't always use TDD is not a professional.) If that is different from 
TDD, please interpret my objections (or even hate) as directed to those 
3 rules. But if those 3 rules are essential to TDD, yes, *then* I hate TDD.

I have no objection to TDD as a suggestion of how to organise your work, 
alsongside other suggestions like (rapid) prototyping, waterfall (yes!), 
agile, scrum, peer programming, egoless programming, and a long list of 
others. As always, the job of an engineer is to choose the right tool 
for the job at hand.

Wwouter van Ooijen

[toc] | [prev] | [next] | [standalone]


#40997

FromJuha Nieminen <nospam@thanks.invalid>
Date2016-02-17 11:26 +0000
Message-ID<na1ldu$1e57$1@adenine.netfront.net>
In reply to#40986
Wouter van Ooijen <wouter@voti.nl> wrote:
> As always, the job of an engineer is to choose the right tool 
> for the job at hand.

I don't think anybody (who knows anything) is claiming that TDD is
the silver bullet, the perfect tool for every possible situation.

However, when properly used, properly applied, and when rigorously
followed, it increases the quality and design of programming projects.
It might not test every single potential bug that a program may have
(not even nearly), but it catches early on easy mistakes (and often
even more obscure ones). The time you "waste" on the TDD part can well
be saved in avoiding the bug hunting later on. Also, the design decisions
you do in order to make TDD work can pay off all in themselves as well.

That's not to say that the program cannot be designed poorly even when
using TDD properly. But there's a reason why so many people advocate it.

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#40998

FromMr Flibble <flibbleREMOVETHISBIT@i42.co.uk>
Date2016-02-17 16:55 +0000
Message-ID<OO-dnSmN-v5_OFnLnZ2dnUU7-KWdnZ2d@giganews.com>
In reply to#40997
On 17/02/2016 11:26, Juha Nieminen wrote:
> Wouter van Ooijen <wouter@voti.nl> wrote:
>> As always, the job of an engineer is to choose the right tool
>> for the job at hand.
>
> I don't think anybody (who knows anything) is claiming that TDD is
> the silver bullet, the perfect tool for every possible situation.
>
> However, when properly used, properly applied, and when rigorously
> followed, it increases the quality and design of programming projects.

Quite the contrary: TDD is anathema to good design.

/Flibble

[toc] | [prev] | [next] | [standalone]


#41000

FromIan Collins <ian-news@hotmail.com>
Date2016-02-18 08:00 +1300
Message-ID<dijua3Fiat1U1@mid.individual.net>
In reply to#40998
Mr Flibble wrote:
> On 17/02/2016 11:26, Juha Nieminen wrote:
>> Wouter van Ooijen <wouter@voti.nl> wrote:
>>> As always, the job of an engineer is to choose the right tool
>>> for the job at hand.
>>
>> I don't think anybody (who knows anything) is claiming that TDD is
>> the silver bullet, the perfect tool for every possible situation.
>>
>> However, when properly used, properly applied, and when rigorously
>> followed, it increases the quality and design of programming projects.
>
> Quite the contrary: TDD is anathema to good design.

How's your critique of Uncle Bob's paper coming along?

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#40999

FromWouter van Ooijen <wouter@voti.nl>
Date2016-02-17 18:57 +0100
Message-ID<56c4b474$0$4233$e4fe514c@newszilla.xs4all.nl>
In reply to#40997
Op 17-Feb-16 om 12:26 PM schreef Juha Nieminen:
> Wouter van Ooijen <wouter@voti.nl> wrote:
>> As always, the job of an engineer is to choose the right tool
>> for the job at hand.
>
> I don't think anybody (who knows anything) is claiming that TDD is
> the silver bullet, the perfect tool for every possible situation.
>
> However, when properly used, properly applied, and when rigorously
> followed, it increases the quality and design of programming projects.

When I read these two scentences they seem to contradict each other.

PS Uncle Bob *does* claim that TTD is *the* tool to apply to every 
programming problem.

> It might not test every single potential bug that a program may have
> (not even nearly), but it catches early on easy mistakes (and often
> even more obscure ones). The time you "waste" on the TDD part can well
> be saved in avoiding the bug hunting later on. Also, the design decisions
> you do in order to make TDD work can pay off all in themselves as well.
>
> That's not to say that the program cannot be designed poorly even when
> using TDD properly. But there's a reason why so many people advocate it.

Against those assertions I assert that there is a reason so many people 
are against it.

Wouter

[toc] | [prev] | [next] | [standalone]


#41001

FromIan Collins <ian-news@hotmail.com>
Date2016-02-18 08:02 +1300
Message-ID<dijudgFiat1U2@mid.individual.net>
In reply to#40999
Wouter van Ooijen wrote:
> Op 17-Feb-16 om 12:26 PM schreef Juha Nieminen:
>> Wouter van Ooijen <wouter@voti.nl> wrote:
>>> As always, the job of an engineer is to choose the right tool
>>> for the job at hand.
>>
>> I don't think anybody (who knows anything) is claiming that TDD is
>> the silver bullet, the perfect tool for every possible situation.
>>
>> However, when properly used, properly applied, and when rigorously
>> followed, it increases the quality and design of programming projects.
>
> When I read these two scentences they seem to contradict each other.
>
> PS Uncle Bob *does* claim that TTD is *the* tool to apply to every
> programming problem.
>
>> It might not test every single potential bug that a program may have
>> (not even nearly), but it catches early on easy mistakes (and often
>> even more obscure ones). The time you "waste" on the TDD part can well
>> be saved in avoiding the bug hunting later on. Also, the design decisions
>> you do in order to make TDD work can pay off all in themselves as well.
>>
>> That's not to say that the program cannot be designed poorly even when
>> using TDD properly. But there's a reason why so many people advocate it.
>
> Against those assertions I assert that there is a reason so many people
> are against it.

The reason is they don't understand TDD or have experienced it done badly.

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#41002

FromWouter van Ooijen <wouter@voti.nl>
Date2016-02-17 20:11 +0100
Message-ID<56c4c5ef$0$4200$e4fe514c@newszilla.xs4all.nl>
In reply to#41001
Op 17-Feb-16 om 8:02 PM schreef Ian Collins:
> Wouter van Ooijen wrote:
>> Op 17-Feb-16 om 12:26 PM schreef Juha Nieminen:
>>> Wouter van Ooijen <wouter@voti.nl> wrote:
>>>> As always, the job of an engineer is to choose the right tool
>>>> for the job at hand.
>>>
>>> I don't think anybody (who knows anything) is claiming that TDD is
>>> the silver bullet, the perfect tool for every possible situation.
>>>
>>> However, when properly used, properly applied, and when rigorously
>>> followed, it increases the quality and design of programming projects.
>>
>> When I read these two scentences they seem to contradict each other.
>>
>> PS Uncle Bob *does* claim that TTD is *the* tool to apply to every
>> programming problem.
>>
>>> It might not test every single potential bug that a program may have
>>> (not even nearly), but it catches early on easy mistakes (and often
>>> even more obscure ones). The time you "waste" on the TDD part can well
>>> be saved in avoiding the bug hunting later on. Also, the design
>>> decisions
>>> you do in order to make TDD work can pay off all in themselves as well.
>>>
>>> That's not to say that the program cannot be designed poorly even when
>>> using TDD properly. But there's a reason why so many people advocate it.
>>
>> Against those assertions I assert that there is a reason so many people
>> are against it.
>
> The reason is they don't understand TDD or have experienced it done badly.

That's your assertion. I assert that they have good reasons.

(Of course when you define 'doing it well' as 'when it works' *any* 
methodology works well....)


Wouter

[toc] | [prev] | [next] | [standalone]


#41003

FromIan Collins <ian-news@hotmail.com>
Date2016-02-18 08:23 +1300
Message-ID<dijvlvFiat1U4@mid.individual.net>
In reply to#41002
Wouter van Ooijen wrote:
> Op 17-Feb-16 om 8:02 PM schreef Ian Collins:
>> Wouter van Ooijen wrote:

>>> Against those assertions I assert that there is a reason so many people
>>> are against it.
>>
>> The reason is they don't understand TDD or have experienced it done badly.
>
> That's your assertion. I assert that they have good reasons.

Some people will find the process difficult.  Whenever I have introduced 
TDD into a team there have always been some who initially opposed the 
change and even some who at best grudgingly accepted it once the process 
has bedded in.  I think this comes down to personality type.  Some feel 
uneasy uneasy without detailed planning, others find planning stressful. 
  The same apples to development methodologies.

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#41004

FromWouter van Ooijen <wouter@voti.nl>
Date2016-02-17 20:32 +0100
Message-ID<56c4cac3$0$4180$e4fe514c@newszilla.xs4all.nl>
In reply to#41003
Op 17-Feb-16 om 8:23 PM schreef Ian Collins:
> Wouter van Ooijen wrote:
>> Op 17-Feb-16 om 8:02 PM schreef Ian Collins:
>>> Wouter van Ooijen wrote:
>
>>>> Against those assertions I assert that there is a reason so many people
>>>> are against it.
>>>
>>> The reason is they don't understand TDD or have experienced it done
>>> badly.
>>
>> That's your assertion. I assert that they have good reasons.
>
> Some people will find the process difficult.  Whenever I have introduced
> TDD into a team there have always been some who initially opposed the
> change and even some who at best grudgingly accepted it once the process
> has bedded in.  I think this comes down to personality type.  Some feel
> uneasy uneasy without detailed planning, others find planning stressful.
>   The same apples to development methodologies.

You seem to be more reasonable than the 3-rule evangelists ( 
http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd ). What is 
in your opinion a good description of TDD?

Wouter

[toc] | [prev] | [next] | [standalone]


#41005

FromIan Collins <ian-news@hotmail.com>
Date2016-02-18 08:54 +1300
Message-ID<dik1gaFiat1U5@mid.individual.net>
In reply to#41004
Wouter van Ooijen wrote:
> Op 17-Feb-16 om 8:23 PM schreef Ian Collins:
>> Wouter van Ooijen wrote:
>>> Op 17-Feb-16 om 8:02 PM schreef Ian Collins:
>>>> Wouter van Ooijen wrote:
>>
>>>>> Against those assertions I assert that there is a reason so many people
>>>>> are against it.
>>>>
>>>> The reason is they don't understand TDD or have experienced it done
>>>> badly.
>>>
>>> That's your assertion. I assert that they have good reasons.
>>
>> Some people will find the process difficult.  Whenever I have introduced
>> TDD into a team there have always been some who initially opposed the
>> change and even some who at best grudgingly accepted it once the process
>> has bedded in.  I think this comes down to personality type.  Some feel
>> uneasy uneasy without detailed planning, others find planning stressful.
>>    The same apples to development methodologies.
>
> You seem to be more reasonable than the 3-rule evangelists (
> http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd ). What is
> in your opinion a good description of TDD?

I guess that comes from being an early adopter (around 2002) who has 
lost the evangelical zeal :)

I do follow the three rules, along with my fourth rule:

4) You are not allowed to fix any bug without adding a failing unit test.

TDD suites my way of thinking.  I like to know, as that article says 
that a minute ago all my code worked!  I like just to be able to revert 
a commit rather than mess with a debugger.  I like to know that when I 
change code I haven't broken it.

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#41007

FromCholo Lennon <chololennon@hotmail.com>
Date2016-02-17 17:19 -0300
Message-ID<na2kl9$72h$1@gioia.aioe.org>
In reply to#41004
On 02/17/2016 04:32 PM, Wouter van Ooijen wrote:
> Op 17-Feb-16 om 8:23 PM schreef Ian Collins:
>> Wouter van Ooijen wrote:
>>> Op 17-Feb-16 om 8:02 PM schreef Ian Collins:
>>>> Wouter van Ooijen wrote:
>>
>>>>> Against those assertions I assert that there is a reason so many
>>>>> people
>>>>> are against it.
>>>>
>>>> The reason is they don't understand TDD or have experienced it done
>>>> badly.
>>>
>>> That's your assertion. I assert that they have good reasons.
>>
>> Some people will find the process difficult.  Whenever I have introduced
>> TDD into a team there have always been some who initially opposed the
>> change and even some who at best grudgingly accepted it once the process
>> has bedded in.  I think this comes down to personality type.  Some feel
>> uneasy uneasy without detailed planning, others find planning stressful.
>>   The same apples to development methodologies.
>
> You seem to be more reasonable than the 3-rule evangelists (
> http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd ). What is
> in your opinion a good description of TDD?
>

IMHO that's the problem of TDD: The strict dogmas. I think (at least in 
my experience) the TDD evangelists (teachers, bosses) are inflexible 
with the methodology. I prefer guidelines or tips that you can 
pick/discard if they are useful or not for you.

TDD is for me another tool to develop my software, sometimes it can 
works well, sometimes it doesn't.


Regards


-- 
Cholo Lennon
Bs.As.
ARG

[toc] | [prev] | [next] | [standalone]


#41009

FromIan Collins <ian-news@hotmail.com>
Date2016-02-18 10:28 +1300
Message-ID<dik70rFiat1U6@mid.individual.net>
In reply to#41007
Cholo Lennon wrote:
> On 02/17/2016 04:32 PM, Wouter van Ooijen wrote:
>>
>> You seem to be more reasonable than the 3-rule evangelists (
>> http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd ). What is
>> in your opinion a good description of TDD?
>>
>
> IMHO that's the problem of TDD: The strict dogmas. I think (at least in
> my experience) the TDD evangelists (teachers, bosses) are inflexible
> with the methodology. I prefer guidelines or tips that you can
> pick/discard if they are useful or not for you.

That will depend on the coach.  None of my teams followed a "strict" (if 
there is such a thing) XP process, they all adopted the process to fit 
their people and external processes.  In my opinion that is how agile 
should be, every work environment is different, so there isn't a one 
size fits all process.  The same applies to managing a project with 
Scrum, no two teams end up with the exact same process. The Dogma goes 
against the philosophy of agile software development.

If I were starting with a new team today, I would would *start out* by 
following a "strict" process and then adapt.  That is the agile way: 
tweak the process to fit the people, don't force the process on the people.

> TDD is for me another tool to develop my software, sometimes it can
> works well, sometimes it doesn't.

Hopefully more the former!  If find something doesn't appear to suit 
TDD, I tend to have a good look at when I and doing and find out why.

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#41008

Fromlegalize+jeeves@mail.xmission.com (Richard)
Date2016-02-17 21:28 +0000
Message-ID<na2omq$ht0$2@news.xmission.com>
In reply to#41002
[Please do not mail me a copy of your followup]

Wouter van Ooijen <wouter@voti.nl> spake the secret code
<56c4c5ef$0$4200$e4fe514c@newszilla.xs4all.nl> thusly:

>(Of course when you define 'doing [TDD] well' as 'when it works' *any* 
>methodology works well....)

As someone that has introduced TDD to every team I've worked on for
the past 10 years, I can pretty quickly tell the difference between
someone doing it right and someone doing it wrong.

What is "doing it wrong"?  Dr. Evil gives a nice example:
<http://cdn.meme.am/instances/54444468.jpg>

In general, the people I see struggling the most with TDD are the same
ones that struggle to make small methods and small classes.  They
routinely violate SRP and the other SOLID OO design principles.
<https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)>

When practicing TDD, if your tests start getting complicated, that is
a signal being given to you by your code.  The tests are telling you
that your implementation/design is too complex.  Someone who is used
to writing long complicated methods and isn't used to following SRP
chafes against TDD because it is actively making it hard for them to
do what they are used to doing.

Psychologically this puts you in a bind.  You want to embrace SRP and
other SOLID design principles, because everyone knows they are
intrinsicly "good".  Historically your code doesn't embody those
principles, but this hasn't been explicitly brought to your attention
or you've rationalized away your violations of those design principles
through utility or necessity.  TDD is putting your feet to the fire
and forcing you to adhere to those principles in practice and not just
in theory.  Doing this means changing the way you've been writing
code.  It's uncomfortable.  It's painful to write code in the familiar
way with TDD because your tests get really complicated and painful to
write.

I've seen people work their way out of this psychological bind in two
ways:

1. Change your coding habits to adhere to the SOLID principles more
   directly and embrace TDD's ability to keep you honest.

2. Discard TDD and complain about how it makes you write really
   complicated tests and wastes time.

The people I've seen choosing option 2 keep writing long methods and
big classes and keep producing code that is very difficult, and
sometimes impossible, for their teammates to understand, maintain and
enhance.  Their productivity remains unchanged.

The people I've seen choosing option 1 are initially going slower
because they are retraining their mental programming muscles to
operate in a different fashion.  After they build up their TDD
muscles, they end up moving faster than those that chose option 2
because they are able to produce code at the same quality faster
or better quality in the same time as those choosing option 2.  Here
"time" has to be measured across design, develop, test and ship
lifecycle of a product/release and not just the "develop" part.  The
empirical studies on TDD being introduced to teams show similar
results to what I've witnessed in my personal experience.

Don't like TDD?  Fine, don't use it.  I would suggest that you try it
for real before you decide that it has no merit.  I've seen enough
people doing it wrong to know that it is difficult for some people to
understand what TDD is really asking them to do.  It's less about the
physical tests than most people think.

Trying to convince me that TDD is a waste of time?  You'll have to
show me how to achieve the same or better results with something else.
I've spent more years doing non-TDD development than I have spent
doing TDD.  I have plenty of experience doing things both ways.  My
experience has shown me and my immediately coworkers that TDD allows
us to ship better code with the same effort.

Obligatory comment for wood brain dead 77:
shitty shit, shit shit shit.
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://computergraphicsmuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

[toc] | [prev] | [next] | [standalone]


#41006

Fromlegalize+jeeves@mail.xmission.com (Richard)
Date2016-02-17 21:08 +0000
Message-ID<na2nh7$ht0$1@news.xmission.com>
In reply to#40999
[Please do not mail me a copy of your followup]

Wouter van Ooijen <wouter@voti.nl> spake the secret code
<56c4b474$0$4233$e4fe514c@newszilla.xs4all.nl> thusly:

>PS Uncle Bob *does* claim that TTD is *the* tool to apply to every 
>programming problem.

What I've seen him claim is that he hasn't found anything better than
TDD.  If you can show him something better than TDD, then he'll be
talking about that.

If you have something you think is better than TDD, bring it Uncle Bob
and get him to champion it.  If you can convince Uncle Bob, I'm very
interested in hearing about it.
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://computergraphicsmuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

[toc] | [prev] | [next] | [standalone]


Page 1 of 4  [1] 2 3 4  Next page →

Back to top | Article view | comp.lang.c++


csiph-web