Pseudocleverness

Time for another rant and a word I made up to describe a trait I particularly dislike. In a sense, it's experience/knowledge vs intelligence. Obviously the best kind of hire has both, but if you can only pick one I'd go for intelligence every time. When doing something new, it's intelligence that counts. If you're doing something again, knowledge or experience without proper understanding most likely means doing the same thing as last time, choosing a bad-fitting solution, and not learning from mistakes. So...

Pseudocleverness is what I'm calling the habit of suggesting a clever-sounding solution when the obvious, straightforward solution would do immeasurably better. The clever solution is never an original idea. It's a cool trick that has its place, which is then misapplied by someone who wants to show off, without actually thinking about the problem at hand and its suitability.

For example:

  • Don't use stacks for storing your scoped data. Region-based allocators are very cool and efficient. Never mind that stack-based allocation keeps exactly the right amount of data around, has very good locality of reference, can be implemented in a few assembly instructions, and is pretty universally supported. If you're playing with continuations and closures you may want something different, but that wasn't what was under discussion.
  • Don't use smart pointers in C++. Good design can control ownership explicitly, and anyway smart pointers can leak with cyclic references. We use smart pointers precisely because they stop the need for very careful design to control ownership. They are simple and straightforward, and pretty much universally used in the area that was under discussion. Those not using smart pointers aren't using them because they haven't started using them, not because they've switched away. In a new library planned for years of evolution where we have const data objects which form a DAG, not using a reference-counted shared pointers to manage the lifetime of these objects is nutty.
  • When creating interfaces in C++, don't use abstract base classes. Instead, use complex templates to create tables of function pointers to non-virtual functions, making the interfaces rather more like traits on the objects. Fundamentally, reimplement virtual functions manually. 'nuff said.

Posted 2010-09-29.