T
Tomer Ben-David
Hi
In his book "Refactoring improving the design of existing code" martin
fowler writes about the bed smell "Parallel Inheritance Hierarchies".
Lets take this for example :
Person
Student extends Person
Employee extends Person
Now lets say I want to turn those classes into XML, adding the XML to
the Person/Employee/Student classes themselvs could be a possibility
but in real world (at work) those classes tend to grow (and lets
assume for the sake of the example i dont use jaxb etc...), so I would
like to have this functionality out of these classes, in something
that looks like
PersonXMLHelper
StudentXMLHelper extends PersonXMLHelper
EmployeeXMLHelper extends PersonXMLHelper
However Now I have the bed smell "Parallel Inheritance Hierarchies".
Can anyone suggest a better simple design? I come across this problem
over and over again...
Thanks
In his book "Refactoring improving the design of existing code" martin
fowler writes about the bed smell "Parallel Inheritance Hierarchies".
Lets take this for example :
Person
Student extends Person
Employee extends Person
Now lets say I want to turn those classes into XML, adding the XML to
the Person/Employee/Student classes themselvs could be a possibility
but in real world (at work) those classes tend to grow (and lets
assume for the sake of the example i dont use jaxb etc...), so I would
like to have this functionality out of these classes, in something
that looks like
PersonXMLHelper
StudentXMLHelper extends PersonXMLHelper
EmployeeXMLHelper extends PersonXMLHelper
However Now I have the bed smell "Parallel Inheritance Hierarchies".
Can anyone suggest a better simple design? I come across this problem
over and over again...
Thanks