OpenAmiga (749/964)

From:Aaron Optimizer Digulla
Date:21 Sep 2000 at 11:40:05
Subject:Re: AMIOPEN: Hotkey Config/Need suggestions

On Thu, Sep 21, 2000 at 01:53:13AM -0700, Patrick Roberts wrote:

> > *Argh* Use hashes, man ! That's what they are for !! Check the Ami docs for
> > hash and atoms.
> This sounds simpler, faster, and more effecient than reading a config
> file and applying formatted strings to an array based on a checksum
> criteria to you? How did you get your middle name, man! *Argh*

You will know when you have to add another item to your config :-)
My approach is much more flexible and error-proof. Also, the
"based on a checksum" is basically hashing.

The whole point is that config support for applications has a
certain set of properties which you must fulfill or you will
run into lots of trouble later. While it might be worthwile
to save a few bytes per config item, that will invariantly
limit what you can do. Also, the config is read only once so
this doesn't have to be very fast (so in the end, it's faster
when you have less work rather than when the code which uses
it saves a few cycles). Also, by reusing a lot of existing code,
you avoid introducing bugs which you would have to fix (costs
extra time).

Or as in my old signature: to optimize means to choose
a better algorithm. And for config files, you need maximum
flexibility, ease of use, it must be possible to modify them
with existing tools (so no need to write a new tool which
must mature), they must be understandable at first glance
(otherwise, you must write documentation), etc.

My conclusion: Using a 1:1 static mapping for config items
will not solve your problem. It will just look like it would
do and you will notice the flaws and limitations later. Then,
you will try to fix them by adding additional code which makes
it more complex and will finally lead to "code rot".

Always remember: When designing software, there is always at
least one important item that you don't know. So always work
with the least possible effort. If it works, you have not
wasted any time. If it doesn't, then you will not have wasted
too much time on something that doesn't work.



==============================================
Sowatec AG, CH-8330 Pf�ffikon (ZH)
Witzbergstr. 7, http://www.sowatec.com
Tel: +41-(0)1-952 55 55
Fax: +41-(0)1-952 55 66
----------------------------------------------
Aaron "Optimizer" Digulla, digulla@sowatec.com
==============================================
Subscribe/Unsubscribe: open-request@amiga.com
Amiga FAQ: http://www.amiga.com/faq.html