Chapter 2. Source code

Table of Contents

Source code files
Libraries

Source code files

Source code is plain text written by a programmer in order to define types, factories and services.

Each root software element (RSE) is stored in a separate file, called source code file.

Source code files contain plain ASCII text. Their name start with a prefix as defined in the table below, followed by the RSE's identifier

Table 2.1. Source code file name prefixes

File name prefixContent of fileLinks
ty_typethe section called “Type”
fa_factorythe section called “Factory”
se_servicethe section called “Service”
ge_generic type, factory or service (see TODO)Chapter 19, Generic types
te_source code template (see TODO)Chapter 20, Source code templates

All source code files have the file extension osc.

Thus, the source code for type customer would be stored in file ty_customer.osc, the source code for factory customer would be stored in file fa_customer.osc, and service error_logger would be stored in file se_error_logger.osc.

To execute Obix programs, the source code must be compiled by the Obix compiler that converts the source code into executable binary code. The compiler first checks the correctness of source code (syntax, grammar and semantic rules) and displays any errors. If no errors are found, then the Obix compiler first creates Java source code, called target code (files with .java extension), and then calls a Java compiler to create Java binary code (files with .class extension). The binary code can then be executed on any machine with a Java Runtime Environment (JRE) installed.

For a first simple example of source code, see Chapter 3, Simple example, or have a look at the numerous examples in the subsequent sections of this document.

For instructions on how to edit, compile and run your own code or examples in this document, please refer the tutorial: Obix programming language tutorial.