Thursday, November 29, 2007


My previous rant was in response the frustration that built up while I was reading various standards documents and also using some ACE code [1]. In the interests of simplicity, however I should have just quoted Stephen Dewhurst from his book C++ Common Knowledge:

It's surprising how much of advanced object-oriented programming is basic common sense surrounded by impenetrable syntax.


[1] Pop quiz: An ACE_Map_Manager does not "manage" maps, it is a map. A map is a useful container for data. There are a couple of ways to describe the function it provides:

As a map: Given a key, map that into a corresponding value.
As a dictionary: Given a word, provide a definition.
As an associative array: Given an index of arbitrary type, return the associated value.

These points of view are equivalent (although the dictionary view implies that keys and values are text which is too restrictive). They describe useful ways to think about ACE_Map as a tool for solving a real programming problems. In each case there are two interesting values: The key (or word, or index), and the associated value (or definition).

In ACE, these are called int_id and ext_id (not necessarily in that order).

Question: Which one is the key and which one is the value?

Hint: int stands for internal (not the C++ data type int); and ext stands for external.

So int_id must be the data that is stored inside the map and ext_id is name the external world uses to get to that data.

No, now that I think of it int_id is the name used internally to identify the data and ext_id is the data that is of interest to the external world.


Answer: I have no idea. I have to look it up (in the code because the documentation doesn't help!) every time I use an ACE_Map or else find some existing code that uses it and copy/paste it into the code I am writing.

Extra Credit Question: ACE has been around well over ten years now and is used in thousands of applications. How many programmer-years have been wasted trying to remember which "id" is which?

1 comment:

Eric Burke said...

Not as many programmer years as we've wasted dealing with CRLF versus LF. I guess the names "key" and "value" were taken.