Browse Prior Art Database

Transparent Support for Synchronous Business Logic writing for Asynchronous Operations in Hybrid Mobile Applications

IP.com Disclosure Number: IPCOM000237050D
Publication Date: 2014-May-29
Document File: 8 page(s) / 84K

Publishing Venue

The IP.com Prior Art Database

Abstract

Disclosed is a method that enables a programmer to write code that mixes synchronous with asynchronous operations without having to break the flow of the code before completing the asynchronous operation. The core idea is to instrument all functions of a program using Aspect Oriented Programming (AOP), and make each return a promise; thus, a function is only called upon the fulfillment of the promise of the previous function.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 24% of the total text.

Page 01 of 8

Transparent Support for Synchronous Business Logic writing for Asynchronous Operations in Hybrid Mobile Applications

Developers face multiple challenges when developing a mobile application. One challenge is to successfully run the applications in multiple platforms with minimum code rewrite. The most common approach to accomplish this is to use a hybrid approach (i.e. mix of web and native code) for the mobile application, pushing as much as possible the code to the web side in order to gain portability.

Another challenge is successfully executing an application's business logic offline, so the application can perform most functions

while disconnected from the enterprise server. While leveraging the portability of a hybrid approach, the mobile application must allow application developers to write business logic that runs on the web side of the application. The obvious conclusion is to write the business logic in JavaScript*, which adds to the complexity of the already-difficult task of writing (and learning) business logic. JavaScript is dynamic and complex language; however, considering that business logic is all about data manipulation and user interface (UI) feedback, if the application exposes simple and easy-to-use Application Protocol Interfaces (APIs) to accomplish these tasks, then the use of JavaScript might not be a problem.

The complexity of writing business logic is increased by the underlying platform on which it will be executed, that is, the web browser running the JavaScript engine.

The main problem is that JavaScript is single-threaded, and this affects the way code manipulates data (the core task of most of the business logic in a mobile application).

This is different from a server-side code written in languages such as Java*. A user can synchronously run a query on a database and block the thread until that request completes before continuing the code flow , whereas, in JavaScript, all APIs for data manipulation are designed to run asynchronously, in order to not block the main thread.

The main problem addressed in this article is that JavaScript code for data manipulation is asynchronous -aware; the developer must explicitly break the flow of the code that consumes the data requested or completes the data update .

The novel contribution is a method that enables a programmer to write code that mixes synchronous with asynchronous operations

without having to break the flow of the code before completing the asynchronous operation , according to any specific strategy mentioned above. The programmer writes code in functions/procedures (as in any modular code), and then calls the associated functions in the normal sequence. This includes passing the result of a function as the argument of another function .

The method uses aspect-oriented programming [1] together with promises/future strategy [2], to capture all functions as joint points

1


Page 02 of 8

and instrument those functions with an "around" advice. Thus,...