Hacker News new | ask | show | jobs
by signa11 1280 days ago
``` ... mainly because -- if left unchecked -- it fosters a culture of doing just barely enough to meet minimum requirements and no adherence or even ambition to achieving excellence and craftsmanship. ```

that is exactly my major gripe with TDD style development. It just seems too /incremental/ and smacks of prioritising getting /specific/ features done, rather than finding the best overall design. with this tactical style development, it is quite easy to end up with a mess.

1 comments

That's why I like the other TDD, type driven development. Lay out all your types and make unwanted states literally unrepresentable. For example, if you're making an email sending service, you can have an EmailAddress type that is represented underneath by a string and the only way you can instantiate a new EmailAddress is via the constructor function which will take a string, parse it and validate it as an email, and if it works, it returns the EmailAddress type, otherwise it returns None (if you're using a Result typed language). And the sender function only accepts an EmailAddress, not a string, so if your EmailAddress constructor returns None, you literally can't send the email, by design.

A good video on this concept: https://www.youtube.com/watch?v=1pSH8kElmM4

that ‘technique’ had a name ? never realized it. thank you kindly!