So, what brought on those musings on complexity? There’s a bug in the recent public release of The Server Framework code. It’s in one of the example servers. Some code got snipped out and it shouldn’t have been and the result is a memory leak. The code in question doesn’t have tests, but that’s not the point, it would be hard to write automated tests that would have caught the problem due to the fact that I, as a designer, made an unchangeable decision for the user of the code.
Most of my code uses
delete to allocate and release dynamic memory. Because the code uses the memory allocator directly it’s hard to instrument during testing. Sure I could purchase a third party instrumented heap and link my apps with that; but I’m not convinced that’s the best route as that smells of hidden complexity. The alternative is to abstract the memory allocation into an interface and provide it explicitly to objects that manage dynamic memory; and that increases obvious complexity.
More thought needed…