HeadlinesBriefing favicon HeadlinesBriefing.com

AI Codebase Design: Semantic vs Pragmatic Functions

Hacker News •
×

As AI tools reshape software development, the fundamental architecture of your codebase becomes critical. The distinction between semantic functions and pragmatic functions determines whether your code remains maintainable as teams grow and AI agents become contributors.

Semantic functions serve as the building blocks of any codebase, designed to be minimal, self-documenting, and unit-testable. These functions should take exactly what they need and return exactly what they produce, wrapping other semantic functions to create clear, reusable patterns. When logic becomes complex, breaking flows into self-describing semantic functions makes code readable without comments. Even unused functions like quadratic_formula() or retry_with_exponential_backoff provide valuable documentation for future developers and AI agents.

Pragmatic functions handle the messy reality of production systems, wrapping semantic functions and unique logic into higher-level operations. They're expected to change frequently and should include doc comments that explain non-obvious behavior rather than restating the obvious. Testing pragmatic functions falls into integration testing territory. The real danger emerges when semantic functions morph into pragmatic ones without clear naming, creating hidden dependencies that break when internals change.