More Thoughts on Language Support of TDD
Thinking about my earlier post discussing the OOP vs TOOP problem, I mentioned at the end that the best solution to this problem in my mind would be integrated language support for test classes. Specifically, a way to let the Compiler/Runtime know that a specific class is a test class, and should therefore be able to access any and every property of a class. It occurred to me that such blatant intrusion into the privacy of a class is not unknown in the programming world. C++ has the notion of a “Friend” class. This is a class that can access all members of another class regardless of their protection level. To keep things civil, so that just any class can’t declare itself to be a Friend of any class it wants, the class that the Friend class would be accessing would declare specifically that classes X, Y and Z are fiends, and so can have free reign. Granted this is considered to be rather scary, and one of those features that makes C++ an ideal tool for shooting ones own foot off. ...