Source Code Transformer for JavaScript to Apex Conversion

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

JavaScript code struggles to leverage the domain-specific characteristics and benefits of a multitenant enterprise platform, such as security, transactional context, and performance, due to divergences in language features and development speeds between JavaScript and Apex, leading to productivity gaps for application and platform developers.

Innovation Solution

A source code transformer is implemented to automatically convert JavaScript code into optimized Apex code, bridging the gap between the two languages by incorporating modern JavaScript features and Apex best practices, enabling application developers to write code in JavaScript and transform it into Apex for enhanced platform utilization.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If JavaScript code is used for development, then development speed and ease of writing code are improved, but the ability to leverage domain-specific characteristics and benefits of the multitenant enterprise platform deteriorates

Engineering Contradiction:
Improvedevelopment speedVSAvoidability to leverage platform characteristics
Core Design Contradiction:
ProductivityVSAdaptability or versatility

Solution Approach 1:

The patent introduces Apex as an intermediary language between JavaScript and the multitenant enterprise platform. JavaScript code is transformed into Apex code, which then interacts with platform-specific services and data models. This intermediary approach allows developers to write code in JavaScript while still leveraging platform characteristics through the Apex transformation layer.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The transformation process changes the language parameters from JavaScript to Apex, converting syntax, data structures, and programming patterns. This parameter change enables the code to access platform-specific features like Salesforce data models, security contexts, and transactional capabilities while maintaining the original development workflow in JavaScript.

Inventive Principle:
Principle #35Parameter changes

2Ease of operation

If JavaScript code is used, then ease of operation and familiarity for developers are improved, but security and transactional context optimization deteriorates

Engineering Contradiction:
Improvedeveloper familiarityVSAvoidsecurity and transactional context
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

Apex serves as a security-aware intermediary that enforces platform security models and transactional contexts. When JavaScript code is transformed to Apex, it automatically inherits Apex's built-in security checks, user context management, and transactional guarantees, ensuring reliable and secure operations on the multitenant platform.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Reliability

If manual Apex code writing is required, then platform optimization is improved, but productivity and development time deteriorate

Engineering Contradiction:
Improveplatform optimizationVSAvoiddevelopment time
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The transformation system performs automatic conversion of JavaScript code to Apex code without requiring manual intervention from developers. The system self-services by analyzing JavaScript syntax and semantics, applying transformation rules, and generating optimized Apex code automatically, thereby maintaining productivity while achieving platform optimization.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The transformation framework performs preliminary analysis and preparation of JavaScript code before conversion to Apex. It pre-processes the code to identify patterns, data structures, and logic flows that need transformation, enabling efficient automatic conversion while ensuring optimal Apex code generation for the target platform.

Inventive Principle:
Principle #10Preliminary action

4Ease of manufacture

If JavaScript is used for rapid development, then ease of manufacture is improved, but performance optimization on the multitenant platform deteriorates

Engineering Contradiction:
Improverapid developmentVSAvoidplatform performance
Core Design Contradiction:
Ease of manufactureVSSpeed

Solution Approach 1:

The transformation process changes performance-critical parameters by converting JavaScript code to Apex code that is optimized for the multitenant platform's execution environment. This includes optimizing data access patterns, leveraging platform-specific caching mechanisms, and generating efficient SQL queries that improve runtime performance while maintaining the rapid development benefits of JavaScript.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS10866791B2Transforming non-Apex code to Apex code
Publication Date: 2020.12.15 SALESFORCE INC
  • US10866791B2 patent drawing
  • US10866791B2 patent drawing
  • US10866791B2 patent drawing

AI summary

Source code of a first high-level language is received and analyzed. The source code of the first high-level language is transformed into source code of a second high-level language. The source code of the second high-level language is customized to a specific organization among a plurality of organizations that are hosted in a multitenant platform. At least a portion of the source code of the second high-level language is caused to be compiled into low-level code for execution in the multitenant platform.