Hi there! I was looking through your online book, and I wanted to point out that there's a design issue in the section on inheritance. From the text:
However, the two classes cannot be simply replaced with a more general class Person because of the need to distinguish between Man and Woman for the ‘marriage’ association. A solution is to add the Person class as a super class and let Man and Woman inherit from Person.
Given that same-sex marriage is legal in most of the developed world, distinguishing between Man and Woman in the class Marriage makes the implementation fragile to changes in requirements. A more robust solution is to use the type Person.
This is actually a really good example of how untested assumptions that we as software engineers make can come back to haunt us later. This could be a good object lesson on the need for requirements analysis.
Hi there! I was looking through your online book, and I wanted to point out that there's a design issue in the section on inheritance. From the text:
Given that same-sex marriage is legal in most of the developed world, distinguishing between
ManandWomanin the classMarriagemakes the implementation fragile to changes in requirements. A more robust solution is to use the typePerson.This is actually a really good example of how untested assumptions that we as software engineers make can come back to haunt us later. This could be a good object lesson on the need for requirements analysis.