'Static/Constant' business ojects

Posted by UpTheCreek on Stack Overflow See other posts from Stack Overflow or by UpTheCreek
Published on 2010-05-25T08:36:01Z Indexed on 2010/05/25 8:41 UTC
Read the original article Hit count: 225

Filed under:
|

I don't quite know how to ask this question, so I'll phase it as an example:

Imagine in an application you have a Country object. There are two properties of this object: Name, and a 'Bordering Countries' collection. More properties might be added later, but it will be the kind of information that would change very rarely (e.g. changes of country names/borders)

Lets say this application needs to know about all of the countries in the world. Where would you store these object's state? How would you new them up? It seems silly to store all this state in the DB, since it won't change very often.

One option might be to have an abstract 'country' base object, and have a class for each country inheriting from this with the details of each country. But this doesn't seem quite right to me.

What is the proper way of dealing with these kinds of objects?

© Stack Overflow or respective owner

Related posts about oop

Related posts about object-oriented-design