Home > Metamodelling Concepts > Constant
Constants have absolutely no impact on the set of valid data structures: they are only used to name certain attribute values.
Application programmers can use these constants previously defined within your metamodels, which are intuitively clear to a human being. This results in better readable code. Nevertheless in the data container back-end e.g. integer values are actually stored which can be computed more efficiently than strings.
Hence, constants work at the border between human and machine information processing and manage the trade-off between readability and efficiency.
In SDL constants are represented as Java class members. The @constant annotation is used to characterize a class member as a constant.
Here are two simple examples:
@constant byte MALE = 0; @constant byte FEMALE = 1;
Next chapter: Custom Constraints