On 10/02/2012 19:41, Marvin Humphrey wrote:
As an academic exercise, though, I'd like to explore how Dump/Load might still
work under subclassing.
[...]
Therefore, we need to override Load() in the subclassed CaseFolder. We can't
invoke the super Load() method, but that's OK -- we can go through
CaseFolder_init() to flesh out the object:
CaseFolder*
CaseFolder_load(CaseFolder *self, Obj *dump) {
UNUSED_VAR(dump);
return CaseFolder_init(self);
}
From an academic point of view, this is ugly because it would break if
someone implements another set of Dump/Load methods in a parent class of
Normalizer (for example Analyzer) and expects them to be called from all
subclasses.
On the plus side, it would allow us to completely remove the Transform
methods of CaseFolder. But the methods are already there and we only
have to convert them to wrappers around Normalizer.
IMO composition is the most maintable approach, because it doesn't
require deeper knowledge of the Dump mechanism.
Nick