[Gambas-user] Weird, yet again. Two way access to a collection. (not really a gambas issue)
Bruce
adamnt42 at gmail.com
Wed Nov 21 09:54:55 CET 2018
This has been bothering me for some years.
It's fairly simple. We have a set of status codes that we use across
many applications. They are numeric (integer) and have a code (the
number), a mnemonic (short string) and an "explanation" (i.e. a user
interpret-able string that describes the status "in full".
Here, there and everywhere within an application we need to set the
status code of something. Fairly plainly some method returns an integer
value that reflects the current status. Bing bong. But, in order to do
that we have to know from memory, when maintaining the code for that
some method, that "if this happens, then return 617" or whatever. This
is a pain.
So, I'm trying to come up with some way that I could make a module in a
library that would let us access the status codes EITHER by the code or
by the mnemonic. I can neither get this clear in my mind conceptually
nor implementation-wise.
(EXAMPLE) Let's say we have an Ice Cream Parlor POS application that is
loosely connected to the inventory "system". If a situation occurs where
there is no chocolate ice cream in stock then, when the POS operator
presses key 4617 (a chocolate ice cream) then it would display
"Chocolate Ice Creams are out of stock today, offer another flavor". So,
code 1329 = that explanation, but when I'm coding I'd like to specify
the status as "NO_CHOC" rather than go search through a bunch of design
documents and other stuff to find the right status code to use. I hope
that makes sense, it's the simplest explanation I can think of. By the
way, in reality we have around 1600 specific status codes in our
systems. So I am really hoping that someone has a good idea here.
tia
Bruce
More information about the User
mailing list