2007 Exam answers
m |
m |
||
Line 23: | Line 23: | ||
#: ''Answer:'' [[Avoid no-op overrides]], [[Composite]] | #: ''Answer:'' [[Avoid no-op overrides]], [[Composite]] | ||
# (k) [2 marks] A pattern that exhibits a CodeSmell. | # (k) [2 marks] A pattern that exhibits a CodeSmell. | ||
− | #: ''Answer:'' [[Iterator]], [[Parallel hierarchies smell]] | + | #: ''Answer:'' [[Iterator]], [[Parallel inheritance hierarchies smell]] |
# (l) [2 marks] An architectural pattern that contains a design pattern. | # (l) [2 marks] An architectural pattern that contains a design pattern. | ||
#: ''Answer:'' [[Observer]] + [[Strategy]] = [[Model view controller]] | #: ''Answer:'' [[Observer]] + [[Strategy]] = [[Model view controller]] |
Revision as of 03:56, 6 October 2008
Contents |
Question 1
[26 marks for whole question] For each part (a)-(m), name the idea (or ideas) that best match the description and briefly explain your answer. If possible, include WikiNames.
- (a) [2 marks] Keep the number of fields in a class small.
- Answer: One key abstraction, Large class smell
- (b) [2 marks] Methods should use most of the fields of the method’s object.
- (c) [2 marks] When several methods cooperate to do a job, give them the same name.
- Answer: Recursion introduction
- (d) [2 marks] Objects should invoke methods of contained objects.
- (e) [2 marks] A CodeSmell that supports one of RielsHeuristics.
- (f) [2 marks] A pattern that conflicts with TellDontAsk.
- Answer: Observer
- (g) [2 marks] A pattern that supports TellDontAsk.
- Answer: Factory Method
- (h) [2 marks] A pattern that employs DoubleDispatch.
- Answer: Visitor
- (i) [2 marks] A pattern based on ModelTheRealWorld.
- Answer: Composite, Model view controller
- (j) [2 marks] A pattern that conflicts with one of RielsHeuristics.
- Answer: Avoid no-op overrides, Composite
- (k) [2 marks] A pattern that exhibits a CodeSmell.
- (l) [2 marks] An architectural pattern that contains a design pattern.
- Answer: Observer + Strategy = Model view controller
- (m) [2 marks] A design problem that the Waterfall Process was intended to fix.
- Answer: Big ball of mud
Question 2
[10 marks] Which of RielsHeuristics can be traced back to ideas described in JohnsonAndFoote1988? For each heuristic you identify, explain how it is based on the earlier idea.
- Answer:
Question 3
[16 marks for whole question] For each of the following maxims (a)-(d) name other maxims (as many as you can) that support it. Briefly explain each answer.
- [4 marks] ProgramToTheInterfaceNotTheImplementation.
- Answer:
- [4 marks] SeparationOfConcerns.
- Answer:
- [4 marks] SoftwareReuse
- Answer:
- [4 marks] OpenClosedPrinciple
- Answer:
Question 4
[8 marks for whole question] Describe a design flaw in a 427 project produced by one of your classmates. Choose the most serious flaw you can find, clearly describe where it occurs (including where it can be found in the wiki) and support your argument, where possible, with maxims etc.
- Answer:
Question 5
[5 marks] Imagine it was your job to interview an applicant for an OO design job. If you were allowed to ask only one question, and from the answer you had to judge whether the person was a skilled OO designer, what would you ask? Explain your reasoning.
- Answer:
Question 6
[35 marks for whole question] See Trains design.