tailieunhanh - PATTERNS OF DATA MODELING- P7

PATTERNS OF DATA MODELING- P7: Models provide the means for building quality software in a predictable manner. Models let developers think deeply about software and cope with large size and complexity. Developers can think abstractly before becoming enmeshed in the details of writing code. Although models are beneficial, they can be difficult to construct. That is where patterns come in. Patterns provide building blocks that help developers construct models faster and better. | 2 Tree Template The tree is a term from graph theory. A tree is a set of nodes that connect from child to parent. A node can have many child nodes each node in a tree has one parent node except for the node at the tree s top. There are no cycles that means at most one path connects any two nodes. Figure shows an example of a tree. A is at the top of the tree and has no parent node. A is the parent for B C and D. B is the parent for E and C is the parent for F. Figure Sample tree. A tree organizes data into a hierarchy. There are six templates for trees. The first hardcodes an entity type for each level of the tree. The others are more abstract and use the same entity types for all levels. Hardcoded tree. Hardcodes entity types one for each level of the tree. Use when the structure of a tree is well known and it is important to enforce the sequence of types in the levels of the hierarchy. Simple tree. Restricts nodes to a single tree. Treats nodes the same. Use when tree decomposition is merely a matter of data structure. Structured tree. Restricts nodes to a single tree. Differentiates leaf nodes from branch nodes. Use when branch nodes and leaf nodes have different attributes relationships and or semantics. 11 12 Chapter 2 Tree Template Overlapping trees. Permits a node to belong to multiple trees. Treats nodes the same. Use when a node can belong to multiple trees. Tree changing over time. Stores multiple variants of a tree. A particular tree can be extracted by specifying a time. Restricts nodes to a single tree. Treats nodes the same. Use when the history of a tree must be recorded. Degenerate node and edge. Groups a parent with its children. The grouping itself can be described with attributes and relationships. Restricts nodes to a single tree. Treats nodes the same. Use when the grouping of a parent and its children must be described. Hardcoded Tree Template UML Template Figure shows the UML template for hardcoded trees. The Appendix .

TỪ KHÓA LIÊN QUAN