Hoofdstuk 6 - Design By Contract Flashcards

1
Q

Why are redundant checks not a good way to support Design by Contract?

A
  • extra complexity: extra code that needs to be verified as well
  • performance penalty: extra execution time
  • wrong context
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

You’re a project manager for a weather forecasting system, where performance is a real issue. Set-up some guidelines concerning assertion monitoring and argue your choice

A

Rule of thumb: at least monitor pre-conditions. Make sure that verifying pre-conditions is fast! Do not rely on switching off monitoring to gain efficiency. Profile performance to see where you loose efficiency.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

If you have to buy a class from an outsourcer in India, would you prefer a strong precondition over a weak one? And what about the postcondition?

A

A combination of both: Strong preconditions make a component more reusable, weak precondition will mean less effort to reach the state where you can call the method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Do you feel that design by contract yields software systems that are defect free? If you do, argue why. If you don’t, argue why it is still useful.

A

There will be less defects, but it won’t be defect free.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you ensure the quality of the pre- and postconditions?

A

Make sure they are reasonable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why is (consumer-driven) contract testing so relevant in the context of micro-services?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Assume you have an existing software system and you are a software quality engineer assigned to apply design by contract. How would you start? What would you do?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly