Code Writing Recommendations

This article contains recommendations for application developers developing components in Foresight Analytics Platform.

The list of articles:

  1. Component Inheritance.

  2. Coding Principles.

  3. CSS Code Requirements.

  4. Component Use Scenarios.

General Requirements

Apart from features described in articles, there are general development requirements:

  1. The main libraries PP.js and PP.css must be connected above the other additional platform libraries.

  2. A component can be created on creating a class instance by means of "new". A component can be created by creating a class instance by means of "new".

  3. It is allowed to use only public methods and properties. Private methods can change their names or can be deleted.

Agreements on Names

Names of classes, enumerations, enumeration members, fields must correspond to the UpperCamelCase rule. Names of local variables, methods must correspond to the lowerCamelCase rule. Property names in event parameters must correspond to UpperCamelCase.

Structure of HTML Page

To create examples using DHTML components, follow HTML markup rules.

Set two tags in the <html> tag:

<link href="<relative path of CSS file>" rel="stylesheet" type="text/css"/>

<script src="<relative path of JS file>" type="text/javascript"/></script>

<style type="text/css">

    <container style parameters>

</style>

NOTE. Tag with style parameters is optional.

<script text="text/javascript">

    function <function name>() {

        <scenario of DHTML component use>

    }

</script>

    <div id="<component identifier>"></div>

</body>

See also:

Web Application