A data entity is a part of a system that holds information independently of the functions operating on it. In data-oriented programming, entities contain members but no code; stateless functions receive them explicitly as arguments. section 2.1 section 2.2
Start with the workplace problem: a class that mixes state, behavior, and many relationships is difficult to understand. Splitting its data from its code creates two simpler parts that can be considered separately. section 1.2.1 section 2.4
Discover and organize data entities by following a few practical moves:
- Scan requirements for nouns and noun phrases that represent information, such as users, members, books, authors, and book copies. section 2.2
- Group related entities into high-level areas, such as user management and catalog data. section 2.2
- Keep relationships among entities to association and composition, while placing behavior in code modules with usage relationships. section 2.6
- Pass entity data into stateless functions rather than hiding it as implicit object state. section 2.6
Library Management System
A catalog can hold data about books, authors, book items, and lendings; user management can hold data about users, members, and librarians. A function such as getBookLendings receives libraryData and memberId, while catalog and user-management modules perform the behavior. Adding permissions for Super members or VIP members changes functions without changing the overall data design. section 2.2 section 2.5
Use the entity mind map to see how requirements become grouped information areas before code is designed. section 2.2
