Mastering Data Modeling with Liferay Objects

Course Overview

Modeling Data Structures with Liferay Objects

The first step in building an application is to model its data structures. This requires some brainstorming about the types of data entities you want to store, as well as their attributes and relationships. Once determined, you can implement your data structures as discrete Liferay objects. Then you can add custom business logic and continue to iterate on your structures as your application evolves.

Using Liferay objects, you can build a robust and flexible foundation for your solution that can support the specific needs of your organization.

Identifying Data Entities

Data entities represent discrete types of information stored and used within an application, such as a 'customer' in an e-commerce solution. Each entity has specific attributes (e.g., name, email) that determine the data it stores. As mentioned previously, you can implement data entities as object definitions. These objects can be anything from insurance claims and support tickets, to courses and commerce products.

Adding Attributes

Attributes represent database columns that store specific types of information for an application, such as text, numeric, and date values. Defining attributes for data models involves adding fields to object definitions for receiving user input. Additionally, you can create picklists and use them with objects to provide users with predefined single-select and multi-select fields. You’ll explore object fields more thoroughly in Module 2.

Defining Relationships

Defining relationships is key to creating data models that accurately represent real-world entities. They determine how data is connected in your application and capture entity interactions and dependencies. You can define one-to-many and many-to-many relationships between definitions. These relationships add fields or tables to each object for relating their entries, enabling you to access entry data in different object contexts. You’ll explore object relationships more thoroughly in Module 3.

Best Practices for Data Modeling with Liferay Objects

Effective data modeling is essential to successful Liferay Object implementations. Understanding alternative techniques can ensure your solutions are efficient, adaptable, and work seamlessly across Liferay DXP.

Two Schools of Thought

Data modeling is often characterized by two competing perspectives:

  • Normalized Modeling: Originating from relational database management systems (RDBMS) and online transaction processing (OLTP) applications, this approach favors smaller, interconnected objects. It minimizes data duplication and retrieves data only when necessary, relying on the RDBMS's efficient joining capabilities. With this approach, a model's success generally depends on its level of normalization with Third Normal Form (3NF) as its baseline to ensure data integrity and storage efficiency. However, even the best RDBMS with excellent join performance degrades when processing tables with thousands or millions of rows that require joining to additional tables.

  • Denormalized Modeling: Commonly used in reporting platforms and online analytical processing (OLAP) applications, this approach favors larger, self-contained objects. It prioritizes retrieving complete entities, even with potential data duplication, to optimize read performance, especially with large datasets. Denormalized models often employ a flattened structure, reducing the need for joins and other database operations. This leads to improved performance for data reads—a crucial advantage for systems handling extensive data volumes.

With Liferay Objects, the denormalized approach is recommended for optimal performance. Whether you’re using Liferay’s page builder features to display object entries or building an application that uses headless APIs for retrieval, this model minimizes the need to access related data through separate calls. By reducing or eliminating extra data requests, this approach can significantly improve performance.

Guiding Principles

To optimize data modeling with Liferay Objects, consider these guiding principles:

  • Start with Complete Entities: Design each object as a comprehensive, self-contained entity, encapsulating all its relevant attributes in a flattened structure.

  • Minimize Object Fragmentation: Resist the urge to break objects into smaller units, since this can lead to performance drawbacks.

  • Use Relationships Strategically: Employ relationships primarily when dealing with repeating data. Define the repeatable data as separate objects and establish relationships to link them.

  • Separate Objects by Permission Needs: Break up an object when distinct parts require different permissions (e.g., view, update, delete).

  • Use Clear Naming: Use descriptive names to avoid ambiguity or confusion. Prioritizing clarity over brevity can improve long-term usage and maintainability.

While not exhaustive, these principles provide a solid framework for designing effective and maintainable data models with Liferay objects.

Conclusion

Effective data modeling is the cornerstone of successful Liferay Object implementations. By embracing denormalization principles and adhering to best practices, you can create robust, adaptable solutions that promote maintainability and improve performance. Next, you’ll see how Clarity's apps can implement the principles you’ve learned.

  • Identifying Data Entities

  • Adding Attributes

  • Defining Relationships

  • Conclusion

Loading Knowledge

Capabilities

Product

Education

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy