• Post Reply Bookmark Topic Watch Topic
  • New Topic

Typesafe  RSS feed

 
Steve Rodgers
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This 'best practices' question.

To ensure I am getting what is expected, I try to follow Joshua Bloch's type safe enum pattern. Yesterday, a coworker told me to use the database to ensure I get the value expected. Her point was, it can only return what is in the database so it is as safe or safer than the type safe pattern I was using.

So, in an ideal world, which solution would you choose? I'm sticking with the type safe enum pattern. It is much more flexible and just as easy to program.

Capt.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand at all how a database could replace the Typesafe Enum pattern. Could you please elaborate?
 
Steve Rodgers
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry. When I reread it I saw that I wasn't clear. YOu are correct. One thing has nothing to do with the other. I smushed about 5 things on my mind into one incoherent postings.

It's a property file versus a look up question. I'm going to use a property file.

Sorry again.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There could be overlap here. There was a thread in the OO, UML etc forum (maybe still going) about using the database for code-value pairs vs code. As in most arguments, the answer depends on other conditions. See if that other thread sheds any light.
[ July 25, 2004: Message edited by: Stan James ]
 
Steve Rodgers
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I'll check it out for ideas.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, I could not find that other thread after I suggested reading it. I'll post a link if I run across it again. Maybe you'll have better luck than I did looking for it!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!