Beautiful Code [254]
Besides using basic CMF features, ERP5 also implements some extra features to enhance programming productivity. Perhaps the most interesting is the concept of relationship managers, which are objects responsible for keeping the relationships between pairs of objects. Coding relationship logic into each business class is often tedious and error-prone. Also, traditional relationship code spreads the implementation (back-pointers, deletion notifications, and so on) among many business classes, which is more difficult to track, maintain, and keep in sync than mediated approaches.
In ERP5, a portal service called Portal Categories records all the one-to-one, one-to-many, and many-to-many relationships between groups of related objects. Query methods, getters and setters, and relationship code are automatically generated.
This service holds base category objects, which connect classes that collaborate to carry out a given business process. For every base category, ERP5 automatically generates all necessary getters and setters. As an example, the base category source is a reference for objects of the Node type. If, in a given ERP5 implementation, the class Order is configured to have this base category, the system will automatically include all the methods and references necessary to navigate from orders to nodes, and vice versa if desired.
ERP5: Designing for Maximum Adaptability > ERP5 Project Concepts
21.4. ERP5 Project Concepts
To exemplify how ERP5 modules are coded, we'll spend most of the rest of this chapter exploring ERP5 Project, a flexible project management tool that can be used in many ways.
Due to the fast and competitive global business environment, projects are the usual form through which businesses develop innovative products and services. Therefore, project management is gaining interest in every industry segment.
But what is a project? According to Wikipedia, a project is "a temporary endeavor under-taken to create a unique product or service" (http://en.wikipedia.org/wiki/Project, last visited April 13, 2007).
The uniqueness of projects makes their management difficult, even for a small project sometimes. Hence the need for project management, which is "the discipline of organizing and managing resources in such a way that these resources deliver all the work required to complete a project within defined scope, quality, time, and cost constraints" (http://en.wikipedia.org/wiki/Project_management, last visited April 13, 2007).
Project management therefore must control a series of data related to resources such as money, time, and people to keep everything going as planned. Because of this, information tools are needed to ease the analysis of large amounts of data.
The first use for ERP5 Project was as an "internal" project management tool to support ERP5 instance creation projects. Afterwards, it was redesigned to support other types of projects in general. Even more broadly, this tool can manage order planning and execution wherever a project viewpoint can aid production planning and control. In other words, ERP5 Project should be adaptable to every situation where it is interesting to think in terms of a project composed of a series of tasks and limited by a series of constraints.
ERP5 allows the developer to reuse the current packages in delivering other packages as completely new modules. Following this concept, a new business template (BT) is created by basing it on an existing one.
By the time ERP5 Project started to be implemented, ERP5 already contained the Trade BT. The development team thus decided to base Project on Trade, representing the planning part of a project by reusing the logic developed for trading operations. After finishing the first Project version, they could improve the Project BT and then use the improvements to refactor Trade BT, making it yet more flexible.
In building Project, the interesting parts of Trade are the Order and Delivery classes.