Sealed classes - would you want them in D?
Neia Neutuladh
neia at ikeran.org
Sat May 12 15:18:32 UTC 2018
On Saturday, 12 May 2018 at 06:42:24 UTC, rumbu wrote:
> Testing private functionality means that you *lock* the
> internal implementation of your class. If you decide later to
> change the implementation, your previous tests will have
> zero-value.
I did TDD at a company for three years. Tests didn't survive
refactoring.
These days, I have tests to ensure correctness, and they can tell
me when public interfaces change. I usually don't need tests to
tell me that, but they help just in case.
I also tend to have examples projects for anything more complex,
which reduces the amount of trouble I can get myself into. Plus
the majority of my code is in applications rather than libraries,
so consistent interfaces aren't nearly as important (as long as
static typing catches the majority of incorrect calls and
contracts catch the rest).
More information about the Digitalmars-d
mailing list