Testing & Maintainability
Prev: Error-Handling Philosophies | Up: software_design | Next: python3
Rel: Python Testing & Debugging, Web Debugging & Testing, Functional Programming
Ref: Wikipedia — Software Testing
Tags: #public #prog #programming #design #testing
Contents
Testing Layers
- Unit tests: fast, deterministic checks of pure logic and edge cases (empty inputs, boundaries, error paths).
- Integration tests: verify real boundaries (SQL queries against a real database, HTTP handlers, file I/O).
- Property-based tests: assert universal invariants across hundreds of generated inputs (e.g.,
decode(encode(x)) == x).
Test observable behavior and contracts, not private implementation details, so refactoring doesn't break tests.
Writing Maintainable Code
- Optimize for reading (code is read far more often than written): clear names, small focused functions, flat control flow.
- Comment why a non-obvious decision or invariant exists, not what the syntax already says.
- Make the simplest working design first; generalize only once you have 2–3 concrete use cases.
Linked from
Related notes
- tuts/programming/software_design Linked here; links to this page; shared tags: #design, #prog, #programming
- tuts/programming/software_design/error_handling_philosophies Linked here; links to this page; shared tags: #design, #prog, #programming
- tuts/programming/paradigms/functional_programming Linked here; shared tags: #prog, #programming
- tuts/rust/cargo_and_tooling/testing_clippy_and_docs links to this page; shared tags: #prog, #testing
- tuts/python3 Linked here; shared tags: #prog
- tuts/python3/tutorials/intermediate_python_and_software_engineering/testing_and_debugging Linked here; shared tags: #testing
- tuts/web/tutorials/devtools_and_debugging Linked here; shared tags: #testing
- tuts/programming/software_design/modularity_cohesion_and_coupling shared tags: #design, #prog, #programming
- tuts/programming shared tags: #prog, #programming
- tuts/programming/algorithms_and_dsa shared tags: #prog, #programming