Software Quality Flashcards

(29 cards)

1
Q

What is meant by “software quality”?

A

In this course we will define software quality using two categories:

  • External: executable program running on hardware in some environment
  • Internal: code as human-readable text
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the five aspects of “external” software quality?

A
  1. Functionality: Does the software adhere to its specifications and deliver the features that the end-user wants and needs?
  2. Reliability: Does the software maintain its level of performance? What is the likelihood that it produces the correct output or behavior?
  3. Usability: How easy is it for users to perform tasks? How much time do they need to learn how to use the software? How likely are they to make mistakes?
  4. Efficiency: Does the software use the minimal amount of resources needed to perform its tasks?
  5. Security: Is data in the software available to those who have permission to access it, and unavailable to those who don’t?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the five aspects of “internal” software quality?

A
  1. Analyzability: How easy is it to read and understand the code?
  2. Changeability: How easy is it to change the code?
  3. Stability: Modifying one part of the code should have limited effect on other parts
  4. Testability: How easy is it to create test cases and find bugs?
  5. Reusability: Can the software be used in a variety of applications?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a data structure?

A

An organization of a data collection that enables efficient access and modification. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.

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

Why are data structures important?

A

Choosing the correct data structure is one of, if the not the most, critical decisions that impacts internal and external software quality.

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

Analyzability

A

The readability and understandability of code. This is necessary so that a programmer can easily:

  • Identify and fix defects
  • Add / improve functionality
  • Understand how an algorithm / solution is implemented
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Changeability

A

The ease with which code can be changed. Highly changeable code allows a programmer to easily:

  • Fix defects
  • Add / improve functionality
  • Incorporate new code
  • Improve other aspects of software quality
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Reusability

A

The ease with which code can be reused in other applications. Reusable code allows a programmer to:

  • Reduce time spent developing new code
  • Reduce the likelihood that new code will contain defects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Stability

A

The idea that modifying one part of the code should have a limited effect on others. High stability allows a programmer to:

  • Make changes in one part of the code without being required to make changes in other parts. This has the added benefit of reducing the time / effort required to change code.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Testability

A

The controllability and observability of code. High testability allows a programmer to easily:

  • Create test cases
  • Identify and fix defects
  • Increase confidence that software is working correctly
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Observability

A

An aspect of testability that refers to the ability to examine the state of the code you’re testing.

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

Dictionary words

A

Words that occur in everyday language. These are good to use as variable names as they tend to be easier to read and recognize in comparison to words that are made up.

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

What does it mean for code to “smell”?

A

It means that it is bad design or has bad internal quality.

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

What is the most common code smell?

A

Using duplicate code, or very similar code, in multiple places by copy and pasting it in multiple locations.

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

What are the 2 main ways to eliminate duplicate code?

A
  1. Extract Method - create a new method that can be used in multiple places. (This assumes duplicate code is in the same class.)
  2. Extract Superclass - create a new common superclass that contains a method that can be used in multiple subclasses.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is refactoring?

A

An activity by which we modify code but don’t change its functionality.

Why should we refactor?

  • Improve the internal quality of code
  • Simplify future code changes
  • Reduce the amount of code to maintain
  • It’s a way of understanding the code

When should we refactor?

  • Constantly!
  • When you see code (or are writing code) that doesn’t adhere to the intended design

What should we refactor?

  • Make small changes before big ones
  • Be careful about:
    • Introducing bugs
    • Breaking “published” interfaces
    • Unnecessarily decreasing external quality

When should we refactor?

  • Code that smells
  • Code that is hard to read or hard to understand
  • Code that does not adhere to conventions
  • Code that is unnecessary or in the wrong place
17
Q

Micro-optimization technique

18
Q

Lazy initialization

A

A programming technique in which we only create objects when we know we’re going to need them.

19
Q

Lazy evaluation

A

A programming technique in which we evaluate expressions only when we know we’ll need the results.

20
Q

Memorization

A

A programming technique in which we keep a Map of inputs (arguments) to outputs (results) and return the result from the Map if the same input is seen more than once. This will lead to more memory utilization but may greatly reduce execution time.

21
Q

Method in-lining

A

A micro-optimization technique in which we replace method call with method body.

22
Q

Loop unrolling

A

A micro-optimization technique in which we replace for-loop with multiple instances of body.

23
Q

Constant folding

A

A micro-optimization technique in which we replace a literal numerical expression with result.

24
Q

Strength reduction

A

A micro-optimization technique in which we replace complex operations with simpler ones.

25
What tradeoffs exist within software quality?
Improving one aspect of external quality may harm other aspects of external quality and / or internal quality. For example, if we make our code faster, we may also make it: * harder to understand * harder to change * less likely to provide the correct functionality * less secure
26
How can you measure execution time?
Execution time can be measured by various mechanisms: * Use Java System methods to measure execution time of small pieces of code. * Use UNIX “time” command to measure execution time of entire program. * Use profiling tools for more detailed information.
27
What is meant by "wall clock" time?
The ​elapsed “real” time between two events, as would be measured by a wall clock, stopwatch, etc. This can lead to inaccuracies when measuring software execution time because of other factors, such as operations being performed by the Java Virtual Machine, operating system, hardware, etc.
28
Rules of thumb for software efficiency
* Always use the right data structure * Make the common case fast * Don’t do work unnecessarily * Be careful about accidentally harming other aspects of quality * Don't allocate memory unnecessarily * Do more than one thing at a time (concurrency)
29
What's the best way to avoid doing unnecessary work?
* Don’t check conditions unnecessarily * Don’t call methods unnecessarily * Don’t redo work you’ve already done * Use the Java API when possible * Use lazy evaluation, lazy initialization, and memorization * Take advantage of short-circuit boolean operators * Use micro-optimizations sparingly, especially if they may harm understandability