unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@online.de>
To: emacs-devel@gnu.org
Cc: "Eli Zaretskii" <eliz@gnu.org>,
	"Przemysław Wojnowski" <esperanto@cumego.com>
Subject: Re: [PATCH] CONTRIBUTE - writing tests for understanding internals
Date: Fri, 13 Nov 2015 09:03:30 +0100	[thread overview]
Message-ID: <56459952.1040400@online.de> (raw)
In-Reply-To: <83si4agxpp.fsf@gnu.org>

  On 13.11.2015 08:33, Eli Zaretskii wrote:
>> Cc: emacs-devel@gnu.org
>> From: Przemysław Wojnowski<esperanto@cumego.com>
>> Date: Thu, 12 Nov 2015 22:42:43 +0100
>>
>> W dniu 12.11.2015 o 21:55, Eli Zaretskii pisze:
>>> In TDD, they teach you to write a test for a spec that isn't
>>> implemented yet.  The test fails, of course (which is a Good Thing:
>>> now you know that your test indeed will catch a non-compliant
>>> implementation), and then you implement the spec to see that it now
>>> succeeds.  If you work that way, tests _do_ drive the development.
>> What do you mean by "spec" here?
> Sorry for using jargon here.  By "spec" I meant the specification of
> the module, i.e. the APIs of its methods, and the set of requirements
> that define what should be the result(s) of invoking the various
> methods with the various possible combinations of arguments and given
> the relevant environmental conditions.
>
> A simple example of a "spec" for a single function is what you see
> here:
>
>    http://pubs.opengroup.org/onlinepubs/009695399/functions/stat.html
>
>> I've never seen nor used TDD (and I use it very often) with "spec".
>> What I've seen, though, was using TDD to implement User Stories (Use
>> Cases), which are descriptions of functionality, but far from formal
>> specifications - if this is what you mean.
> A spec in the terminology I used is the set of formal requirements
> produced by analyzing those use cases.
>
> For the purposes of this discussion, I think it's immaterial whether
> the "spec" is formal or not.  What's important is that you can
> unequivocally determine what the code should do, and write the tests
> which check that.
>
>> Anyway, TDD drives design (you implement only as much as is needed to
>> make the tests pass) and, by side effect, gives strong regression test
>> suite, which _enables_ refactoring.
> Indeed.
>
>

Agreed WRT mentioned side effect - and its importance.

Cheers,

Andreas



      reply	other threads:[~2015-11-13  8:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 22:48 [PATCH] CONTRIBUTE - writing tests for understanding internals Przemysław Wojnowski
2015-11-10 22:58 ` John Wiegley
2015-11-11  3:36 ` Eli Zaretskii
2015-11-11  7:45   ` Przemysław Wojnowski
2015-11-11  8:26     ` Andreas Röhler
2015-11-11 15:40       ` Eli Zaretskii
2015-11-11 15:40     ` Eli Zaretskii
2015-11-11 21:08       ` Przemysław Wojnowski
2015-11-11 21:26         ` Eli Zaretskii
2015-11-11 21:36           ` John Wiegley
2015-11-12  3:40             ` Eli Zaretskii
2015-11-11 21:48           ` Przemysław Wojnowski
2015-11-12  7:16       ` Andreas Röhler
2015-11-12 16:15         ` Eli Zaretskii
2015-11-12 20:03           ` Stephen Leake
2015-11-12 20:40             ` Andreas Röhler
2015-11-12 20:55               ` Eli Zaretskii
2015-11-12 21:42                 ` Przemysław Wojnowski
2015-11-13  7:33                   ` Eli Zaretskii
2015-11-13  8:03                     ` Andreas Röhler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56459952.1040400@online.de \
    --to=andreas.roehler@online.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=esperanto@cumego.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).