Got some Octal hacking done... made some nice
simplifications. I realized that the
engine_commands thing was getting too complex. I
had a group of functions all with the same calling
convention, and an array of pointers to them whose order
matched an enumeration, and a dispatch function to call the
appropriate handler for a message that basically packed the
arguments and one of the enum values into a struct. Then I
realized how complex this was going to get when both the
core thread, AND multiple objects (different views) in the
UI were going to react differently to the same messages.
So now the whole chebang is replaced with each "class"
having one function to respond to all the messages (they all
had the same prototype anyway.) A switch statement makes the
right behavior happen according to which message is being
recieved. It's not a traditionally accepted OO technique,
that's for sure---switch statements are seen as a sign of
improper OO design by some people. But I can't express how
much simpler this is when written as a switch
statement. All the message behaviors for a "class" are
contained within a single function. The code that can be
executed by user requests is clearly separated from internal
helper functions that shouldn't be accessible to outsiders.
And the function prototype is not repeated 13 times anymore,
just once for the whole interface function.
I have never found inheritance interesting or useful
other than to implement interfaces. This is especially
convenient now that I'm back to plain C, since C is good at
interfaces and little function packages (but not so good at
inheritance.) Decoupling inheritance and polymorphism seems
like a win. I guess this is what people mean when they say
"inheritance breaks encapsulation." But that doesn't mean
it's all bunk.
Last night
at 4 AM I installed RH7, wiping out my root partition in
the
process. I kept all my /home files, as they were on their
own section. Now I have a three-partition setup, for /,
/usr/local, and /home.
What a mess, though. Here's what I have to do to get back
to normal:
- install kernel 2.4
- install XF86 4.0.2
- install USB Graphire tablet drivers
- Install Gimp 1.2
- possibly install Eazel even though it requires 2^73
other packages
- install Blackbox
- install Helix-Gnome but then undo most of the things it
does (auto X startup etc) and NOT run sawfish
- set up soundcard
- set up GPM for Graphire
- set up my usb joystick
- set up Kerberos for use with my GNU account
- see if I can get some 3-d support going
This time I need to do things right.... making proper
backups of config files, and making notes on installation
processes so that I can remember how I did things. I know
I'll need to re-learn how to install the Graphire device,
and tweak the settings.