L4: Improving Software Quality by Design Flashcards

1
Q

What are software bugs?

A

Errors in design, development, or operation causing unexpected behaviour / results.

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

How do bugs happen?

A
  • Programmer creates a defect
  • Defect causes an infection
  • Infect propagates
  • Infection causes failure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to deal with bugs?

A

Improve software quality by:
- Properly designing the system
- Quality assuring the code
- Testing the system
- Debugging failures

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

What might lead to bugs in the design process? What about in the software design?

A

The design process:
- Misunderstanding a customer
- Misinterpreting a written requirement
- Overlooking a case when analysing requirements

The software design:
- Adopting an incorrect algorithm
- Making an unwarranted asssumption about the code
- Making a typing error when entering code
- Implementing incompatible interfaces

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

What is the definition of robustness?

A

Ability of a system to cope with errors and erroneous input

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

Why do we need robustness and contracts?

A
  • Making developers aware of problematic execution cases
  • Avoiding such problematic cases from the start
  • Defining where to put blame:
    1. No explicit signaling for violated preconditions implemented
    2. Explicit signaling for violated precodintions implemented
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to improve the code and make it more robust?

A
  • Using JavaDoc and natural language
  • Parameters:
    1. Definition of the parameters a method receives
    2. Helpful to specify variables more precisely and to add expected units
  • Precondition:
    1. Must be true before execution
    2. Can be imposed on state of class, arguments passed, …
    3. Impose obligations on the client
  • Postcondition:
    1. Must be true after execution
    2. Can be imposed on state of class, return type, values, …
    3. Impose obligations on the method
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Writing contracts

A

Idea of design by contract:
- Formal and verifiable specification
- Supported by some programming languages
- Including preconditions, postconditions, and invariants

For this course:
- @param, @pre, @post, @return, @throws
- Be as precise as possible
- Not fully formal

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

What happens at an exception?

A
  • It will terminate the program execution by returning the defined exception
  • A method is robuts if it always throws an exception if its preconditions are violated
  • The returned exception must be handled by the client
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When to use exceptions?

A
  • Make a method robust
  • Avoid encoding information in special values
  • Signal special (erroneous) situations in non-local (non-private) methods
  • Ensure that a failure cannot be ignored
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

White-box and black-box testing

A

White-box: test internal logic
- Consider only the code, ignore specification
- Used to test internal state of the system

Black-box: test intended functionality
- Consider only specification and requirements, ignore code
- Used to test correct behaviour

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

Test-driven development

A

Core Idea:
- Develop tests first to specify new behaviour
- Develop code to fulfill tests
- Improve code quality

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