[Haskell-cafe] HSpec vs Doctest for TDD

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Jun 25 21:44:18 UTC 2014


On 26/06/2014, at 2:51 AM, Alois Cochard wrote:

> For me TDD is highly overrated, and is abused as a buzz word by recruiter...
> 
> In the context of writing a DSL, how one can start by the test? It's just impossible...

I'm puzzled by this.

You have some sort of fuzzy idea for a DSL.
You're not sure exactly what it's going to look like,
but you have a fair idea of what you want to be able
to do with it.

So you write some code in your DSL, making it up as
you go.  As you do this. you keep changing your mind
about what's a nice way to say things, and you go back
and revise earlier sketches.

After a few hours to a few days, you now have some
examples of things you'd like to be able to handle,
and can start mining them for a a grammar and you
can write some code to support them.

And guess what, you have written your DSL tests first,
because the examples you needed to do the *design*
work are precisely test cases that your code should
handle.

My understanding of the history is that this is
pretty much what happened when Erlang was designed.




More information about the Haskell-Cafe mailing list