Keyboard Shortcuts
Likes
Search
A worked example of TDD in D, with some personal ruminations on my own style, and notes on the D language..
So I have being doing TDD for years now. But I started noting I tend not to do it exactly "By The Book".?Conclusions from the exercise.
Bottom Line?In future I will be doing...
What do I mean by provocative test cases? For example, when converting Roman numerals.
"I" is provocative. "II" is provocative. "III" is NOT provocative, it merely is extra Lines of Code (and hence a liability). "IV" is provocative, but a bad choice for next test case as it adds two new behaviours at once. "V" is provocative and adds a single new behaviour. "IV" is now provocative and adds only a single new behaviour. ? Conclusions about D.?I love it. ?It is C / C++ with the worst stuff removed, and the best stuff stolen from it's competitors. ?If you are serious about industrial grade, high quality, defect free, efficient programming, you urgently need to be looking at D as your next language. ?Sigh! Unicode. ?That's not D's fault. ?D handles Unicode remarkably smoothly, but ye ancient 7bit ASCII is always going to be faster and conceptually easier than variable length code point UTF8. ?It took a bit of time and effort to get my head around D's template system (richer, safer, better than C++) ?It took even more time to get my head around Ranges, (again, richer, more flexible, safer than C++ iterators, more efficient than generators, coroutines or enumerators.) ?The choices D has made are rich in very powerful, very efficient implications. Possibly the most striking is Compile Time Function Evaluation. If it can be evaluated at compile time.... in D it will be. And that is startling powerful. -- John Carter
Phone : (64)(3) 358 6639 Tait Electronics? ? ? ? ? ? ? ? ?? ? ??? PO Box 1645 Christchurch New Zealand This email, including any attachments, is only for the intended recipient. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission. If
you are not an intended recipient, you may not use, disseminate,
distribute or reproduce such email, any attachments, or any part
thereof. If you have received a message in error, please notify the
sender immediately and erase all copies of the message and any
attachments. Unfortunately, we
cannot warrant that the email has not been altered or corrupted during
transmission nor can we guarantee that any email or any attachments are
free from computer viruses or other conditions which may damage or
interfere with recipient data, hardware or software. The recipient
relies upon its own procedures and assumes all risk of use and of
opening any attachments. |
Pity I didn't see this blog post first.... Because then I would have defined "Provocative Test that adds one new Behaviour" as one that provoked one new behaviour in the precedence order suggested by Uncle Bob.?? On Mon, Dec 30, 2013 at 9:40 AM, John Carter <john.carter@...> wrote:
--
John Carter
Phone : (64)(3) 358 6639 Tait Electronics? ? ? ? ? ? ? ? ?? ? ??? PO Box 1645 Christchurch New Zealand This email, including any attachments, is only for the intended recipient. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission. If
you are not an intended recipient, you may not use, disseminate,
distribute or reproduce such email, any attachments, or any part
thereof. If you have received a message in error, please notify the
sender immediately and erase all copies of the message and any
attachments. Unfortunately, we
cannot warrant that the email has not been altered or corrupted during
transmission nor can we guarantee that any email or any attachments are
free from computer viruses or other conditions which may damage or
interfere with recipient data, hardware or software. The recipient
relies upon its own procedures and assumes all risk of use and of
opening any attachments. |