Hi,
I am trying to find a design pattern for application level constants/globals. Basically, database stores some integer value - which has to be mapped to corresponding text and back.
e.g.:
Display Text text used by program Table stored value
------------ -------------------- ------------------
3 Cheese threeCheese 10
Pepperoni pepperoni 20
Red Onions onion 30
Green Peppers greenPepper 40
BBQ Chicken bbqChicken 50
Is there any design pattern/guideline that will let me do this 3 way mapping? Solution I am thinking of involves having 2 hash tables - but I think it has to be easier than that.
Thanks,
- PI
-
design pattern for application level constants/globals (1 messages)
- Posted by: P I
- Posted on: March 23 2005 13:48 EST
Threaded Messages (1)
- design pattern for application level constants/globals by Rakesh Malpani on March 24 2005 17:22 EST
-
design pattern for application level constants/globals[ Go to top ]
- Posted by: Rakesh Malpani
- Posted on: March 24 2005 17:22 EST
- in response to P I
May be you should try creating a datastructure containing all the three values..
Then all you have is an array of the dataStructure, and on itereating the array, you can map from any type to any type.
Hope this helps.
Thanks,
Rakesh.