modeling
play

Modeling Programmeertechnieken, Tim Cocx Discover the world at - PowerPoint PPT Presentation

Modeling Programmeertechnieken, Tim Cocx Discover the world at Leiden University Discover the world at Leiden University Software development Lifecycle (Requirements) analysis: - Requirements gathering and description - Construction of


  1. Modeling Programmeertechnieken, Tim Cocx Discover the world at Leiden University Discover the world at Leiden University

  2. Software development Lifecycle • (Requirements) analysis: - Requirements gathering and description - Construction of analysis model(s) - [“ What is supposed to be done”] • Design - Construction of design model(s) - [“ How are we going to approach it”] • Coding: - Programming/ (unit) testing • Deploy: - Start using the software • Support - Usage and maintenance Discover the world at Leiden University

  3. Analysis • Requirements gathering (elicitation) • Create analysis model - Denotes What the system does, not how . - Is (more or less) understandable by the domain - Domain: customers/ users/ usage environment - Shows the domain’s needs - Models reality / the domain - In this course: class diagram - Target group: the domain and developers Discover the world at Leiden University

  4. Design • Determine the way the software is going to be built - First major structural decisions, later; details • Create design model - Shows how the system is built - For yourself (thinking aid) and co-workers (discussion aid) - For later (when changes come): documentation - In this course: class diagram - Target group: developers Discover the world at Leiden University

  5. Modeling steps Problem Analysis Design Solution domain model model domain Discover the world at Leiden University

  6. Modeling What is this? Discover the world at Leiden University

  7. Modeling • Create an image of a piece of reality - With a certain purpose - According to a pre-determined technique - Depending on the purpose, details can be omitted Discover the world at Leiden University

  8. Example model • Model of a railroad: Discover the world at Leiden University

  9. Example model • Conceptual model of a database student ¡(idcode, ¡ ¡naam, ¡adres, ¡wpl, ¡geboortedat, ¡ d_code ) ¡ d_code ¡is ¡vreemde ¡sleutel, ¡verwijst ¡naar ¡d_code ¡in ¡docent, ¡ ¡ null ¡is ¡toegestaan. ¡ ¡ ¡ docent ¡(dcode, ¡naam, ¡adres, ¡wpl, ¡salaris) ¡ ¡ ¡ module ¡(moduleCode, ¡ ¡moduleNaam, ¡studiepunten, ¡ coordinator ) ¡ coordinator ¡is ¡vreemde ¡sleutel, ¡verwijst ¡naar ¡d_code ¡in ¡docent, ¡ ¡ null ¡is ¡NIET ¡toegestaan. ¡ ¡ ¡ ¡ tentamen ¡( idcode , ¡ modulecode ) ¡ idcode ¡is ¡vreemde ¡sleutel, ¡verwijst ¡naar ¡idcode ¡in ¡student, ¡ ¡ null ¡niet ¡toegestaan ¡ modulecode ¡is ¡vreemde ¡sleutel, ¡verwijst ¡naar ¡modulecode ¡in ¡module, ¡ ¡ null ¡niet ¡toegestaan . Discover the world at Leiden University

  10. Example model • Graphical design model of a website (‘wireframe’, ‘mock-up’) Discover the world at Leiden University

  11. Unified Modeling Language • De Unified Modeling Language (UML) is the ‘de facto’ standard to model software. - Class diagram - Use Case diagram - Sequence diagram - State Transition diagram - Activity diagram - Etc. • UML is a ‘drawing-language’ showing how to create these diagrams Discover the world at Leiden University

  12. Class diagram • A class diagram is a blueprint Class diagram As systemmodel Describes the • interaction between objects Discover the world at Leiden University

  13. Case 1: Mario Wat are the objects? Discover the world at Leiden University

  14. Case 1: Mario Discover the world at Leiden University

  15. Case 1: Mario • Mario • Mushroom • Luigi • Mystery block Bad way • Toad1 • Row of blocks 1 – Block1 • Toad2 – Etc. • Yoshi Groen • Row of blocks 2 • Yoshi Rood – Block1 • Hammerman 1 – Etc. • Hammerman 2 • Floor • Hammer 1 • Roof • Hammer 2 • Platform 1 • Hammer 3 • Platform 2 • Platform 3 • Coin 1 • Platform 4 • Coin 2 • Coin 3 Discover the world at Leiden University

  16. Case 1: Mario • Making a list with objects becomes a little bit unruly quite - Imagine you have 200 coins in one level! - What if we also want to describe the properties (e.g.: location) of every object? • A lot of object are (approximately) the same! - Lets combine those objects under one ‘blueprint’! - This is a class. Discover the world at Leiden University

  17. Class • A class describes a blueprint for a collection of individual objects • Example: The class ‘Human’ describes all of us. - We are ‘objects of the class Human’ (notice the capital letter ‘H’!) • A class describes: - Attributes: properties - Methods: skills • Methods for Human: - Walk, talk, sit - Methods are exactly the same for every object of the class • Attributes Human: - Color of hair, length, weight - Attributes (can) differ per object Discover the world at Leiden University

  18. Class UML syntax Human - colorOfHair - length - weight - Walk - Talk - sit Discover the world at Leiden University

  19. Case 1: Mario Coin Mysteryblock - location Block Mario - location Platform Luigi - value Can Improve Better - location Roof Toad - location - contents - location Floor Yoshi - location - status - location Hammerman Hammer - location - height - status - yieldPrice - Location Mushroom - width - location - color - width - location - break - location - jump - numberOfHoles - height - color - status - location - jump - getYoshi - height - speed - angle - rider - jump - getYohsi - die - direction - direction - walk - getYoshi - ride - die - hitBlock - - kill die - hitBlock - getCoin - jump - extendTongue - - eat hitBlock - getCoin - throwHammer - eat - getCoin - lose - kill Discover the world at Leiden University

  20. Inheritance • A child: - Has a length, weight, color of hair and favorite toy Child Adult - Can walk, talk, sit, play and go to school • An adult: - colorOfHair - colorOfHair - Has a length, weight, color of hair, job - length - length - Can walk, talk, sit, vote, drive a car - weight - weight - favoriteToy - job - walk - walk - talk - Talk - sit - sit - play - vote - goToSchool - driveACar What can be done better? Discover the world at Leiden University

  21. Inheritance UML syntax Human - colorOfHair • A Human is a Child ór an Adult Superclass or • A Child is a specific kind of parent class - length Human - weight An Adult is a specific kind of • Human - walk - talk Subclass of - sit Child class Child Adult - favoriteToy - job - goToSchool - Vote - play - driveACar Discover the world at Leiden University

  22. Inheritance theory • inheritance: also Generalization • A subclass inherits all attributes of its super class(es). - Can be more ( grandfather class ) • A subclass inherits all methods of its super class(es) • ‘Downwards’: specialization • ‘Upwards’: generalization Discover the world at Leiden University

  23. Case 1: Mario GameElement Moving Active Platform SelfMoving Hammer Coin Mushroom This is not finished! Player Enemy Yoshi • Where to put the methods? • Where to put the attributes • There are classes missing Exercise! • Hammerman Humans Toads Discover the world at Leiden University

  24. Class Diagram: procedure • Read the analysis report • Nouns - Class - Attribute - Don’t model • Verbs - Methods - Something else - Don’t model Discover the world at Leiden University

  25. Case 2: College The following data needs to be entered for new students: name, student code, date of birth and study coach (at the time of registration every student gets assigned a teacher as his or her coach). Students have a list of grades, study and do exams. After every period, the grades for the courses and the date of the exam must be entered. The system calculates the average result of the grades. Teachers have a name, date of birth and building. They grade exams and assess students Discover the world at Leiden University

  26. Case 2: College The following data needs to be entered for new students : name , student code , date of birth and study coach (at the time of registration every student gets assigned a teacher as his or her coach ). Students have a list of grades , study and do exams . After every period , the grades for the courses and the date of the exam must be entered . The system calculates the average result of the grades . Teachers have a name , date of birth and building . They grade exams and assess students Discover the world at Leiden University

  27. Case 2: College What noun: verb: students • entered • code • gets assigned • data • have • is name • do exames • date of birth • study • coach • enter • list of grades • calculate • teacher • grade exam • period • Assess students • Grade • what? course • date of the exam • system • average • building • Discover the world at Leiden University

  28. Case 2: College • Teacher • Student – coach-kids – name – name – date of birth – date of birth – code – building – coach – assess students – list of grades – grade exam • Result – do exam – grade – study – Date of exam – course Discover the world at Leiden University

  29. Case 2: College Person - name - dateOfBirth Result Student Teacher - course - code - building - dateOfExam - coach - coachKids - grade - listOfGrades - study - gradeExams - doExam - assessStudents Discover the world at Leiden University

  30. Case 1: Mario Interaction?? Discover the world at Leiden University

Recommend


More recommend