ECO (Domain Driven Design)
Developer(s) | Capable Objects AB |
---|---|
Operating system | .NET Framework / Microsoft Windows |
Type | Software framework |
Website | http://www.capableobjects.com |
ECO (Enterprise Core Objects), is a software framework suited for Domain-Driven-Design (DDD) from Capable Objects AB, designed to increase productivity by utilizing facilities such as Object-relational mapping (ORM) for persisting domain objects, UML models for domain classes and executable State Machines for behavior control defined in UML notation. The ECO framework is intended to be an all-in-one solution for enterprise development and includes in-memory transactions and Undo/Redo functionality as well as easy binding with UI layer. ECO unites ORM framework and UML modeling tools with instant code generation and an OCL expression evaluator for simplified in-memory and DB queries, business rules and other useful facilities.
ECO5 is targeted to .NET Framework and is only available for development environment Visual Studio. Users of RAD Studio can still download ECO4.
Contents
Modeling
A true model-driven environment model is a central part of an ECO application. The developer alters the model and the changes are applied automatically to the underlying implementation. This allows developers to concentrate on the problem domain model instead of drowning in the implementation specifics. In particular there is no need to take care of database design which makes ECO applications more object-oriented and less database-oriented. Model construction in ECO is done in visual UML editor. The corresponding code is generated on the fly in either C# or Delphi.NET languages.
There are two model types supported by ECO: class diagrams and state diagrams. Class diagrams are used to define static description of a system. On the other hand, state diagrams describe possible states of an object and transitions between them. Thus state diagrams describe behavioral aspects of a system.[1]
Object persistence
ECO performs object-relational mapping based on metadata which is taken from the model or from an xml file. It implements such advanced object persistence features as caching, lazy load and others. Mapping scheme is configurable enough to use ECO with existing databases. Database reverse engineering wizard as a part of ECO helps with this task.[2]
ECO automatically keeps track of all unsaved changes to the objects and provides simple means for the programmer to propagate these changes to the persistent storage, for example using the following command:
ECOSpace.PersistenceService.UpdateDatabase();
Using OCL simplifies loading objects from the persistent storage. The example code below uses the OCL expression "Person.AllInstances
" to load all instances of the class named "Person"
in the UML model:
IObjectList people = ECOSpace.OclService.Evaluate("Person.AllInstances");
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.[3] 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.
Binding to user interface
ECO contains components for easy linking user interface controls to the domain objects. These components are so called handles.[4] There are different types of handles in ECO. One of the most useful is expression handle which allows populating user interface controls with the results of an OCL expression. For example, it is possible to show all people with name containing "John" by a handle with following expression:
Person.AllInstances->select(fullName.sqlLike('%John%'))
.
View models
One of the latest features in ECO is Viewmodels. It can be used to quickly prototype a GUI directly from a model. No code at all need to be written. Instead the model is used as base the developer can place components on a matrix. The prototype can then be run directly to get a feeling for he application. Data is loaded and saved in a xml-file. This model can then be used directly in an application for Winform or WPF.
By making use of .NET data binding architecture ECO allows binding to any .NET controls including third-party visual components. There are several examples of how to use ECO with some popular user interface component libraries.[5][6]
Further reading
- Whitepaper on development with ECO
- Introductory article to ECO by Peter Morris
- Video overview of ECO
- ECO resources list
- CodeGear Developers Network articles on ECO
- ECO developers’ team homepage
- ECO Newsgroup
- Alois Schmid's ECO Book
- ECO Tutorial: drawing the UML Class diagram, using a Datagrid, evaluating OCL - Felix COLIBRI
- (Then) 11-year-old Alexandra Jarvis demonstrates ECO. "ECO is childs play"