Libraries

Real world applications are often made up of hundreds or thousands of root software elements (RSEs). Therefore it is important to logically organize them in a hierarchy of groups, sub-groups, sub-sub-groups, and so on. This is done with libraries.

A library contains any number of RSEs that belong to a logical group of RSEs. A library can also recursively contain other libraries, called child libraries. There is no limit as to the level of child libraries.

It is up to the programmer to define the tree of libraries for his application. A simple example of a library structure in an ERP application could be the following:

library ERP
    library sales
        type customer
        factory customer
    library inventory
        type product
        factory product
    library utilities
        library logging
            service logger
        library error_handling
            service error_handler

Each library physically corresponds to a directory in the file system. The directory name for a library always starts with li_, followed by the library's identifier. Thus the above structure would result in the following directories and files:

li_ERP                            (directory)
    li_sales                      (directory)
        ty_customer.osc           (file)
        fa_customer.osc           (file)
    li_inventory                  (directory)
        ty_product.osc            (file)
        fa_product.osc            (file)
    li_utilities                  (directory)
        li_logging                (directory)
            se_logger.osc         (file)
        li_error_handling         (directory)
            se_error_handler.osc  (file)
[Note]Note
Libraries in Obix are similar to packages in Java or namespaces in .NET. However, Obix source code files don't contain statements like package and import in Java or namespace and using in C#. The library of a software element is implicitly defined through its location in the file system, and the compiler automatically finds software elements in other libraries. Hence, the programmer is relieved from writing package and import or namespace and using statements. Thus, in case of modification of the structure, when directories are changed and files are moved, the source code doesn't have to be adapted. Only in case of a duplicate identifier of two software elements in different libraries, the library path has to be explicitly specified in the source code (e.g. li_ERP.li_utilities.li_logging.se_logger), so that any ambiguity is eliminated.