Skip to content

Function DSL

The platform independent DSL “Function” defined module types, element types, member types and options, that are used to define interfaces to access or call business logic. Here you can see all defined types.

Module-Types Element-Types Member-Types
Function function
  • in
  • out
  • exception
Service service none

In the following you find the types and their options described in more detail.

Module-Types

Function

Example:

...
module MyModule kind = Function;
...

Options for Module-Type “Function”

Option Option-Type Description
Data Reference, multi valued References a “module”, wherein “entity” elements have been modeled by means of the DSL “Persistence”. With this a generator knows the data structure that the module of type “Function” is responsible for. This allows a generator to create “function” elements, that go together well with the data structure. You don’t need to model those functions explicitely.
ProvidedServices Reference, multi valued References a modeled “service”. With this you express that the module of type “Function” provides this “service”.
ConsumedServices Reference, multi-valued References a modeled “service”. With this you express that the module of type “Function” calls/consumes this “service”.

Service

Example:

...
module MyModule kind = Function, Service;
...

Element-Types

function

A “function” element is going to be used to define an interface. The term “interface” here has a more general, broader meaning as compared to its usage with programming languages. Typcially, a generator creates code for “function” elements, where a developer manually adds business logic.

“function” elements can have “in”, “out” and “exception” as members. Like with “field” in the DSL “Basic”, you can assign a data type to “in” and “out” members. That data type can be either a “type” or a data type that inherits from “type” (e.g. “entity” in the DSL “Persistence”).

Example:

function getPersonsForBirthday {

    in gender : Gender;  // enumeration
    in startDate : Birthday;
    in endDate : Birthday;

    out persons : Person {  // entity
        set CollectionType = Set;
    }

    exception NoPersonFound;
}

Options for Element-Type “function”

Option Option-Type Description
DataIn Reference, multi valued References “field” members, that can be owned by a “type” or an “entity”. For these fields a generator implicitely creates “in” and “out” members. By referencing “field” members, a reuse of already modeled information is accomplished. Also, the model is getting more compact by this. The referenced “field” members don’t need to be owned by the same element. The “DataIn” option deliberately allows to mix different data definitions, which in turn caters for a more flexible, use-case oriented modeling.
DataOut Reference, multi valued see above

Members and Member-Options for Element-Type “function”

Member: in

An “in” member defines an input parameter for a “function” element. It is similar to an input parameter of a method/function in a programming language.

Option Option-Type Description
CollectionType Enumerated, single valued Possible value: Array, List, Set, SortedSet
Data Reference, single valued References a “field” member of a “type” or an “entity” element. With this, a generator knows that the data needs to be persisted, the used data type, which validation should be done and where the data should be written to

Member: out

An “out” member defines a return parameter for a “function” element. It is similar to a return parameter of a method/function in a programming language. You can define as many “out” members as you want for a “function” element. It is then the generator’s decission how to handle this situation.

Option Option-Type Description
like with “in” - -

Member: exception

An “exception” member defines an exceptional situation, that can occur in the modeled “function”. “exception” does not mean a technical problem here (bug, low resources, etc.) but an exceptional case that is related to the business logic of the software under development. When software for a bank would be developed, there could for instance be an “exception” named “NoMoneyOnAccount”.

Option Option-Type Description
no options - -

service

A “service” element is going to be used to be able to name an abstract service and to define, which function provides and which function calls/consumes a “service”. “service” elements do not have any members.

Options for Element-Type “service”

Option Option-Type Description
no options defined - -