Object Constraint Languages
OCL is often referred to as an object analog for SQL since OCL provides a means to make queries in terms of objects. ECO uses its own OCL editor with syntax check and expression assistant in order to simplify writing type safe OCL expressions. The ECO OCL editor validates OCL expressions also against the actual model context. The following OCL expression selects company employee objects representing employees older than 30 years. If persisted object instances are not present in memory when the OCL expression is evaluated, they will be automatically loaded into memory by the ECO framework:
company.employees->select(age > 30)
Originally OCL was proposed by OMG as a means of describing constraints in UML models, but the usage area of OCL is actually much wider. In ECO OCL is used to express:
- Queries to the DB
- In-memory queries
- Evaluation expressions for derived class members (attributes and links)
- Constraints
Standard OCL is a side-effect free language in that it doesn't allow making changes to a system. For this reason ECO has an OCL extension called EAL (ECO Action Language) which makes it possible to change an object member, to call methods and even to create new object instances. EAL provides a simple means to write state machine trigger effect or a class method instead of using standard C# or Delphi.NET language. OCL/EAL functionality can be defined directly in the UML model.
Read more about this topic: ECO (Domain Driven Design)
Famous quotes containing the words object, constraint and/or languages:
“Life at its noblest leaves mere happiness far behind; and indeed cannnot endure it.... Happiness is not the object of life: life has no object: it is an end in itself; and courage consists in the readiness to sacrifice happiness for an intenser quality of life.”
—George Bernard Shaw (18561950)
“In America a woman loses her independence for ever in the bonds of matrimony. While there is less constraint on girls there than anywhere else, a wife submits to stricter obligations. For the former, her fathers house is a home of freedom and pleasure; for the latter, her husbands is almost a cloister.”
—Alexis de Tocqueville (18051859)
“The trouble with foreign languages is, you have to think before your speak.”
—Swedish proverb, trans. by Verne Moberg.