1/44
Looks like no tags are added yet.
Static checking
Finding problems by examining the software without executing it
Why can’t i just write tests instead?
Static checking finds defects earlier, defects that cannot be found by tests, and transfers knowledge to engineers.
Architecture review
Structured examination of a systems design-major components, their responsibilities, and connections. Architectural mistakes are the most expensive kind.
How to conduct an architecture review
Review against concrete scenarios, started should not run the room but explain and listen, focus on hard to change and costly decisions, and end with recourses decisions, assigned owners, and follow up actions.
The purpose of architecture reviews is to
Review risks and assumptions
Discovery review
Happens early when design still forming, Map problem space, name major components, identify big risks, validity no requirements are forgotten, exploratory and generative.
Deep-dive review
Happens when a shape is setttled but a specific area carries outsized risk.
Retrospective review
Happens after system is built and running, “did the architecture actually deliver what we had hoped?”
Software inspection
Examines concrete work product-source code
Fagan inspection
Planning, overview, preparation, meeting, rework, follow-up
Inspections are about fixing or confirming that a defect needs to be fixed?
Confirming a defect needs to be fixed
Planning
Author and moderator decide what will be inspected. Choose participants, keep chunk small
Preparation
Each reviewer examines work individually and in advance
Meeting
Reader walks through material, reviewers raise issues found during prep, scribe records each defect, finds and records defects
Rework
Author takes logged list and fixes each item.
Follow up
Moderator verified every logged defect was addressed.
Preparation rate
Lines of code each reviewer read per hour before meeting
Defect density
Defects found per lines of code
Author
The person who wrote the work product, job is to listen
Reviewer
Person who finds defects. Do prep work beforehand. Raise issues in meeting.
Reader
Paraphrase the material aloud during the meeting, restating what each prove of code does in their own words
Moderator
Facilitator who enforces find dont fix, watching pace.
Scribe
Person who logs each defect with location, description, severity,
Code review
Before a change is merged, at least one engineer other than the author reads and approves it.
Intent
Does this change do what the author meant it to do? Is what they meant actually the right thing to do?
Trust
Code review is how a team collectively takes responsibility for its codebase. A change approved is everyone’s code, not just the authors
Repository stewardship
Does this change make the repository healthier over time.
Invested expert reviewer
Knows the history of why code is slides this way, and should be the one reviewing the code
Code ownership
Files have designated owners whose approval is required for changes there to guarantee an invested expert sees every change
Review latency
Teams should respond within hours, not days.
Automated static analysis
The use of tools that examine source code without running it and report likely defects.
Type checkers
Verify that operations are applied to compatible types of data. Don’t add a number to a string, call a method that doesnt exist, etc.
Linters
Catch stylistic issues like missing break in a switch, comparison that is always true, unused variables
Formatters
Rewrite the file into one simple layout of indentation, line breaks, and spacing
Data flow analyzers
Trace how values move through a program to find defect that span multiple lines, a variable used before it’s assigned, a resource on one path but not closed on another.
Big finders
Encode a catalog of known-bad code shapes and scan for them
Precision
The fraction of tools alarms that are real. How much was an actual defect, Real bugs/total flagged
Low precision
Many false positives
Recall
Caught bugs/Real Bugs
False positive rate
FP/(FP+TN)
30% false positive rate means
30% of warnings are false alarms
False discovery rate
1-precision
Static-analysis tools choose precision over recall or recall over precision
Precision