|
| 1 | +# Architecture |
| 2 | + |
| 3 | +This document describes the repository architecture using C4-style models. |
| 4 | + |
| 5 | +Scope: |
| 6 | + |
| 7 | +- Solution: `source/Atmoos.Quantities.sln` |
| 8 | +- Projects modelled: all C# projects currently included in the solution |
| 9 | + |
| 10 | +## C4 Level 1: System Context |
| 11 | + |
| 12 | +```mermaid |
| 13 | +flowchart LR |
| 14 | + user[Library Consumer\nApplication developer] |
| 15 | + contributor[Project Contributor\nMaintainer] |
| 16 | + ci[CI Pipeline] |
| 17 | +
|
| 18 | + subgraph sys[Atmoos.Quantities Repository] |
| 19 | + coreSystem[Atmoos.Quantities ecosystem\nType-safe quantities, units, serialization, tests, and benchmarks] |
| 20 | + end |
| 21 | +
|
| 22 | + nuget[NuGet.org] |
| 23 | + dotnet[.NET SDK and Runtime] |
| 24 | + json[JSON serializers\nSystem.Text.Json and Newtonsoft.Json] |
| 25 | + bdn[BenchmarkDotNet] |
| 26 | + xunit[xUnit] |
| 27 | +
|
| 28 | + user -->|Uses published packages| coreSystem |
| 29 | + contributor -->|Develops and tests| coreSystem |
| 30 | + ci -->|Builds, tests, packs| coreSystem |
| 31 | +
|
| 32 | + coreSystem -->|Publishes packages| nuget |
| 33 | + coreSystem -->|Targets| dotnet |
| 34 | + coreSystem -->|Integrates with| json |
| 35 | + coreSystem -->|Performance measurements via| bdn |
| 36 | + coreSystem -->|Automated tests via| xunit |
| 37 | +``` |
| 38 | + |
| 39 | +## C4 Level 2: Container View (Projects) |
| 40 | + |
| 41 | +Each C# project is modelled as a container. |
| 42 | + |
| 43 | +```mermaid |
| 44 | +flowchart TB |
| 45 | + subgraph runtime[Runtime and extension containers] |
| 46 | + q[Atmoos.Quantities\nCore quantity engine] |
| 47 | + u[Atmoos.Quantities.Units\nAdditional unit catalogue] |
| 48 | + stj[Atmoos.Quantities.Serialization.Text.Json\nSystem.Text.Json adapter] |
| 49 | + nsj[Atmoos.Quantities.Serialization.Newtonsoft\nNewtonsoft.Json adapter] |
| 50 | + end |
| 51 | +
|
| 52 | + subgraph quality[Verification and support containers] |
| 53 | + tt[Atmoos.Quantities.TestTools\nShared test helpers] |
| 54 | + qt[Atmoos.Quantities.Test\nCore tests] |
| 55 | + ut[Atmoos.Quantities.Units.Test\nUnits tests] |
| 56 | + stjt[Atmoos.Quantities.Serialization.Text.Json.Test\nSystem.Text.Json tests] |
| 57 | + nsjt[Atmoos.Quantities.Serialization.Newtonsoft.Test\nNewtonsoft tests] |
| 58 | + end |
| 59 | +
|
| 60 | + subgraph perf[Performance container] |
| 61 | + b[Atmoos.Quantities.Benchmark\nBenchmark harness] |
| 62 | + end |
| 63 | +
|
| 64 | + q --> dotnet[.NET] |
| 65 | + nsj --> newtonsoft[Newtonsoft.Json] |
| 66 | + stj --> stjlib[System.Text.Json] |
| 67 | + qt --> xunit[xUnit] |
| 68 | + ut --> xunit |
| 69 | + stjt --> xunit |
| 70 | + nsjt --> xunit |
| 71 | + b --> bdn[BenchmarkDotNet] |
| 72 | +
|
| 73 | + u --> q |
| 74 | + stj --> q |
| 75 | + nsj --> q |
| 76 | +
|
| 77 | + tt --> q |
| 78 | + qt --> q |
| 79 | + qt --> tt |
| 80 | +
|
| 81 | + ut --> u |
| 82 | + ut --> tt |
| 83 | +
|
| 84 | + stjt --> u |
| 85 | + stjt --> stj |
| 86 | +
|
| 87 | + nsjt --> u |
| 88 | + nsjt --> nsj |
| 89 | +
|
| 90 | + b --> u |
| 91 | + b --> stj |
| 92 | + b --> nsj |
| 93 | +``` |
| 94 | + |
| 95 | +## C4 Level 3: Component Views |
| 96 | + |
| 97 | +## Atmoos.Quantities (Core) |
| 98 | + |
| 99 | +Primary components are represented by top-level folders and public entry points. |
| 100 | + |
| 101 | +```mermaid |
| 102 | +flowchart LR |
| 103 | + api[Public API\nSystems.cs, Operators.cs, Extensions.cs] |
| 104 | + core[Core\nQuantity, Measure, numerics] |
| 105 | + dims[Dimensions\nDimension model and contracts] |
| 106 | + measures[Measures\nScalar, square, cubic, aliases] |
| 107 | + quantities[Quantities\nStrongly typed quantity structs] |
| 108 | + units[Units contracts\nIUnit families] |
| 109 | + parsing[Parsing\nText to quantity] |
| 110 | + physics[Physics\nFormula and domain operations] |
| 111 | + prefixes[Prefixes\nMetric and binary prefixes] |
| 112 | + creation[Creation\nFactory helpers] |
| 113 | + common[Common\nShared infrastructure] |
| 114 | +
|
| 115 | + api --> creation |
| 116 | + api --> measures |
| 117 | + api --> quantities |
| 118 | + quantities --> core |
| 119 | + quantities --> dims |
| 120 | + quantities --> units |
| 121 | + measures --> core |
| 122 | + measures --> dims |
| 123 | + parsing --> quantities |
| 124 | + parsing --> measures |
| 125 | + physics --> quantities |
| 126 | + prefixes --> measures |
| 127 | + creation --> core |
| 128 | + common --> core |
| 129 | +``` |
| 130 | + |
| 131 | +## Atmoos.Quantities.Units |
| 132 | + |
| 133 | +```mermaid |
| 134 | +flowchart LR |
| 135 | + si[SI units] |
| 136 | + imperial[Imperial units] |
| 137 | + nonstandard[Non-standard units] |
| 138 | + unitscore[Atmoos.Quantities\nCore abstractions] |
| 139 | +
|
| 140 | + si --> unitscore |
| 141 | + imperial --> unitscore |
| 142 | + nonstandard --> unitscore |
| 143 | +``` |
| 144 | + |
| 145 | +## Serialization Adapters |
| 146 | + |
| 147 | +```mermaid |
| 148 | +flowchart LR |
| 149 | + subgraph stjproj[Atmoos.Quantities.Serialization.Text.Json] |
| 150 | + stjconv[QuantityConverter] |
| 151 | + stjser[QuantitySerialization] |
| 152 | + stjdes[Deserializer] |
| 153 | + stjext[Extensions] |
| 154 | + end |
| 155 | +
|
| 156 | + subgraph nsjproj[Atmoos.Quantities.Serialization.Newtonsoft] |
| 157 | + nsjconv[QuantityConverter] |
| 158 | + nsjser[QuantitySerialization] |
| 159 | + nsjdes[Deserializer] |
| 160 | + nsjext[Extensions] |
| 161 | + end |
| 162 | +
|
| 163 | + qcore[Atmoos.Quantities] |
| 164 | + stjsdk[System.Text.Json] |
| 165 | + nsjsdk[Newtonsoft.Json] |
| 166 | +
|
| 167 | + stjconv --> qcore |
| 168 | + stjser --> qcore |
| 169 | + stjdes --> qcore |
| 170 | + stjext --> stjsdk |
| 171 | +
|
| 172 | + nsjconv --> qcore |
| 173 | + nsjser --> qcore |
| 174 | + nsjdes --> qcore |
| 175 | + nsjext --> nsjsdk |
| 176 | +``` |
| 177 | + |
| 178 | +## Verification and Benchmarks |
| 179 | + |
| 180 | +```mermaid |
| 181 | +flowchart TB |
| 182 | + tt[Atmoos.Quantities.TestTools\nAssertions, convenience helpers] |
| 183 | +
|
| 184 | + qt[Atmoos.Quantities.Test] |
| 185 | + ut[Atmoos.Quantities.Units.Test] |
| 186 | + stjt[Atmoos.Quantities.Serialization.Text.Json.Test] |
| 187 | + nsjt[Atmoos.Quantities.Serialization.Newtonsoft.Test] |
| 188 | + b[Atmoos.Quantities.Benchmark] |
| 189 | +
|
| 190 | + core[Atmoos.Quantities] |
| 191 | + units[Atmoos.Quantities.Units] |
| 192 | + stj[Serialization.Text.Json] |
| 193 | + nsj[Serialization.Newtonsoft] |
| 194 | +
|
| 195 | + qt --> core |
| 196 | + qt --> tt |
| 197 | +
|
| 198 | + ut --> units |
| 199 | + ut --> tt |
| 200 | +
|
| 201 | + stjt --> stj |
| 202 | + stjt --> units |
| 203 | +
|
| 204 | + nsjt --> nsj |
| 205 | + nsjt --> units |
| 206 | +
|
| 207 | + b --> units |
| 208 | + b --> stj |
| 209 | + b --> nsj |
| 210 | +``` |
| 211 | + |
| 212 | +## Project Inventory |
| 213 | + |
| 214 | +- Atmoos.Quantities: core runtime container |
| 215 | +- Atmoos.Quantities.Units: extension unit catalogue container |
| 216 | +- Atmoos.Quantities.Serialization.Text.Json: System.Text.Json adapter container |
| 217 | +- Atmoos.Quantities.Serialization.Newtonsoft: Newtonsoft.Json adapter container |
| 218 | +- Atmoos.Quantities.TestTools: shared testing support container |
| 219 | +- Atmoos.Quantities.Test: core behaviour and regression tests container |
| 220 | +- Atmoos.Quantities.Units.Test: units coverage tests container |
| 221 | +- Atmoos.Quantities.Serialization.Text.Json.Test: System.Text.Json adapter tests container |
| 222 | +- Atmoos.Quantities.Serialization.Newtonsoft.Test: Newtonsoft adapter tests container |
| 223 | +- Atmoos.Quantities.Benchmark: performance measurement container |
| 224 | + |
| 225 | +## Notes |
| 226 | + |
| 227 | +- The container relationships are based on current project references in the solution. |
| 228 | +- Component decomposition is intentionally coarse-grained at folder and entry-point level to remain maintainable as code evolves. |
0 commit comments