Entities and relationships

During requirements analysis, we identify key objects (things of interest) around which the system is designed. In database parlance, these are called entities. They are objects that are capable of independent existence and that can be uniquely identified. While in object-oriented design the focus is on modeling behavior, entity-relationship modeling is concerned more with attributes and the relationships of entities. In entity-relationship analysis, the relationships are derived from static attributes rather than behavior/interactions, as in the case of object-oriented analysis. 

Entities can be usually identified from the nouns in the requirements. For example, in the travel website, a Hotel is a key entity. Requirement analysis gives us insights into the attributes of the entities. For example, the Hotel entity might have the following attributes:

A relationship defines how two entities are related to one another. They can usually be identified from the verbs, linking two or more nouns. For example, a Hotel can have more than one Room, each of which can be reserved at a specific date range—this implies the following relationships:

Diagrams such as the preceding one are called entity-relationship diagrams. It documents and helps to visualize how data is structured in the system.

The entities and the relationships are still at a conceptual level at early stages of requirement. However, as engineering progresses, these get crystallized into storage engine-specific databases, schemas, and other constructs. Also, as our understanding of the domain increases, the initial data design might undergo iterations, including the following:

  • Generalization: Formation of entity hierarchies to delineate various related entities
  • Normalization: Removing redundancy in the modeled entities (we'll learn about this in detail in the Relational model section)
  • Denormalization: Figuring out that redundancy is required and can help in increasing performance in certain use cases (covered in much more detail in the Scaling data section)
  • Constraints/business rules: Governance on what values entity attributes can take and the relationships between entities
  • Object relational mapper: Mapping of objects in the computation space with the entities persisted in the storage system

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset