Child pages
  • Implementing Business Logic
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Overview

While the Servoy platform is based entirely in Java, one does not need to write any Java during the course of development or deployment.

Instead, all business logic is implemented using Javascript. Javascript was selected because it is an internet standard, easy to learn and as such, the most widely used scripting language on the planet. Javascript is far more productive than coding in pure Java and Servoy provides robust APIs with which to quickly and easily implement business logic.

Note

Developers who are familiar with Javascript may cite issues with browser support and speed of execution.

However, it is worth noting that Servoy does not deploy any Javascript. All code written in Servoy is deployed using Mozilla's Rhino project, which is an open-source, Java-based Javascript implementation.

This means that:

  1. All methods are executing in Java (orders of magnitude faster than interpreted Javascript)
  2. No business logic is ever exposed or executed in the browser, thereby eliminating browser support issues.
  3. Experienced developers can optionally use 3rd-party java APIs, mixing Java code directly in their Servoy methods.
Javascript Scopes

Scope defines the domain in which code is executed and subsequently determines the namespace by which elements are accessed. Javascript code (functions and variables) may be defined in the following two scopes:

Global Scope: Accessible via the namespace globals, i.e.

globals.createNewCustomer(); // invokes the global method

Form Scope: Accessible via the namespace forms.formName, i.e.

forms.customers.controller.newRecord();  // invokes a form object from another scope

compared to

function createNewCustomer(){  // a method defined within the 'customers' form scope

    controller.newRecord();    // invokes the same form object from within the form scope. Notice the fully qualified namespace is not required

}
  • No labels