2008 Exam answers
From CSSEMediaWiki
(Difference between revisions)
(New page: == Question 1 == Possible improvements to the design: * Replace the Pair class with a Transaction class and two subclasses CreditTransaction and DebitTransaction. These classes will conta...) |
(→Question 1) |
||
Line 3: | Line 3: | ||
* Replace the Pair class with a Transaction class and two subclasses CreditTransaction and DebitTransaction. These classes will contain the information that was contained in Pair, and any other behavior related to transactions which is likely to have leaked out into the rest of the system. | * Replace the Pair class with a Transaction class and two subclasses CreditTransaction and DebitTransaction. These classes will contain the information that was contained in Pair, and any other behavior related to transactions which is likely to have leaked out into the rest of the system. | ||
**'''Violations:''' name unknown; something related to a class capturing behavior as well as holding data | **'''Violations:''' name unknown; something related to a class capturing behavior as well as holding data | ||
+ | * Replace Stock class with CompanyStock and OwnedStock. These classes will not share a common super class as they differ greatly in what they represent. | ||
+ | **'''Violations:''' [[Single responsibility principle]] |
Revision as of 00:17, 17 July 2009
Question 1
Possible improvements to the design:
- Replace the Pair class with a Transaction class and two subclasses CreditTransaction and DebitTransaction. These classes will contain the information that was contained in Pair, and any other behavior related to transactions which is likely to have leaked out into the rest of the system.
- Violations: name unknown; something related to a class capturing behavior as well as holding data
- Replace Stock class with CompanyStock and OwnedStock. These classes will not share a common super class as they differ greatly in what they represent.
- Violations: Single responsibility principle