…in the punchbowl

2007.02.06

Too many dependencies

Filed under: c++, nits, programming — Matt @ 8:36

At work I’m integrating a library from our new corporate overlords into an existing application. I use 5 (count ’em, 5) functions from the library. In order to work, the library, which I’ll call libsink, requires between 10-20 other libraries, most of which appear to have nothing to do with the purpose of libsink I am using. This, to use a technical term, smells bad.

I probably wouldn’t care so much if I hadn’t discovered a symbol collision between the libraries on which our application is newly dependent and another library (libgoo) we use. Two different functions, two different libraries, with different semantics, but the same signature — meaning libsink will happily try to use the function from libgoo. Unfortunately, this results in a core dump when the application unloads.

So, if you’re writing libraries (especially in C, where there is only a global namespace):

  • Please keep your dependencies to a minimum; why should I need code to perform higher order calculus in order to print something to the screen?
  • If you’re going to write utility functions that may have names other libraries may use (like, say print() or open()), prefix the function with a string to uniquely identify it and prevent users from accidentally using the wrong function.
Advertisements

2006.09.10

A nit for today

Filed under: English, grammar, nits, punchbowl — Matt @ 9:47

I’m in an annoyed mood today–and I’m also feeling generous, so I’m going to share. Today’s category is Stupid English Style Rules. I believe this only applies to us Yanks, so the rest of the English-speaking world may be off the hook.

The burr in my behind: adding punctuation to quotes when it doesn’t belong.

For example:

“You stink,” she said.

The comma is not part of what she said.

I so detest this rule I ignore it as often as possible.

Blog at WordPress.com.