Software Quality Assurance (SS17) - Exam Protocol

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Minutes of the oral examination of the lecture

Software Quality Assurance (SS17)

Examiner Jun.-Prof. Dr. Anthony Anjorin Date: 12.09.2017


Course of studies: Software Quality Assurance (SS17) Duration: 15 min.
Language: German Grade (optional): 1.0

Preparation
approx. 1 week (summarizing all slides, going through the excercises (with solutions))

Literature:

Lecture Slides

Ocial Excercise Sheets + Solutions

Atmosphere: relaxed

Process of the exam:


Most protocols say he had 8-10 sheets of paper with topics of which 4-5 were covered. For me he had
4 topics and I went through all of them. I could only choose the order.

Observer-Pattern

Default Example of an Observer and Observable was given (pull version).

Q: How does the Observers notify() method look like (pseudocode)


A:

for (Observer o : oberverList) {


o.update() // in case of pull
}

Q: Assume the Observable's API changes frequently so pulling changes would require constant modi-
cations in all Observers. Solution?
A: push variant.
Q: How would this look like for push?
A: The change would be passed to the update() method so the Observer does not need to know the
Observables API.

Q: Which version (push/pull) do we have in this example?


A: Since the update() takes no parameter it must be pull

Jun.-Prof. Dr. Anthony Anjorin Software Quality Assurance (SS17) Page 1/ 4


Q: Why don't we always use push? Isn't this easier?
A: Observable would need to know what info each Observer needs
Q: We could just send everything
A:

Not everybody should know everything (condentiality)

This could be lots of Data. Not good if connection is e.g. via a network.

Statechart inheritance

Abbildung 1: Given Statechart

Q: Tell me something about inheritance of these statecharts


A:

The modernTV inherits from the TV

 It is invocable since all command-sequences on TV will also work on modernTV

 It is observable since all command-sequences on modernTV will work on TV after stripping


out unknown commands.

Q: If I now add this edge (see g. 2), how does the situation change?
A:

Still invocable

Not observable. After deleting unknown commands there could be multiple turn ons after
another. This would be impossible with TV.

Q: If I now take a modenTV in state standby and use it as a TV. Would this work?
A: No. You can use a modernTV as a TV, but then you are restricted to TV's methods.

Jun.-Prof. Dr. Anthony Anjorin Software Quality Assurance (SS17) Page 2/ 4


Abbildung 2: Modied Statechart

Design by Contract (Optionals)

Consider the trim() method of java.lang.String. (Returns a copy of the string, with leading and trailing
whitespace omitted.) Its signature is: String trim()

Two lines of code:

obj.map(str -> str.trim())


obj.flatMap(str -> str.trim())

Where obj is an Optional<String>

Q: What is the return type of the map call


A: Optional
Q: Would the flatMap call compile?
A: No because it requires a lambda which returns an Optional
Q: I modify the flatMap call to use a Optional<String> trim2() function. Would this compile now?
A: Yes
Q: What will be the return type?
A: Optional<String>
Q: If I use map with trim2(), what will be the return type?
A: Optional<Optional<String>>
Q: How would you explain the benet of using Optionals to a Java developer
A:

You don't need to write lots of if (a==null) code and can just use the objects which leads to
cleaner code.

Jun.-Prof. Dr. Anthony Anjorin Software Quality Assurance (SS17) Page 3/ 4


Another advantage is that compilers or static analysis tools can do better checks.

Q: But you could just wrap all code in one big try-catch block.
A: Thats very bad practice since you should catch errors close to where they happen.

TGGs (example DSL from the lecture)

We the following model: Like in Java-programming we have packages that contain classes. Each package
corresponds to a folder, each class corresponds to a le.

We have these two rules: (see g. 3)

Abbildung 3: The given TGG Rules

Q: Is it possible to create two classes that link to the same le or the other way round?
A: No. Each created class creates a new le and a new le leads to a new class.
Q: Can you add rules so that those cases become possible?
A: see gs. 4 and 5

Abbildung 4: Enable multiple classes per le

Abbildung 5: Enable multiple les per class

Jun.-Prof. Dr. Anthony Anjorin Software Quality Assurance (SS17) Page 4/ 4

You might also like