You're right m4ster r0shi -- I lied. Actually, most of my programs look like this:
1 2 3 4 5
|
//#include <every boost library imaginable>
int main( int argc, char* argv[] ) {
return boost::bind( &rest_of_program, argc, argv )();
}
|
Seriously though, I like short (non polymorphic) solutions not just because of their elegance,
but also because the less details I have to remember, the better.
I wrote a "simple" system using inheritance where I could build packets of a layered protocol
in place. It truly was simple. You have a buffer. You construct the top-most protocol object
on the buffer and fill out its fields. Then you construct the next protocol layer object on the
buffer and fill out its fields, and so forth. When I wrote it, it was simple. I could add new
messages in a minute.
Several years later, I look back at all the inheritance, and its no longer that simple to me.
I don't remember all the details of what was going through my mind.
Several years ago, I converted that code to use serialization to build the packets. All
the "internal" base classes went away, leaving only one non-inherited class for each
message. Even now, I think I can remember all the details, because, well, there aren't
really many details to remember.