Skip to content

Commit 7b897e5

Browse files
Enhance DESCRIPTION and README for Improved Clarity and Detail
This update revises the DESCRIPTION.md and README.md files to reflect the expanded capabilities of the Semantics library, emphasizing the addition of a complete physics system covering 80+ quantities across 8 scientific domains. The changes include enhanced descriptions of features such as centralized physical constants, dimensional analysis, and a bootstrap architecture for circular dependency resolution. Additionally, the README now includes examples of accessing physical constants with type safety, further illustrating the library's functionality and usability for scientific applications.
1 parent 9ece28f commit 7b897e5

12 files changed

Lines changed: 788 additions & 870 deletions

File tree

.cursor/rules/derived-cursor-rules.mdc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,5 @@ When adding XML documentation comments:
222222
* Derived unit relationships (like time conversions): `60.0` (seconds per minute), `3600.0` (seconds per hour)
223223
* Imperial unit conversions not in PhysicalConstants: Many specific imperial conversions that aren't fundamental physical constants
224224
* **Testing Derived Constants:** Add additional tests for physical constants to validate stored values against calculated values from fundamental constants.
225-
* Can we put the bootstrap units in their own class so they dont pollote the PhysicalDimensions namespace?
225+
* Can we put the bootstrap units in their own class so they dont pollote the PhysicalDimensions namespace?
226+
* **Solution:** Create a dedicated `BootstrapUnits` class to house all bootstrap units. Refactor the `PhysicalDimensions` class to use the `BootstrapUnits` class.

.specstory/history/2025-06-13_08-35-fix-the-error-request.md

Lines changed: 721 additions & 0 deletions
Large diffs are not rendered by default.

DESCRIPTION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
A comprehensive .NET library for creating type-safe, validated string and quantity types using semantic meaning. Transform primitive string and numeric obsession into strongly-typed, self-validating domain models with 50+ validation attributes, polymorphic path handling, arithmetic quantity operations, and performance-optimized utilities. Includes factory pattern support, dependency injection integration, and enterprise-ready features for building robust, maintainable applications.
1+
A comprehensive .NET library for creating type-safe, validated string and physics quantity types using semantic meaning. Transform primitive string and numeric obsession into strongly-typed, self-validating domain models with 50+ validation attributes, polymorphic path handling, complete physics system covering 80+ quantities across 8 scientific domains, centralized physical constants with dimensional analysis, and performance-optimized utilities. Features include bootstrap architecture for circular dependency resolution, factory pattern support, dependency injection integration, and enterprise-ready capabilities for building robust, maintainable scientific and domain-specific applications.

ENHANCEMENT_SUMMARY.md

Lines changed: 0 additions & 138 deletions
This file was deleted.

README.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![NuGet Downloads](https://img.shields.io/nuget/dt/ktsu.Semantics.svg)](https://www.nuget.org/packages/ktsu.Semantics/)
55
[![Build Status](https://github.com/ktsu-dev/Semantics/workflows/CI/badge.svg)](https://github.com/ktsu-dev/Semantics/actions)
66

7-
A comprehensive .NET library for creating type-safe, validated types with semantic meaning. Transform primitive string obsession into strongly-typed, self-validating domain models with comprehensive validation, specialized path handling, and a complete physics quantities system covering all major scientific domains.
7+
A comprehensive .NET library for creating type-safe, validated types with semantic meaning. Transform primitive string and numeric obsession into strongly-typed, self-validating domain models with comprehensive validation, specialized path handling, and a complete physics quantities system covering 80+ quantities across 8 major scientific domains with dimensional analysis and centralized physical constants.
88

99
## Overview
1010

@@ -16,11 +16,13 @@ The Semantics library enables you to create strongly-typed wrappers that carry s
1616
- **Comprehensive Validation**: 50+ built-in validation attributes for all common scenarios
1717
- **Path Handling**: Specialized path types with polymorphic interfaces and file system operations
1818
- **Complete Physics System**: 80+ physics quantities across 8 scientific domains with dimensional analysis
19-
- **Physical Constants**: Centralized, type-safe access to fundamental and derived constants
19+
- **Physical Constants**: Centralized, type-safe access to fundamental and derived constants with validation
20+
- **Bootstrap Architecture**: Clean circular dependency resolution for complex type systems
2021
- **Unit Conversions**: Automatic unit handling with compile-time dimensional safety
2122
- **Factory Pattern**: Clean object creation with dependency injection support
2223
- **Performance Optimized**: Span-based operations, pooled builders, and minimal allocations
2324
- **Enterprise Ready**: Full .NET ecosystem integration (ASP.NET Core, Entity Framework, etc.)
25+
- **Comprehensive Testing**: Derived constants validation and physics relationship verification
2426

2527
## 🚀 Quick Start
2628

@@ -118,6 +120,11 @@ var power = work / Time<double>.FromSeconds(10.0); // Results in Power<double
118120
Console.WriteLine(temp.ToFahrenheit()); // 77°F
119121
Console.WriteLine(force.ToPounds()); // 22.48 lbf
120122
123+
// Access physical constants with type safety
124+
var gasConstant = PhysicalConstants.Generic.GasConstant<double>(); // 8.314 J/(mol·K)
125+
var speedOfLight = PhysicalConstants.Generic.SpeedOfLight<float>(); // 299,792,458 m/s
126+
var planckConstant = PhysicalConstants.Generic.PlanckConstant<decimal>(); // Type-safe constant access
127+
121128
// Dimensional analysis prevents errors
122129
// var invalid = force + temp; // ❌ Compiler error!
123130
```
@@ -205,6 +212,28 @@ public sealed record ServerAddress : SemanticString<ServerAddress> { }
205212
public sealed record Port : SemanticQuantity<Port, int> { }
206213
```
207214

215+
### Physical Constants System
216+
217+
All physical constants are centralized in `PhysicalConstants` with type-safe generic access:
218+
219+
```csharp
220+
// Fundamental constants (SI 2019 definitions)
221+
var c = PhysicalConstants.Generic.SpeedOfLight<double>(); // 299,792,458 m/s
222+
var h = PhysicalConstants.Generic.PlanckConstant<double>(); // 6.62607015×10⁻³⁴ J⋅s
223+
var k = PhysicalConstants.Generic.BoltzmannConstant<double>(); // 1.380649×10⁻²³ J/K
224+
var NA = PhysicalConstants.Generic.AvogadroNumber<double>(); // 6.02214076×10²³ /mol
225+
226+
// Temperature constants
227+
var T0 = PhysicalConstants.Generic.StandardTemperature<double>(); // 273.15 K
228+
var P0 = PhysicalConstants.Generic.StandardAtmosphericPressure<double>(); // 101,325 Pa
229+
230+
// Conversion factors with derived validation
231+
var ftToM = PhysicalConstants.Generic.FeetToMeters<double>(); // 0.3048 m/ft
232+
var sqFtToSqM = PhysicalConstants.Generic.SquareFeetToSquareMeters<double>(); // Derived: ftToM²
233+
234+
// All constants have comprehensive test coverage ensuring derived values match calculations
235+
```
236+
208237
### Complete Physics Domains
209238

210239
The library includes **80+ physics quantities** across **8 scientific domains**:
@@ -279,6 +308,38 @@ var flowRate = VolumetricFlowRate<double>.FromCubicMetersPerSecond(0.1);
279308
var reynolds = ReynoldsNumber<double>.Calculate(velocity, Length<double>.FromMeters(0.1), viscosity);
280309
```
281310

311+
## 🏛️ Architecture & Design
312+
313+
### Bootstrap Architecture
314+
315+
The library uses a sophisticated bootstrap architecture to resolve circular dependencies:
316+
317+
```csharp
318+
// BootstrapUnits class provides initial unit definitions during system initialization
319+
// PhysicalDimensions uses BootstrapUnits to define dimensions without circular dependencies
320+
// Units class replaces bootstrap units with full unit definitions after initialization
321+
322+
// This clean separation enables complex type systems while maintaining performance
323+
```
324+
325+
### Derived Constants Validation
326+
327+
All derived physical constants are validated against their fundamental relationships:
328+
329+
```csharp
330+
// Example: Area conversions are validated to ensure SquareFeetToSquareMeters = FeetToMeters²
331+
[TestMethod]
332+
public void DerivedConstants_AreaConversions_MatchCalculatedValues()
333+
{
334+
var feetToMeters = PhysicalConstants.Conversion.FeetToMeters;
335+
var calculatedSquareFeet = feetToMeters * feetToMeters;
336+
var storedSquareFeet = PhysicalConstants.Conversion.SquareFeetToSquareMeters;
337+
338+
Assert.AreEqual(calculatedSquareFeet, storedSquareFeet, tolerance);
339+
}
340+
// Comprehensive test coverage ensures physical relationships are mathematically correct
341+
```
342+
282343
## 🏗️ Dependency Injection
283344

284345
```csharp

Semantics/Quantities/Acoustic/README.md

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)