š What is (Static) Analysis?
Definition from INCOSE (International Council on Systems Engineering)
Static analysisĀ refers to the evaluation of system requirements or design choices without actually executing the system. It often involves calculations, modeling, or simulations. The goal is to verify the performance of a system by:
-
(a)Ā Reviewing the design or documentation (called theĀ baseline),
-
(b)Ā Performing calculations based on that baseline and analyzing the results,
-
(c)Ā Using empirical data (measured from real physical systems) and applying extrapolation or interpolation,
-
(d)Ā Or a combination of all of the above.
This process helps assess whether a system meets its requirements before building or testing it.
Definition from Software Engineering Perspective
In software engineering,Ā static analysisĀ is a method to verify properties of software without running it. It uses information about:
-
TheĀ syntaxĀ (code structure),
-
TheĀ behaviorĀ (what the software is expected to do),
-
TheĀ structureĀ (such as control flow or data flow within the program).
Examples of analysis include checking the programāsĀ state spaceĀ (all possible states it can be in),Ā execution patterns, orĀ abstract modelsĀ of how it works.
š UnlikeĀ testing, which checks actual program outputs by running the code, static analysis draws conclusions from the code itself.
š§Ŗ Types of Software Analysis
There areĀ two main types:
-
Static Analysis
-
PerformedĀ without executingĀ the code.
-
Focuses on code structure, logic, and syntax.
-
Used early in development (e.g. code review, linting tools).
-
-
Dynamic Analysis
-
InvolvesĀ executing the program.
-
Observes program behavior at runtime.
-
Used for performance testing, memory usage tracking, etc.
-
š§° Uses of Static Analysis
Static analysis is used to detect:
-
Style issues
e.g. code formatting, naming conventions -
Dangerous constructs
e.g. uninitialized variables, use of unsafe functions -
Verification of system properties
These are often formalized and checked systematically:-
Safety properties: Nothing bad happens (e.g. no crashes)
-
Liveness properties: Something good eventually happens (e.g. program eventually responds)
-
Fairness properties: Resources are allocated fairly (e.g. no thread is starved)
-
Temporal properties: Things happen in the correct order (e.g. login before access)
-
š ļø Examples of Static Analysis Results
-
DetectingĀ security vulnerabilitiesĀ (e.g. buffer overflows)
-
FindingĀ memory leaks
-
ReportingĀ code non-complianceĀ (e.g. not following coding standards)
-
EstimatingĀ resource usageĀ (CPU, memory, bandwidth)
Disclaimer: AI is used for text polishing and explaining. Authors have verified all facts and claims. In case of an error, feel free to file an issue.