Reusability and Modularity
Best practices for reusability and modularity in Hedera Guardian schemas focus on designing schemas and modules that are independent, focused, and easily composable, enabling efficient management and scaling of sustainability projects.
Reusability Best Practices
Define Standardized, General-Purpose Schemas Create schemas that can be used across multiple methodologies and policies, e.g., Emission Reduction Schema, Project Description Schema. Promote standard field definitions and controlled vocabularies for interoperability.
Avoid Redundancy Use shared schemas whenever possible rather than duplicating similar data structures in multiple places. This reduces maintenance overhead and ensures consistency across projects and registries.
Parameterize for Flexibility Design schemas with configurable fields (enums, optional fields) that allow customization by projects without requiring new schema definitions, enabling broad applicability and adaptation.
Version and Document Carefully Provide clear versioning and documentation so users understand schema capabilities and when to upgrade or extend them for specific project needs.
Modularity Best Practices
Single Responsibility Principle Each schema or module should focus on a single concept or data entity (e.g., project metadata, monitoring report, verification document). This enhances clarity and maintainability.
Encapsulate Functionality Group related fields and logic into distinct schema modules that can be reused or replaced independently without impacting the entire ecosystem.
Low Coupling, High Cohesion Minimize dependencies between modules so changes in one do not ripple across others. Use well-defined interfaces (field keys, enums) to connect modules cleanly.
Organize Code and Schema Files Logically Structure schema repository or project directories by logical modules, simplifying navigation, updates, and testing.
Write Unit Tests for Modules Test schema modules independently to ensure their correctness and facilitate safe reuse.
Last updated
Was this helpful?