18. Fantom Api
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
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:
- to create custom Exts
- to create Fresco Apps
- when you need lower-level access such as stream based I/O
- when you need high performance for critical code
So why did we choose to use Fantom to write SkySpark? Fantom provides a number of advantages over languages like Java:
- modern, simple clean language and library
- first class functions and closure support
- immutable types which are heavily used by the SkySpark architecture
- actor based concurrency which is the foundation for how Folio implements concurrency
- modularity via pods
- leverage the Java VM for performance on server side
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:
- sys: core Fantom system (basic scalar and collection types)
- haystack: client and server APIs for working with Haystack data model (used by Folio and Axon)
- concurrent: Actor and other concurrency APIs
- proj: server side framework for accessing projects, Axon engine, and defining custom extensions
- dom: provides access to browser's DOM
- fwt: Fantom widget toolkit defines core UI framework
- webfwt: enhancements to FWT for web browser environment
- fresco: SkySpark's Fresco UI framework built using FWT
- chart: API for building up your own chart models and visualizations
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.
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.