Cypher

I’m currently working with a corporate client. The plan is that I’ll help them refactor a key component in their system and make it more robust and increase performance. Right now they’re in the middle of a release and are in ‘slip mode’. I find myself feeling some sympathy for Cypher from The Matrix; there I was, safe in my green-tinted world of TDD, then suddenly I find myself in “The real world” and it’s nasty and messy and there aren’t any tests.

Adding layers without adding value

I’m a great fan of wrapping stuff up with thin layers that make the wrapped code easier to use in a given circumstance, or to provide a more appropriate interface. Obviously there are other reasons to wrap APIs but I’m continually amazed at how often the wrapping fails to add much value. Take the humble Win32 Event API. It’s a fairly standard C API that uses an opaque handle to allow you to manipulate an event object.

These are not the containers you're looking for

STL containers are great. Rather than have to worry about writing doubly linked lists, efficient maps, and other such data structures you just grab one from the STL and you’re away. Unfortunately the STL containers have quite a large ‘surface area’. Their interfaces are rich because they are generic containers. Often the container you actually need is much more limited in scope and in such situations I always find it’s worth wrapping the STL container and providing a more appropriate interface to the user.

Thought for the day

If you don’t write the code are you doomed to forever be thinking that the abstraction is all in the wrong place? Another day, another dollar. Starting with a new client, well starting back with an old client, and doing that ‘get your head around the source’ thing…

POPing back

Way back in mid November, before we dumped our building’s managing agent for being worse than useless and possibly stealing from us, I was working on some POP3 code. I had some down time today so I decided to drop back into it and see if I could move things along a little. In summary, having lots of tests helped… I haven’t done any development on the POP3 code for 3 months.

We'll be right back, after this word...

Surprisingly enough the Bluetooth server “technology preview” has generated quite a bit of interest from potential clients, which is nice. In a similar spirit, I’m making the compiled version of our server that uses the OpenSSL Toolkit available for download. This code uses our freely available IOCP server framework and adds SSL support using OpenSSL. We have an SChannel version in the pipeline for those of you who don’t want to have anything to do with OpenAnything…

Most interesting present

My birthday lasted all week, which was good. I celebrated on the day at Strada in upper street, on Friday at the Almeida and on Saturday at Curry Special. Thanks for all the wonderful presents. Right now the most “interesting” is probably the Vew-Do balance board that Chris and Hilary bought me… I’d really noticed a big improvement in my skiing from the extra balance work that I’d done during the summer on roller blades.

An abstraction too far

Today turned into a day for pondering complexity, abstraction and memory management and watching Pirates of The Caribbean on DVD… I experimented with a version of the buffer allocator that allowed a user defined memory allocation policy. It worked, but it was, I think, unnecessarily complex. If the buffer allocator itself lay behind an interface then that’s enough flexibility. Additional abstraction, with an abstract allocation policy in addition to an abstract allocator seemed a tad too abstract… At some point you have to actually make the decision and write the code that does the work.

More on the bug

As I mentioned earlier, I found a memory leak in a piece of code and was lamenting the difficulty in providing automatic tests for such a think when you use new and delete directly. I’ve thought about this some more and I’m now slightly less concerned… The bug was in the one place that I wasn’t using some form of factory to manage dynamic allocation. I was allocating a ‘per socket’ data structure when a connection was established and supposed to be deleting it when the socket was released; I wasn’t.