Mastering Data Modeling: From Requirements to Design

cse 403 software engineering n.w
1 / 39
Embed
Share

Explore the journey from gathering requirements to system design through data modeling for effective software engineering. Understand the importance of representing data structures and relationships to build efficient and error-free systems.

  • Data Modeling
  • Software Engineering
  • System Design
  • Requirements
  • Data Structures

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. CSE 403 Software Engineering Data modelling

  2. From Requirements to System Design

  3. From Requirements to System Design ideas, target users, desired behavior Developer Client questions, suggestions, diagrams, feasibility

  4. From Requirements to System Design ideas, target users, desired behavior Developer Client questions, suggestions, diagrams, feasibility Requirements

  5. From Requirements to System Design ideas, target users, desired behavior Developer Client questions, suggestions, diagrams, feasibility What Requirements SW Architecture and Design How Data Model

  6. From Requirements to System Design ideas, target users, desired behavior Developer Client questions, suggestions, diagrams, feasibility Requirements Today SW Architecture and Design Data Model

  7. Data Modelling

  8. Goal: your program represents things in the world Your code will contain data structures Equivalently, a database contains your data (CSE 344) How should you design those data structures? Data modeling is a way of deciding: What data is important How the data are related to one another How to avoid redundancy, errors, and inefficiency

  9. ER (entity-relationship) diagrams: one syntax Common language for data modelling ER (Entity-Relationship) diagrams Just one out of many possibilities (diagrams, tables, text) How to model data? Identify Entities Identify Attributes Identify Relationships Assign Keys (Normalization to reduce redundancy) (Denormalization to improve performance) Develop a data model for a course-registration system

  10. ER diagrams: overview An Entity Relationship (ER) diagram is a graphical representation of a data model. It shows the relationship between entities (e.g., people, objects, events, or concepts) within a system. It can be mapped to a relational (database) schema.

  11. ER diagram for an MMORPG Wikipedia, CC BY-SA 3.0

  12. ER diagrams: graphical syntax An entity E E

  13. ER diagrams: graphical syntax An entity E E A E An attribute A of entity E

  14. ER diagrams: graphical syntax An entity E E A E An attribute A of entity E R A relationship R between two entities E1 and E2 E1 E2

  15. ER diagrams: graphical syntax An entity E E A E An attribute A of entity E R A relationship R between two entities E1 and E2 E1 E2 R E1 E2 An attribute B of relationship R B

  16. ER diagrams: syntactic rules An interconnecting line is only allowed between: a box and a diamond, a box and an oval, a diamond and a oval. An oval must have exactly one connecting line. Names of boxes must be unique in the diagram. Names of ovals must be unique per box/diamond. E A E R E1 E2 R E1 E2 B

  17. Model a course registration system What are the entities?

  18. Model a course registration system What are the entities? Students Instructors Courses Prerequisites Assignments Points/grades Rooms Times Credits

  19. Step 1: identify entities Student Instructor Course What attributes should we add?

  20. Step 1: identify attributes NetID Name ID Name Student Instructor CourseID Course Title

  21. Step 2: identify relationships NetID Name ID Name Student Instructor CourseID Course Title What relationships should we add?

  22. A first example: identify relationships NetID Name ID Name Student Instructor teaches takes CourseID Course Title

  23. ER diagrams: keys and cardinalities A key is an (underlined) attribute, or a set of attributes, which uniquely identifies an entity. Student NetID (key) FirstName LastName takes Course (key) CourseID Title

  24. ER diagrams: keys and cardinalities A key is an (underlined) attribute, or a set of attributes, which uniquely identifies an entity. A key can be artificial (unique ID) or natural (property of the data) Student NetID (key) FirstName LastName takes Course (key) CourseID Title

  25. ER diagrams: keys and cardinalities A key is an (underlined) attribute, or a set of attributes, which uniquely identifies an entity. A key can be artificial (unique ID) or natural (property of the data) The cardinalities define the kind of relationship (one-to-one, one-to- many, or many-to-many). There are different notations for cardinalities. For example: 1 = (1,1) c = (0,1) m = (1,*) mc = (0,*) Student NetID (key) (0,*) FirstName LastName takes (0,*) Course (key) CourseID Title

  26. ER diagrams: weak entities A weak entity can t exist on its own (if a building is torn down, its rooms disappear). Building BuildingNo has Room RoomNo

  27. ER diagrams: weak entities A weak entity can t exist on its own (if a building is torn down, its rooms disappear). A weak entity is only uniquely identifiable in reference to another entity. Building BuildingNo has Room RoomNo

  28. ER diagrams: self references and roles A self reference is usually explicitly annotated with roles to clarify the meaning of the self-referencing relationship. manages Employee is managed by Think about (but never draw) the following: manages is managed by Employee Employee

  29. ER diagrams vs. code

  30. ER diagrams vs. code ER diagrams: Omit implementation details (caching, bookkeeping) Show cardinality (e.g., may a field be null?) Concise

  31. Practice Let s augment our model of a course registration system: Prerequisites Assignments Points/grades Student NetID Name ID Name Instructor teaches takes CourseID Course Title

  32. ER diagram: course registration system Set up: 1. Start from the diagram on the next page, or draw your diagram in any other way you want. This document is https://docs.google.com/presentation/d/1vKIWdwOOHM8T- ISpqwDeDGTBc2DlwgQz Instructions: 1. Augment the simple ER diagram on the next slide by a. modelling the following concepts: i. Overall grade for a taken course ii. Course prerequisites iii. Assignments (and points) b. adding keys and cardinalities 1. Think about: a. Which concepts should be modeled as (weak) entities vs. relationships vs. attributes? b. Are there any self-references? What are reasonable cardinalities (reflecting reality)? Additional Information: ER syntax and rules were given on previous slides.

  33. Course registration system: extend this ER model NetID Name ID Name Student Instructor teaches takes CourseID Course Title

  34. Spoilers ahead!

  35. Extended course registration system (example) NetID Name ID Name Grade Student Instructor teaches takes (0,*) 1 Points (0,*) (0,*) CourseID Course submits has Title prereq for requires Assignment prereq MaxPoints A_Id

  36. Additional material, not discussed in class

  37. ER diagrams: generalization; modeling OO An is_a relationship represents a generalization relationship between two entities. Person SSN Name is_a Student Instructor GPA SRTI

  38. ER diagrams: generalization; modeling OO An is_a relationship represents a generalization relationship between two entities. Attributes (including keys) are inherited . Person SSN Name is_a Student Instructor GPA SRTI

  39. ER diagrams: generalization; modeling OO An is_a relationship represents a generalization relationship between two entities. Attributes (including keys) are inherited . Additional attributes can be defined. Person SSN Name is_a Student Instructor GPA SRTI

More Related Content