databases data modeling lectures for students of
play

Databases Data Modeling Lectures for students of mathematics - PowerPoint PPT Presentation

Databases Data Modeling Lectures for students of mathematics Zbigniew Jurkiewicz Institute of Informatics UW March 26, 2017 Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics All models are wrong, but some


  1. Databases Data Modeling Lectures for students of mathematics Zbigniew Jurkiewicz Institute of Informatics UW March 26, 2017 Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  2. “All models are wrong, but some are useful.” George Box Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  3. What is the best way to build applications ? The fact that a system works well should be nearly invisible for its users (unless it breaks). Examples: bathroom lift (elevator) Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  4. Phases of the project Agree with users upon requirements for the system to be 1 built. Describe the agreed requirements in the form of 2 specification . Design the architecture of the system and the methods of 3 its realization. Implement the system and deploy it. 4 Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  5. Data modeling When modeling the requirements and describing typical use cases the analysts discover many various data objects. With object-oriented approach objects are modeled using class diagrams, usually with UML notation. In the databases field however there is a simpler (and much older) approach based on Entity-Relationship Diagrams (ERD). Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  6. Entity-Relationship Diagrams (ERD) Entity-Relationship Diagrams were first described by Bachman and Chen. They should describe the associations between stored data, i.e. such data, which cannot be derived from other stored data. Now used mostly for modeling data bases during physical design. Two main components: entities, describing (in a simplified way) real objects of interest from a modeling domain; relationships between entities. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  7. Figure : Example ERD Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  8. Entities Entities are used to model objects. An example: Figure : Example entity Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  9. Relationships Relationships connect two or more entities. Most often the relationships are binary. An example: Figure : Example relationship Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  10. ✸ ✸ ✷ ✶ ✶ ✶ ✶ ✸ ✲ ✦ ✻ ✆ ERD — object-oriented extensions Some entities are similar to subclasses in object-oriented approach, e.g. the goods sold by some company (modeled as entity Product ) could be divided into hardware, software and office materials. Some relational database systems (e.g. PostgreSQL) can represent such hierarchies of tables, but the subclasses should be disjoint. �✂✁☎✄✝✆✟✞ ★✪✩✏✫✭✬✯✮✱✰ ✞✖☛✎✌✎✗ ✠✡✆✟✞☞☛☎✌✎✍✏☛✒✑ ✓✕✔ ✍✤☛✒✑ ✢✎✧ ✘✟✙✛✚✛✜✛✢✛✣✤✣✒✥ ✸✺✹ ✳✵✴☎✫✭✬✯✮✱✰✕✮ Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  11. Hierachical entities — realization It is not enough to model entities with a hierarchy, we have to decide how we would like to implement them. Possibilities are: one common table; only separate tables for subtypes; common table + tables for subentities. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  12. Exclusive relationships An example: the invoice is associated with such relationship to either a company or a physical person (the customer). Implementation: two (or more) fields with foreign keys for the relationships + consistency constraint: all of them except one must be NULL one common field with a foreign key (types must match) + additional selecting attribute Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  13. Database design Discovering attributes and dependencies, grouping into “objects”. Mapping entities and relationships into tables Normalization and denormalization. Tuning the database, defining the access paths. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  14. Database design Two activities of the design, which interest us most, are logical design of database and physical design of its implementation. Logical design is concerned with defining tables, determining the access paths for tables (e.g. indexes) and matching indexes to application needs. Using views greatly simplifies the design of forms and reports, so views should be planned too. Physical design should decide about distribution of data into files and disks, archivization (backup) and restoring plans, and the integration with the mechanisms and tools of the operating system. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  15. UML: object-oriented approach to modeling UML ( Unified Modeling Language ) was designed by Booch, Jacobsen and Rumbaugh. In 1997 Object Management Group accepted UML 1.1 as one of their industry standards. UML covers two aspects of modeling: static: the system structure; dynamic: the system behavior. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  16. Class diagrams They serve to model the structure of the system. Used during business modeling (for modeling objects in the domain of the system) design (esp. database design), when more “technical” classes are introduced reverse engineering Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  17. Class diagrams The main ingredients are classes with names. The simplest represention of class contains nothing else. But usually in addition to name the class also contains attributes methods. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  18. Class diagrams: associations Kinds: Association Aggregation and composition Inheritance Dependency Refinement: used for realization or more detailed description Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  19. Class diagrams: aggregations and compositions A class may be connected with many superior classes using aggregation relationship, but with only a single superior class using composition relationship. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  20. Dependencies Dependency relationship between two classes means that those classes have no other association, but the dependent class uses the object of the other, e.g as a parameter in one of its method or creates it. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  21. Inheritance Wrong inheritance example: Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  22. Refinement Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  23. Refinement Connects two descriptions of the same thing on different abstraction levels. In situations when the refinement connects the abstract type with a class realizing it, it is called realization . Can be used for modeling different implementation of the same thing. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  24. When to use aggregation? Are there any operations on the whole object, which are automatically applied to components? Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  25. When to select aggregation, and when inheritance? If the type of an object (e.g. Student) can change (e.g. from undergraduate to graduate) without changing any other attibutes, then using inheritance would force a class change! Only advanced programming languages allow it. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  26. Attributes and associations In some situations there are doubts whether to use attribute or association. The general rule is as follows: Attributes are used to connect objects with values . Values are any elements not having identity , e.g. number 1 (there is no concept of “this” number 1). Associations connect objects with objects. Values can be easily written out directly and reread. With objects there is more trouble, because all connections to other objects has to be written out as well (and possibly those objects too etc.). Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

  27. Modeling behavior Modeling system behavior includes two things: external behavior: communication of the system with the environment, seen from the external perspective, it is modeled by use cases; internal behavior: network of activities and dependencies between them, serving to realize the external behavior, described by interaction models. Besides those two models there is the physical model, composed of two diagrams: component diagram, deployment diagram. Zbigniew Jurkiewicz Databases Data Modeling Lectures for students of mathematics

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend