2006 Exam answers
Contents |
Question 1
[4 marks for whole question] Provide a name (and if possible a wiki or web page reference) for each idea (a)-(d):
- [1 mark] An approach for executing parse trees.
- Answer:
- [1 mark] It is better to use abstract classes than concrete ones.
- Answer:
- [1 mark] Design documentation is essential.
- Answer:
- [1 mark] A pattern containing a class called Quantity.
- Answer:
Question 2
[28 marks for whole question] For each of the following descriptions (a) – (g):
- [1 mark each] Name a maxim (or pattern, code smell, etc) that captures
the idea.
- [1 mark each] Explain the rationale for this maxim (i.e. why the maxim
exists).
- [2 marks each] Comment on the validity and value of this maxim.
- [4 marks] Domain model objects should not access user interface objects.
- Answer:
- [4 marks] A class should not access its subclasses.
- Answer:
- [4 marks] If a class is unlikely to change, it should be abstract.
- Answer:
- [4 marks] Don’t initialise attributes in constructors; instead, initialise them the first time a getter is called.
- Answer:
- [4 marks] Structure code so that a foo() method in some object calls foo()methods in other objects.
- Answer:
- [4 marks] A maxim violated by the Observer pattern.
- Answer:
- [4 marks] Don’t write getters that return fields that can be changed.
- Answer:
Question 3
[5 marks] If you could nominate one person to receive a lifetime achievement award for services to OO design, who would you choose, and why?
- Answer:
Question 4
[5 marks] Some designers suggest that it is a good idea to always declare separate interfaces from implementations, so that no class ever uses an implementation class directly; instead it uses only abstract interfaces. Is this a good idea? Justify your answer.
- Answer:
Question 5
[23 marks] See Frogs design 2
Question 6
[10 marks] What conflicts or differences of opinion can be detected between the ideas of ArthurRiel1996 and KenAuer1995? Do the underlying philosophies of the authors differ? Justify your answers, and where possible, support them with evidence from the papers.
- Answer: