Runtime Validation via External Documentation Files
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Dynamic programming languages like JavaScript require extensive type checks and documentation, leading to cluttered code and performance issues due to their loose typing and runtime type determination, making debugging and maintenance challenging.
Innovation Solution
An object validation system that uses a document file to store validation information, allowing for runtime validation of function parameters, return values, and properties, eliminating the need for repetitive type checks within the code and generating human-readable documentation from these documents.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If type checks and validation code are added to ensure correctness in dynamically-typed languages, then reliability is improved, but device complexity increases due to cluttered code with numerous if checks
Solution Approach 1:
The patent extracts validation logic from the source code into separate documentation files (e.g., JSON, YAML, XML). The documentation contains type definitions, parameter validations, and return value checks that are separated from the actual code, reducing code clutter while maintaining reliability through external validation rules.
Solution Approach 2:
The patent introduces documentation files as an intermediary between the source code and validation requirements. These documentation files serve as a mediator that defines validation rules without being embedded in the code, allowing the code to remain clean while still enforcing type safety and correctness through the intermediary documentation layer.
2Ease of operation
If documentation is placed within source code as comments, then ease of operation is improved by having documentation available, but device complexity increases due to verbose code mixing documentation and implementation
Solution Approach 1:
The patent extracts documentation from source code comments into separate documentation files. This allows documentation to be easily accessible and maintainable without being embedded in the code, reducing code verbosity while preserving documentation availability through external files that can be referenced by the code.
3Reliability
If extensive type checks are performed at runtime in dynamically-typed languages, then reliability is improved, but productivity decreases due to performance overhead from frequent validation checks
Solution Approach 1:
The patent performs validation checks preliminarily by defining type schemas and validation rules in documentation files before runtime execution. The validation logic is prepared in advance based on the documentation, allowing for more efficient runtime checking compared to ad-hoc if checks scattered throughout the code. This preliminary preparation of validation rules improves both reliability and performance.
Data Source
AI summary
The described technology is directed towards having document files (e.g., a JSON object) associated with objects of a computer program. The document files may include validation information that is used during runtime to validate one or more parts of the object via validation code such as a validation function. For example, a function of an object may have one validation function that during runtime validates whether the input parameter(s) are valid (their types and/or values are correct), and another validation function that during runtime validates whether the return values from the function are valid. Also described is processing the document files into more easily readable documentation, e.g., without any source code.


