OOP, encapsulation and bulk loading
1
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.
22
Name:
Anonymous
2010-07-08 14:46
/ __/ / __/ / __/ / __/ / __/ / _
__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/
\__/ \ \__/ \ \__/ \ \__/ \ \__/ \ \__/ \
__/ / __/ / __/ / __/ / __/ / __/ /
\__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \_
\__/ \ \__/ \ \__/ \ \__/ \ \__/ \ \__/
__/ / __/ / __/ / __/ / __/ / __/
__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__
\ \__/ \ \__/ \ \__/ \ \__/ \ \__/ \ \_
/ __/ / __/ / __/ / __/ / __/ / __/
\__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \_
__/ \ \__/ \ \__/ \ \__/ \ \__/ \ \__/ \
/ __/ / __/ / __/ / __/ / __/ / _
__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/
\__/ \ \__/ \ \__/ \ \__/ \ \__/ \ \__/ \
__/ / __/ / __/ / __/ / __/ / __/ /
\__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \_
\__/ \ \__/ \ \__/ \ \__/ \ \__/ \ \__/
__/ / __/ / __/ / __/ / __/ / __/
__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__
\ \__/ \ \__/ \ \__/ \ \__/ \ \__/ \ \_
/ __/ / __/ / __/ / __/ / __/ / __/
\__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \__ \__/ \_
23
Name:
Anonymous
2010-07-08 14:47
|___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|
_ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_|
|___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|
_ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_|
|___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|
_ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_|
|___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|
_ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_|
|___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|
_ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_|
|___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___
_|_| _|_| _|_| _|_| _|_| _|_| _|_| _|_| _|
_ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |___ | |
| | | | | | | | |
24
Name:
Anonymous
2010-07-08 14:47
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|
| | | | | | | | |
_|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _|_
| | | | | | | | |
Newer Posts