I too prefer this approach. Most of my object constructors take a list of pairs of attributes, check them for sanity, and set useful defaults if needed. They don't load or save or anything like that.
Instead, I use an external class that knows how to load, save, and instantiate many types of objects. In pattern language, this is a Factory.
It's especially nice because it aggregates the loading and saving into one place, conceptually unrelated to the objects themselves, which otherwise would have non-behavioral code mixed in with normal methods. It also allows the flexibility to change the serialization format almost trivially.
In reply to Re^2: Advice on OO Program structure & organization
by chromatic
in thread Advice on OO Program structure & organization
by yoda54
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |