SkySpark by SkyFoundry

18. Fantom Api

Introduction

The SkySpark software is written in the Fantom programming language, which is an object oriented language designed as a "next generation" Java. If you are familiar with Java or C# you will find it easy to learn. The core SkyFoundry engineering team manages Fantom as an open source project. You can learn more about Fantom and get involved with the community at http://fantom.org.

Fantom vs Axon

As a general rule, most system functionality is accessed and scripted using Axon. Fantom is used when you want to drop down to a lower level and create your own Exts and Apps.

By design, Axon is limited to high level scripting functionality. Only limited, controlled access is exposed to low-level functionality such I/O with the file system or network. Fantom on the other hand provides a more extensive, lower level API for working with the system.

Here is a summary when you will use Fantom instead of Axon:

Why Fantom

So why did we choose to use Fantom to write SkySpark? Fantom provides a number of advantages over languages like Java:

The last two points are perhaps the most important: Fantom code can be compiled to run on both the Java VM and compiled into JavaScript to run in browsers. This means many Fantom APIs can be used seamlessly in both environments. We'll cover this in a bit more detail in the Client vs Server section.

API Overview

SkySpark ships with the standard Fantom library pods, its own core pods for SkySpark, and a pod for every standard extension. Some of the key pods you will use for SkySpark development:

Client and server side:

Server side:

Client side:

Client vs Server

We use the term server side to indicate code which runs in the Java VM as part of the SkySpark daemon process. Server side code accesses the Folio database using in-process APIs like Proj. Extensions always run in-proces server side.

We use the term client side to indicate code which is compiled into JavaScript and runs in the web browser. Client side code is limited to functionality available in the browser environment and is single threaded. All access to the database and analytics engine is down over the network using the Rest API via methods such as App.eval.

Fantom APIs are only available in the browser if they are explicitly annotated with the @Js facet. If the Fandocs for a given class do not indicate this facet, then that API is only available server side.