From: stephan b. <st...@s1...> - 2004-12-29 21:02:27
|
On Wednesday 29 December 2004 21:37, stephan beal wrote: > Keep the container types free of deps on i/o. They are containers, > not stream marshallers. Sorry, i should have explained my reasoning, instead of just making a general statement like that. First off: yes, the design of putting save/load funcs in such a type's API is quite common, and does make sense, OO-wise. As far as code reusability goes, though, it ends up biting you later on. i can't count how many Prefs-style objects i've implemented, and put load/save support in them, and then never used that support (or took it out while porting the object to another tree). If you can find a copy of it (i don't think it's on the web), read Herb Sutter's "What's in a Class?" article. While i'm not a huge fan of Herb's work in general, that particular article changed the way i program, in particular in cases such as Prefs. s11n's design was massively influenced by that article. In any case, i'll try to remember to bring the book with that article ("More C++ Gems") when we meet. :) -- ----- st...@s1... http://s11n.net "...pleasure is a grace and is not obedient to the commands of the will." -- Alan W. Watts |