Start page / Template development / Scripting / Code style

Code style

“Codestyle” denotes the style of the programming. To make scripts legible for other developers and above all to make them maintainable, a good style, i.e. a good code style, should be maintained in scripting. Several minor rules help to keep an overview in a script.


If certain areas of a script, for example the summary of the declaration of global variables or the import of classes, are grouped together in specific places, these could be called a block. These blocks substantially increase the clarity of a script.


// Imports
import java.myclass;

// Global variables
foo = "bar";
bar = 0;

// Methods
myMethod() {
print("this is my method!");

// Script start


Indented script code increases legibility. To ensure uniform indentation for developers with different editors, ideally tabs only should be used for indentation and not spaces.


As in every other programming language, documentation of the source code is an enormous help in the event of subsequent extension or debugging of a script. Therefore, the function of smaller or particularly complicated sections of a script should be well documented.


// Single row comment

/* Multi-row
comment */

© 2005 - 2023 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2023.2 | Data privacy