Skip to main content

software_engineering/
lib.rs

1//! # Software Engineering
2//!
3//! Rust implementations of 29 software-engineering delivery, quality, and
4//! reliability metrics — one module per topic. Each module implements the
5//! formulas from its source chapter in the book *Software Engineering
6//! Metrics* (`software-engineering-metrics/locales/en-001/chapters/*.md`),
7//! documents them with runnable examples, and reproduces the chapter's
8//! worked example (where the chapter gives one) in its unit tests.
9//!
10//! Dependencies are minimal: [`rusty_money`] is available for
11//! currency-checked `Money` arithmetic (see each financial module's own
12//! "Money" section for a direct-usage example); every module's own
13//! functions still take and return plain `f64`, with no `rusty_money`
14//! wrapper of any kind — combine the two directly in your own code rather
15//! than through an adapter this crate provides. All quantities are `f64`
16//! (or a small enum where the source material calls for a category, such
17//! as a SPACE dimension or a vulnerability severity), and functions return
18//! `Option<f64>` wherever a denominator could be zero.
19//!
20//! ## Quickstart
21//!
22//! A speed improvement, paired with its guardrail, funding a return:
23//!
24//! ```
25//! use software_engineering::flow_framework::{littles_law_wip, flow_efficiency_percent};
26//! use software_engineering::dora_metrics::change_failure_rate_percent;
27//! use software_engineering::return_on_investment::roi;
28//!
29//! // A team arrives at 4 items/week with a 5-week flow time: Little's law
30//! // says ~20 items are in process in the value stream at any moment.
31//! let wip = littles_law_wip(4.0, 5.0);
32//! assert_eq!(wip, 20.0);
33//!
34//! // Of those 5 weeks, only 1.5 weeks is active work: 30% flow efficiency.
35//! let efficiency = flow_efficiency_percent(1.5, 5.0).unwrap();
36//! assert!((efficiency - 30.0).abs() < 1e-9);
37//!
38//! // A speed improvement must be paired with its stability guardrail:
39//! // change failure rate falls from 25% to 8% as the team ships faster,
40//! // not despite it — the DORA finding that speed and stability move
41//! // together in elite performers.
42//! let cfr_after = change_failure_rate_percent(8.0, 100.0).unwrap();
43//! assert!(cfr_after < 25.0);
44//!
45//! // The combined delivery investment returns 2.0 (200%) on its cost —
46//! // every $1 invested returns $2 in net profit, a 3x total return.
47//! let r = roi(300_000.0, 100_000.0).unwrap();
48//! assert_eq!(r, 2.0);
49//! ```
50//!
51//! ## Module index by theme
52//!
53//! **Flow metrics** —
54//! [`flow_framework`], [`cycle_time`], [`queueing_theory`],
55//! [`lean_value_stream_metrics`], [`pull_request_metrics`], [`dora_metrics`]
56//!
57//! **Developer experience** —
58//! [`space_framework`], [`developer_experience_metrics`],
59//! [`satisfaction_metrics`], [`performance_metrics`], [`activity_metrics`],
60//! [`communication_metrics`]
61//!
62//! **Code and quality** —
63//! [`code_complexity`], [`test_effectiveness`], [`code_churn`],
64//! [`technical_debt`], [`static_analysis_metrics`],
65//! [`documentation_and_knowledge_metrics`]
66//!
67//! **Product and business** —
68//! [`escaped_defects`], [`feature_adoption`], [`unit_economics`],
69//! [`return_on_investment`], [`customer_and_business_outcome_metrics`]
70//!
71//! **Reliability, operations, and security** —
72//! [`error_budget`], [`incident_metrics`], [`on_call_metrics`],
73//! [`vulnerability_management`]
74//!
75//! **AI-assisted development** —
76//! [`ai_assisted_development`]
77//!
78//! **Metrics programs** —
79//! [`maturity_model`]
80
81#![deny(clippy::pedantic)]
82#![deny(missing_docs)]
83
84pub mod activity_metrics;
85pub mod ai_assisted_development;
86pub mod code_churn;
87pub mod code_complexity;
88pub mod communication_metrics;
89pub mod customer_and_business_outcome_metrics;
90pub mod cycle_time;
91pub mod developer_experience_metrics;
92pub mod documentation_and_knowledge_metrics;
93pub mod dora_metrics;
94pub mod error_budget;
95pub mod escaped_defects;
96pub mod feature_adoption;
97pub mod flow_framework;
98pub mod incident_metrics;
99pub mod lean_value_stream_metrics;
100pub mod maturity_model;
101pub mod on_call_metrics;
102pub mod performance_metrics;
103pub mod pull_request_metrics;
104pub mod queueing_theory;
105pub mod return_on_investment;
106pub mod satisfaction_metrics;
107pub mod space_framework;
108pub mod static_analysis_metrics;
109pub mod technical_debt;
110pub mod test_effectiveness;
111pub mod unit_economics;
112pub mod vulnerability_management;