Add DRY, dependency and SOLID criteria to the code checklists (MIL-009 task 5)

New criteria, appended after the existing ones (nothing renumbered or
changed):

- DRY in all five qc-programming-* checklists (python, c, cpp, csharp, shell)
- dependency rule in all but shell (imports, includes or references point
  inward, no cycles; in C also one responsibility per module)
- SOLID in python, cpp and csharp
- qc-dcd.md criterion 9: dependencies between classes and packages point
  inward (cycles stay with criterion 8)

Each is tagged with an ISO/IEC 25010 characteristic, and the criterion Notes
name the rule in the framework's coding-conventions skill, which defines it
once. Each checklist has a new Proposed Version History row for S02, who
accepts coding-standard changes. Common Defects gain a bullet per criterion.
This commit is contained in:
2026-10-09 11:26:58 +08:00
parent 02b520b570
commit 304ec7751b
6 changed files with 33 additions and 0 deletions
+3
View File
@@ -11,6 +11,7 @@
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — | | 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — |
| 2026-10-09 | Proposed | Jens Tirsvad Nielsen | S02 | Added criterion 9 (dependency direction) | pending |
--- ---
@@ -32,6 +33,7 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
| 6 | Method signatures are traceable to Operation Contracts and/or design Sequence Diagrams | Mandatory | Functional Suitability, Maintainability | Prevents drift between design layers | | 6 | Method signatures are traceable to Operation Contracts and/or design Sequence Diagrams | Mandatory | Functional Suitability, Maintainability | Prevents drift between design layers |
| 7 | Class names and structure remain consistent with the Domain Model concepts they refine | Mandatory | Maintainability, Compatibility | Design classes should not silently rename or drop domain concepts | | 7 | Class names and structure remain consistent with the Domain Model concepts they refine | Mandatory | Maintainability, Compatibility | Design classes should not silently rename or drop domain concepts |
| 8 | No circular dependencies between classes/packages unless explicitly justified | Optional | Maintainability, Reliability | Circular coupling harms testability and portability | | 8 | No circular dependencies between classes/packages unless explicitly justified | Optional | Maintainability, Reliability | Circular coupling harms testability and portability |
| 9 | Dependencies between classes and packages point inward: domain classes do not depend on infrastructure, delivery or framework classes | Mandatory | Maintainability, Portability | Business rules must be buildable and testable without the outer layers; cycles are criterion 8 |
## Common Defects ## Common Defects
@@ -40,6 +42,7 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
- Composition used where the parts do not share the whole's lifecycle (or vice versa) - Composition used where the parts do not share the whole's lifecycle (or vice versa)
- Method signatures that don't match any Operation Contract or Sequence Diagram message - Method signatures that don't match any Operation Contract or Sequence Diagram message
- Unannotated or inconsistently applied design patterns - Unannotated or inconsistently applied design patterns
- Domain classes that depend on persistence, user-interface or framework classes
## Traceability Rule ## Traceability Rule
+6
View File
@@ -11,6 +11,7 @@
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — | | 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — |
| 2026-10-09 | Proposed | Jens Tirsvad Nielsen | S02 | Added criteria 14 to 15 (DRY and dependency rule) | pending |
--- ---
@@ -37,6 +38,8 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
| 11 | Error reporting (status codes, `errno` use) is documented in the header | Optional | Usability, Reliability | | | 11 | Error reporting (status codes, `errno` use) is documented in the header | Optional | Usability, Reliability | |
| 12 | Tests cover new behaviour and run under address and undefined-behaviour sanitizers in at least one build | Optional | Reliability, Security | | | 12 | Tests cover new behaviour and run under address and undefined-behaviour sanitizers in at least one build | Optional | Reliability, Security | |
| 13 | Modules and functions trace to the Design Class Diagram or design artifact they implement | Mandatory | Functional Suitability, Maintainability | | | 13 | Modules and functions trace to the Design Class Diagram or design artifact they implement | Mandatory | Functional Suitability, Maintainability | |
| 14 | Each piece of knowledge (a business rule, constant, format, validation or query) is defined in one place; code is merged only where it expresses the same knowledge, not where it merely looks alike | Mandatory | Maintainability | Modularity, Reusability. Rule: `coding-conventions` skill, “State each piece of knowledge once” |
| 15 | Includes point inward: business-rule modules include no I/O, platform or UI headers, the include graph has no cycles, and a module has one responsibility (rules are not mixed with I/O) | Mandatory | Maintainability, Portability | Modularity, Portability. Rule: `coding-conventions` skill, “Dependencies point inward” |
## Common Defects ## Common Defects
@@ -47,6 +50,9 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
- Macros doing the work of `static inline` functions or `enum` - Macros doing the work of `static inline` functions or `enum`
- Identifiers starting with an underscore and an uppercase letter - Identifiers starting with an underscore and an uppercase letter
- Undefined behaviour hidden by a build that happens to work - Undefined behaviour hidden by a build that happens to work
- The same rule, constant or table written in two modules
- A business-rule module that includes a platform, I/O or UI header, or modules that include each other
- A module that mixes business rules with file or device access
## Traceability Rule ## Traceability Rule
+7
View File
@@ -11,6 +11,7 @@
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — | | 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — |
| 2026-10-09 | Proposed | Jens Tirsvad Nielsen | S02 | Added criteria 14 to 16 (DRY, dependency rule and SOLID) | pending |
--- ---
@@ -37,6 +38,9 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
| 11 | Static analysis with the Core Guidelines checks is clean, or each suppression is justified | Optional | Reliability, Maintainability | | | 11 | Static analysis with the Core Guidelines checks is clean, or each suppression is justified | Optional | Reliability, Maintainability | |
| 12 | Tests cover new behaviour and run under address and undefined-behaviour sanitizers in at least one build | Optional | Reliability, Security | | | 12 | Tests cover new behaviour and run under address and undefined-behaviour sanitizers in at least one build | Optional | Reliability, Security | |
| 13 | Classes and operations trace to the Design Class Diagram they implement; deviations are recorded | Mandatory | Functional Suitability, Maintainability | | | 13 | Classes and operations trace to the Design Class Diagram they implement; deviations are recorded | Mandatory | Functional Suitability, Maintainability | |
| 14 | Each piece of knowledge (a business rule, constant, format, validation or query) is defined in one place; code is merged only where it expresses the same knowledge, not where it merely looks alike | Mandatory | Maintainability | Modularity, Reusability. Rule: `coding-conventions` skill, “State each piece of knowledge once” |
| 15 | Includes and link dependencies point inward: business-rule code includes no I/O, platform, UI or framework headers, and the include graph has no cycles | Mandatory | Maintainability, Portability | Modularity, Portability. Rule: `coding-conventions` skill, “Dependencies point inward” |
| 16 | SOLID holds: a class has one reason to change; new behaviour is added by a new derived type, not by editing a type switch in several places; derived classes honour the contract of their base (`override`); abstract interfaces are narrow; high-level code depends on abstract types and receives its implementations | Mandatory | Maintainability | Single responsibility is the most commonly violated. Rule: `coding-conventions` skill, “SOLID” |
## Common Defects ## Common Defects
@@ -47,6 +51,9 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
- Macros for constants or small functions - Macros for constants or small functions
- Returning a reference or view to a local or temporary - Returning a reference or view to a local or temporary
- Exceptions and error codes mixed in the same module without a stated rule - Exceptions and error codes mixed in the same module without a stated rule
- The same rule, constant or validation written in two places, or two functions merged because they look alike although they change for different reasons
- Business-rule code that includes a framework, platform or database header
- A class with several unrelated responsibilities, or a `switch` on a type code repeated in several places
## Traceability Rule ## Traceability Rule
+7
View File
@@ -11,6 +11,7 @@
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — | | 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — |
| 2026-10-09 | Proposed | Jens Tirsvad Nielsen | S02 | Added criteria 14 to 16 (DRY, dependency rule and SOLID) | pending |
--- ---
@@ -37,6 +38,9 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
| 11 | Public async APIs accept and pass a `CancellationToken` where the operation can be cancelled | Optional | Performance Efficiency, Reliability | | | 11 | Public async APIs accept and pass a `CancellationToken` where the operation can be cancelled | Optional | Performance Efficiency, Reliability | |
| 12 | Tests cover new behaviour, are named `Method_Condition_Expected`, and do not depend on order, time or the network | Mandatory | Reliability, Maintainability | | | 12 | Tests cover new behaviour, are named `Method_Condition_Expected`, and do not depend on order, time or the network | Mandatory | Reliability, Maintainability | |
| 13 | Classes and members trace to the Design Class Diagram they implement; deviations are recorded | Mandatory | Functional Suitability, Maintainability | | | 13 | Classes and members trace to the Design Class Diagram they implement; deviations are recorded | Mandatory | Functional Suitability, Maintainability | |
| 14 | Each piece of knowledge (a business rule, constant, format, validation or query) is defined in one place; code is merged only where it expresses the same knowledge, not where it merely looks alike | Mandatory | Maintainability | Modularity, Reusability. Rule: `coding-conventions` skill, “State each piece of knowledge once” |
| 15 | Namespace and project references point inward: business-rule code references no framework, database, UI or delivery-mechanism code, and there are no reference cycles | Mandatory | Maintainability, Portability | Modularity, Portability. Rule: `coding-conventions` skill, “Dependencies point inward” |
| 16 | SOLID holds: a class has one reason to change; new behaviour is added by extension, not by editing a type test in several places; subtypes honour the contract of their base; interfaces are narrow; high-level code depends on interfaces and receives its implementations by injection | Mandatory | Maintainability | Single responsibility is the most commonly violated. Rule: `coding-conventions` skill, “SOLID” |
## Common Defects ## Common Defects
@@ -47,6 +51,9 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
- Undisposed `HttpClient`, streams or database connections - Undisposed `HttpClient`, streams or database connections
- `DateTime` used for instants, or `double` for money - `DateTime` used for instants, or `double` for money
- Several public types in one file, or a file name that differs from its type - Several public types in one file, or a file name that differs from its type
- The same rule, constant or validation written in two places, or two methods merged because they look alike although they change for different reasons
- Business-rule code that references the ORM, the web framework or a database driver
- A class with several unrelated responsibilities, or `is`/`switch` type tests repeated in several places
## Traceability Rule ## Traceability Rule
+7
View File
@@ -11,6 +11,7 @@
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — | | 2026-10-01 | Accepted | Jens Tirsvad Nielsen | S07 | First public release (1.0.0) | — |
| 2026-10-09 | Proposed | Jens Tirsvad Nielsen | S02 | Added criteria 14 to 16 (DRY, dependency rule and SOLID) | pending |
--- ---
@@ -37,6 +38,9 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
| 11 | Tests exist for new behaviour, are named for the behaviour, and do not depend on order or the network | Mandatory | Reliability, Maintainability | | | 11 | Tests exist for new behaviour, are named for the behaviour, and do not depend on order or the network | Mandatory | Reliability, Maintainability | |
| 12 | Type checker runs in strict mode without errors; `Any` is justified in a comment | Optional | Reliability, Maintainability | | | 12 | Type checker runs in strict mode without errors; `Any` is justified in a comment | Optional | Reliability, Maintainability | |
| 13 | Dependencies are declared and pinned in the project's dependency file, none unused | Optional | Portability, Security | | | 13 | Dependencies are declared and pinned in the project's dependency file, none unused | Optional | Portability, Security | |
| 14 | Each piece of knowledge (a business rule, constant, format, validation or query) is defined in one place; code is merged only where it expresses the same knowledge, not where it merely looks alike | Mandatory | Maintainability | Modularity, Reusability. Rule: `coding-conventions` skill, “State each piece of knowledge once” |
| 15 | Imports point inward: business-rule modules import no framework, database, UI or delivery-mechanism code, and there are no import cycles | Mandatory | Maintainability, Portability | Modularity, Portability. Rule: `coding-conventions` skill, “Dependencies point inward” |
| 16 | SOLID holds: a class or module has one reason to change; new behaviour is added by extension, not by editing a type test in several places; subclasses honour the contract of their base; protocols are narrow; high-level code depends on protocols or abstract types and receives its implementations | Mandatory | Maintainability | Single responsibility is the most commonly violated. Rule: `coding-conventions` skill, “SOLID” |
## Common Defects ## Common Defects
@@ -47,6 +51,9 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
- `print` used for diagnostics; wildcard imports - `print` used for diagnostics; wildcard imports
- Code reformatted by hand, or an unrelated reformat mixed into a functional change - Code reformatted by hand, or an unrelated reformat mixed into a functional change
- Classes or methods that appear in no design artifact and have no stated reason - Classes or methods that appear in no design artifact and have no stated reason
- The same rule, constant or validation written in two modules, or two functions merged because they look alike although they change for different reasons
- Business-rule modules importing the ORM, the web framework or a database driver
- A class with several unrelated responsibilities, or an `isinstance` chain repeated in several places
## Traceability Rule ## Traceability Rule
+3
View File
@@ -10,6 +10,7 @@
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-02 | Accepted | Jens Tirsvad Nielsen | S07 | Initial version | — | | 2026-10-02 | Accepted | Jens Tirsvad Nielsen | S07 | Initial version | — |
| 2026-10-09 | Proposed | Jens Tirsvad Nielsen | S02 | Added criterion 15 (DRY) | pending |
--- ---
@@ -37,6 +38,7 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
| 12 | Formatted with `shfmt` (or the project's formatter) | Optional | Maintainability | | | 12 | Formatted with `shfmt` (or the project's formatter) | Optional | Maintainability | |
| 13 | Safe to re-run: a second run does not duplicate or corrupt what the first did | Optional | Reliability | | | 13 | Safe to re-run: a second run does not duplicate or corrupt what the first did | Optional | Reliability | |
| 14 | Bash version and external tools it needs are stated; GNU-only options are named | Optional | Portability | | | 14 | Bash version and external tools it needs are stated; GNU-only options are named | Optional | Portability | |
| 15 | A command sequence, constant, path or message used more than once is defined once (a function, a variable or a sourced helper); a helper is shared between scripts only where it expresses the same knowledge | Mandatory | Maintainability | Modularity, Reusability. Rule: `coding-conventions` skill, “State each piece of knowledge once” |
## Common Defects ## Common Defects
@@ -47,6 +49,7 @@ Level: **Mandatory** criteria are the baseline every instance must meet; **Optio
- A token echoed to the terminal or kept in the script - A token echoed to the terminal or kept in the script
- No usage message, so a wrong call fails with a cryptic error - No usage message, so a wrong call fails with a cryptic error
- A script that implements nothing in any task or design - A script that implements nothing in any task or design
- The same path, option list or message pasted into several places in one script, or copied between scripts
## Traceability Rule ## Traceability Rule