Software Quality Flashcards
(29 cards)
What is meant by “software quality”?
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
What are the five aspects of “external” software quality?
- Functionality: Does the software adhere to its specifications and deliver the features that the end-user wants and needs?
- Reliability: Does the software maintain its level of performance? What is the likelihood that it produces the correct output or behavior?
- 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?
- Efficiency: Does the software use the minimal amount of resources needed to perform its tasks?
- Security: Is data in the software available to those who have permission to access it, and unavailable to those who don’t?
What are the five aspects of “internal” software quality?
- Analyzability: How easy is it to read and understand the code?
- Changeability: How easy is it to change the code?
- Stability: Modifying one part of the code should have limited effect on other parts
- Testability: How easy is it to create test cases and find bugs?
- Reusability: Can the software be used in a variety of applications?
What is a data structure?
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.
Why are data structures important?
Choosing the correct data structure is one of, if the not the most, critical decisions that impacts internal and external software quality.
Analyzability
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
Changeability
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
Reusability
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
Stability
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.
Testability
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
Observability
An aspect of testability that refers to the ability to examine the state of the code you’re testing.
Dictionary words
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.
What does it mean for code to “smell”?
It means that it is bad design or has bad internal quality.
What is the most common code smell?
Using duplicate code, or very similar code, in multiple places by copy and pasting it in multiple locations.
What are the 2 main ways to eliminate duplicate code?
- Extract Method - create a new method that can be used in multiple places. (This assumes duplicate code is in the same class.)
- Extract Superclass - create a new common superclass that contains a method that can be used in multiple subclasses.
What is refactoring?
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
Micro-optimization technique
TBD
Lazy initialization
A programming technique in which we only create objects when we know we’re going to need them.
Lazy evaluation
A programming technique in which we evaluate expressions only when we know we’ll need the results.
Memorization
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.
Method in-lining
A micro-optimization technique in which we replace method call with method body.
Loop unrolling
A micro-optimization technique in which we replace for-loop with multiple instances of body.
Constant folding
A micro-optimization technique in which we replace a literal numerical expression with result.
Strength reduction
A micro-optimization technique in which we replace complex operations with simpler ones.