[thelist] Unique combination numbering

Joshua Olson joshua at waetech.com
Fri May 7 10:18:35 CDT 2004


> -----Original Message-----
> From: João Verde
> Sent: Friday, May 07, 2004 10:41 AM

> Is there a (simple) mathematical approach to this?
>
> Thanks in advance. I'm puzzled. %-)

A lot of people have suggested using individual bits to represent the state
of the flags.  While I agree that this is a very fundamental way to store
these values, computationally speaking, I wouldn't agree that this is the
correct way to proceed.

This sort of system could ultimately impede development down the road.  What
if, for example, you decide to go tinyint (8-bits) as David has suggested...
if the number of options grows passed 8, then you are in trouble.

What if the ordering of the options needs to change?  Unless you know that
"River" is always the 5 bit, regardless of presentation in the UI, then you
are ok.

How difficult is it to generate complex queries on this data where you are
searching for criteria?  Not really that difficult if you know boolean math,
but it could prove to be difficult for some new maintainer should you leave
the project.

What if.. what if what if...

These sorts of systems are great IF you can promise that the number of
options won't change--such as the permissions flags for *nix.  If the number
of options DO change, or may change, then you will want to look at more
traditional relationship cross-referencing table schemas.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168




More information about the thelist mailing list