in reply to Re: Advice on OO Program structure & organization
in thread Advice on OO Program structure & organization
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Advice on OO Program structure & organization
by exussum0 (Vicar) on Dec 11, 2004 at 16:33 UTC | |
|
Re^3: Advice on OO Program structure & organization
by Anonymous Monk on Dec 13, 2004 at 17:04 UTC |