Type-Safe Remote Service Request Handling via Closure Wrappers

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing technologies face challenges in handling request data with type safety in remote services, particularly in microservices and web applications, due to loose coupling and the loss of type information during data validation and conversion, leading to bugs and security vulnerabilities.

Innovation Solution

A data structure with entries matching incoming request types to functions, using software constructs like generics and closure wrappers to convert and validate request data, ensuring type safety by retaining concrete type information within closures rather than as parameters.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If loose coupling is used in remote services to improve flexibility and adaptability, then adaptability is improved, but type safety is lost leading to bugs and security vulnerabilities

Engineering Contradiction:
ImproveflexibilityVSAvoidtype safety
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent introduces an intermediary type conversion mechanism that sits between the loose coupling architecture and the function execution. This intermediary validates and converts request data according to the function's parameter types, ensuring type safety while preserving the flexibility of loose coupling. The conversion process acts as a mediator that reconciles the conflict between flexible data acceptance and strict type requirements.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of operation

If type information is lost during data validation and conversion, then ease of operation is improved, but reliability deteriorates due to bugs and security vulnerabilities

Engineering Contradiction:
Improveease of data handlingVSAvoidtype safety
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The patent performs preliminary type validation and conversion before executing the function. By checking and converting data types in advance, the system ensures type safety is maintained throughout the execution process. This preliminary action prevents type-related bugs and security vulnerabilities while keeping the operation simple for developers.

Inventive Principle:
Principle #10Preliminary action

3Ease of manufacture

If conventional data validation methods are used, then ease of manufacture is improved, but manufacturing precision deteriorates due to loss of type information

Engineering Contradiction:
Improveease of implementationVSAvoidtype information accuracy
Core Design Contradiction:
Ease of manufactureVSManufacturing precision

Solution Approach 1:

The patent replaces conventional mechanical type checking methods with a more sophisticated software-based type conversion system. Instead of relying on simple type assertions that lose information, the system uses structured conversion processes that preserve type information accuracy while remaining easy to implement through standardized interfaces.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS10698791B2Handling request data with type safety in a remote service
Publication Date: 2020.06.30 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US10698791B2 patent drawing
  • US10698791B2 patent drawing
  • US10698791B2 patent drawing

AI summary

Method and system are provided for handling request data with type safety in a remote service. The method includes providing a data structure, the data structure comprising a set of entries, each entry matching an incoming request type with a function for handling the request, the function defining a set of parameters. The method includes receiving an incoming request for a service from a remote client, wherein the request includes request data. The method includes using the data structure and identifying an entry for the incoming request by matching the request data to an incoming request type of an entry. The method includes converting the incoming request into a set of parameters using a software construct of the matching function identified in the entry, wherein the software construct comprises the matching function and associated in-scope local variables; and running the function using the converted parameters.