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:
“Man you can define; but the true essence of any man, say, for instance, of Abraham Lincoln, remains the endlessly elusive and mysterious object of the biographers interest, of the historians comments, of popular legend, and of patriotic devotion.”
—Josiah Royce (18551916)
“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)
“Science and technology multiply around us. To an increasing extent they dictate the languages in which we speak and think. Either we use those languages, or we remain mute.”
—J.G. (James Graham)