Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design issue in association class section #45

Open
rmmilewi opened this issue May 8, 2018 · 1 comment
Open

Design issue in association class section #45

rmmilewi opened this issue May 8, 2018 · 1 comment

Comments

@rmmilewi
Copy link

rmmilewi commented May 8, 2018

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.

@damithc
Copy link
Contributor

damithc commented May 8, 2018

Good point @rmmilewi Thanks for raising it. 👍
Will incorporate it in the next revision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants