Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

OOP, encapsulation and bulk loading

Name: Anonymous 2010-07-04 19:10

So I have this class that represents a thing that can be created or loaded and saved, it's nice and encapsulated - it has a couple of properties that are private with public getters and setters. Nothing special, when I load this thing - properties get set directly, when I create it - I use property setters that do some sanitization and validation.

Now the question. I also, for performance reasons, need to bulk load these things.
1st, where could I put such method? It doesn't really belong on the things class, I mean static <Thing[]>Thing.Load(keys[]) doesn't look right at all.
2nd, how would I initialize these things? I don't want to use the public setters, because, as I mentioned, they do some checking that's necessary only the first time, when I'm loading it from the storage, everything is already sane. I also don't want to expose the properties publicly. Currently I have a constructor that takes all properties and sets them directly, but that's ugly.

Name: Anonymous 2010-07-08 14:46


     /   __/     /   __/     /   __/     /   __/     /   __/     /   _
__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/
  \__/  \     \__/  \     \__/  \     \__/  \     \__/  \     \__/  \
__/     /   __/     /   __/     /   __/     /   __/     /   __/     /
  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \_
     \__/  \     \__/  \     \__/  \     \__/  \     \__/  \     \__/
   __/     /   __/     /   __/     /   __/     /   __/     /   __/   
__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__ 
  \     \__/  \     \__/  \     \__/  \     \__/  \     \__/  \     \_
  /   __/     /   __/     /   __/     /   __/     /   __/     /   __/
  \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \_
__/  \     \__/  \     \__/  \     \__/  \     \__/  \     \__/  \   
     /   __/     /   __/     /   __/     /   __/     /   __/     /   _
__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/
  \__/  \     \__/  \     \__/  \     \__/  \     \__/  \     \__/  \
__/     /   __/     /   __/     /   __/     /   __/     /   __/     /
  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \_
     \__/  \     \__/  \     \__/  \     \__/  \     \__/  \     \__/
   __/     /   __/     /   __/     /   __/     /   __/     /   __/   
__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__ 
  \     \__/  \     \__/  \     \__/  \     \__/  \     \__/  \     \_
  /   __/     /   __/     /   __/     /   __/     /   __/     /   __/
  \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \__   \__/  \_

Name: Anonymous 2010-07-08 14:47


 |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___
    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|
_  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |
_|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_| 
 |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___
    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|
_  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |
_|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_| 
 |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___
    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|
_  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |
_|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_| 
 |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___
    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|
_  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |
_|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_| 
 |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___
    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|
_  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |
_|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_| 
 |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___
    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|_|    _|
_  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |___  | |
     |       |       |       |       |       |       |       |       |

Name: Anonymous 2010-07-08 14:47


_|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_  
 |       |       |       |       |       |       |       |       |   
    _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|
     |       |       |       |       |       |       |       |       |
_|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_  
 |       |       |       |       |       |       |       |       |   
    _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|
     |       |       |       |       |       |       |       |       |
_|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_  
 |       |       |       |       |       |       |       |       |   
    _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|
     |       |       |       |       |       |       |       |       |
_|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_  
 |       |       |       |       |       |       |       |       |   
    _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|
     |       |       |       |       |       |       |       |       |
_|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_  
 |       |       |       |       |       |       |       |       |   
    _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|
     |       |       |       |       |       |       |       |       |
_|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_     _|_  
 |       |       |       |       |       |       |       |       |   

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List