3 ms·
All good code has the property of clear specification. The place where BDD really shines is that it forces you to use your own abstraction in practice, which of
by jlouis 17y ago
All good code has the property of clear specification. The place where BDD really shines is that it forces you to use your own abstraction in practice, which often uncovers where it is unwieldy to use.
Another way to get lean code is to use a proper, powerful, static type system. It enforces you to think about the code "skeleton" and the "tests" are done automatically by the type checker at each compile/load of the code. It also reduces the amount of testing needed: There is no way something different from an integer can be passed as a parameter, so you do not need to account for that.
My code does not use many Unit tests per se. But it does autogenerate a lot of test cases to check certain properties. Autogeneration is excellent at producing corner-cases, so if that is what you are after... I generally find this is a better use of my time as a programmer: Better spend some time developing the autogenerator than writing boring tests which my code for most part will pass in first attempt.