Exam Question: Which design pattern is implemented in the following code snippet?

Moderatoren: pmueller, SE - Design and Construction

Benutzeravatar
AizazZaidee
BASIC-Programmierer
BASIC-Programmierer
Beiträge: 106
Registriert: 20. Apr 2016 22:49

Exam Question: Which design pattern is implemented in the following code snippet?

Beitrag von AizazZaidee » 1. Jul 2018 11:50

3. Which design pattern is implemented in the following code snippet? (1P)
// Library
trait IntPair {
def left: Int
def right: Int
}
// Your application
class IntPoint(p: IntPair) extends Point {
def x = p.left
def y = p.right
}

Hi,
I have seen this question in some old exam uploaded by professor. How to identify a design pattern, as there is no diagram or responsibility of class or any method documentation is given?

Thanks.

eichberg
Moderator
Moderator
Beiträge: 448
Registriert: 25. Sep 2007 12:12
Kontaktdaten:

Re: Exam Question: Which design pattern is implemented in the following code snippet?

Beitrag von eichberg » 2. Jul 2018 12:44

Hi,

you have already given the correct answer... from this piece of code it is impossible to determine the implemented pattern.

However, given the potential for misunderstanding the question, we have rephrased the question if it appears again at all.

Antworten

Zurück zu „Software Engineering - Design and Construction“