Model Inheritance Code Generation Support¶
Model inheritance is an effective approach for managing complex entity models by breaking them down into smaller, more manageable entities. This involves organizing entities into a parent-child structure, where shared attributes and logic are defined in the parent entity, while specific attributes and behaviors are isolated within each child entity. By centralizing common functionality in the parent, developers create decoupled, reusable models that streamline development and reduce maintenance overhead.
Generalization (basedon) vs Model Inheritance¶
Generalization and model inheritance are two important concepts in object-oriented programming that exhibit both similarities and differences.
Generalization | Model Inheritance |
---|---|
Duplicate the functionality. If need to implement an general method, that needs to override in all the basedon entities. | No need to duplicate the functionality. Can implement a general method in the parent and inherit it by child. |
Base entity holds common attributes and properties. | Parent entity holds common attributes, properties and logics. |
Uses one table to store the data with rowtype column | Use separate table for parent and child entities |
Multi-level hierarchy | One-level hierarchy |