المملكة العربية السعودية وزارة التعليم العالي جامعة المجمعة كلية التربية بالزلفي قسم الحاسب اآللي Mapping between class diagram and data base Prepared by: T. Chafika Laabidi Ouni Wannassi 2015 Outline CSE333 Software Development Process Design UML Class diagram Class diagram VS database DOC/UML.3 Software Development Process Design UML Class diagram Class diagram vs database Requirements CSE333 Design Design Design ADevelop "blueprint" isrequirements drawn up of for Document theall units coding the developers to implement to the desired software. . software. Implementation Implementation Testing code Verification Verification Verification Solve problem Maintenance Maintenance Waterfall Model (1) DOC/UML.4 Software Development Process CSE333 Design UML Class diagram Class diagram vs database Design Specifying the structure of how a software system will be written and function, without actually writing the complete implementation. DOC/UML.5 Software Development Process Design Data organization: UML Class diagram Semantic Data Architectural Entity/Relationship Model CSE333 Entity types, attributes, relationships Architectural Data Model Database Design Model Designer’s View (Technology) RELATIONAL DATA BASES Class diagram vs database Object-oriented Design Model (UML) Object-oriented Classes XML Schemas Tables, columns, keys Classes, attributes, associations Tags DOC/UML.6 Software Development Process Design UML Class diagram Class diagram vs database Definition: Unified Modeling Language CSE333 A graphical language for specifying, constructing, and documenting the artifacts of software systems, as well as for business modeling [2]. DOC/UML.7 Software Development Process • It’s CSE333 Design a very UML Class diagram important part Class diagram vs database of developing object oriented software and the software development process. • UML uses mostly graphical notations to express the design of software projects. DOC/UML.8 Software Development Process Design UML Class diagram Class diagram vs database Over view of UML diagrams: Behavioral CSE333 Structural • • • • • Class Class Component Deployment Object Package • Activity • State machine • Use case Interaction • Communication (collaboration) • Sequence DOC/UML.9 Software Development Process Design UML Class diagram Class diagram vs database Definitions: CSE333 • A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics. DOC/UML.10 Software Development Process CSE333 Design UML Class diagram Class diagram vs database • It shows the static structures of the system. • The class diagram shows how the different entities relate to each other; DOC/UML.11 Software Development Process CSE333 Design UML Class diagram Class diagram vs database Example: Objects Attributes Professor pID name Professor Smith Class Professor Mellon Professor Jones create( ) save( ) delete( ) Change ()( ) Operations DOC/UML.12 Software Development Process Design UML Class diagram Class diagram vs database Example: CSE333 DOC/UML.13 Software Development Process CSE333 Design UML Class diagram Class diagram vs database Multiplicity: symbol meaning 1: one and only one, 0..1: zero or one, M..N: from M to N (natural language), * : from zero to any positive integer, 0..*: from zero to any positive integer, 1..*: from one to any positive integer. DOC/UML.14 Software Development Process CSE333 Design UML Class diagram Class diagram vs database How obtain my database ? DOC/UML.15 Software Development Process CSE333 Design UML Class diagram Class diagram vs database Golden Rules Each class is transformed into a table, The class identifier becomes primary key of the table, Each attribute is transformed into a field, DOC/UML.16 Software Development Process CSE333 Design UML Class diagram Class diagram vs database Rule1: assosiation 1…...* : The ID of the class that is associated with the cardinality (?..1) becomes foreign key in other table. DOC/UML.17 Software Development Process Design UML Class diagram Class diagram vs database Example: CSE333 1 0..* DOC/UML.18 Software Development Process CSE333 Design UML Class diagram Class diagram vs database Rule2: association *…...* : The association is transformed into a table. The two identifiers of tables represents the primary key of this table. DOC/UML.19 Software Development Process Design Class diagram UML Class diagram vs database Example: Company CSE333 Id_c adress * 1..* Person NumP Name DOC/UML.20 Software Development Process Design UML Class diagram Class diagram vs database Inheritance: CSE333 DOC/UML.21 References CSE333 [1]: http://xbsoftware.com/blog/software-developmentlife-cycle-waterfall-model/ [2]:www.cs.ucf.edu/~turgut/COURSES/.../EEL4884_ES D_Fall06_UML.ppt DOC/UML.22 CSE333 DOC/UML.23