tailieunhanh - PATTERNS OF DATA MODELING- P27

PATTERNS OF DATA MODELING- P27: 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. | Derived Data Antipattern 113 Author I I I I I I I I I LibraryCard libraryCardID Checkoutitem checkoutltemlD returnDate checkoutID FK libraryltemCopylD FK LibraryitemCopy libraryltemCopylD copyNumber libraryltemlD FK librarylD FK expirationDate personID FK librarylD FK cardNumber I I Library librarylD libraryName Figure Derived data IDEF1X library model. Figure shows a proper use of derived data for a fact table of a simple data warehouse. The gross profit is the retail price less the wholesale cost. 114 Chapter 9 Non-Data-Warehouse Antipatterns SELECT AS dueDate calculatedFine CASE WHEN CAST - AS int 0 THEN CAST - AS int ELSE 0 END FROM Checkoutitem AS CI INNER JOIN LibraryitemCopy AS LIC ON INNER JOIN LibraryItem AS LI ON INNER JOIN LibraryItemType AS LIT ON INNER JOIN Checkout AS C ON WHERE aCheckoutItem Figure Derived data Sample SQL code. Sale retailPrice wholesaleCost grossProfit Figure Derived data Sale fact in a data warehouse. Derived data is often acceptable for data warehouses. Parallel Attributes Antipattern Observation An entity type has groups of similar attributes. Such a model can be brittle verbose and awkward to extend. Exceptions Parallel attributes are often used for data warehouses to ease data retrieval. Data warehouses forego the enforcement of data quality leaving that responsibility to the feeder applications and scripts that load data. Parallel Attributes Antipattern 115 Resolution Abstract and factor out commonality. Examples Figure is taken from a legacy application. The repetition is obvious. An organization has different kinds of products for which .

TỪ KHÓA LIÊN QUAN