Prepared by Mrs.Atiya Masood Constructing an Initial Structural Model I CHAPTER 33.

Slides:



Advertisements
Similar presentations
Computer Science Dept. Fall 2003 Object models Object models describe the system in terms of object classes An object class is an abstraction over a set.
Advertisements

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall A.1.
ENTITY RELATIONSHIP MODELLING
OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage.
1 CIS224 Software Projects: Software Engineering and Research Methods Lecture 4 Class Models (Based on Fowler (2004, Chapters 3 & 5) and Stevens and Pooley.
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Essentials of class models. 2 A very simple class model In UML, a class is shown in a class diagram as a rectangle giving its name.
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
Slide 1 Chapter 7 Structural Modeling. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Chapter 14 (Web): Object-Oriented Data Modeling
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
Chapter 2: Entity-Relationship Model (Continued)
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
Chapter 4 Entity-Relationship modeling Transparencies © Pearson Education Limited 1995, 2005.
Sharif University of Technology Session # 7.  Contents  Systems Analysis and Design  Planning the approach  Asking questions and collecting data 
Chapter 14: Object-Oriented Data Modeling
Entity/Relationship Modelling
Data Modeling Using the Entity-Relationship Model
ZEIT2301 Design of Information Systems Structural Design: Class Diagrams School of Engineering and Information Technology Dr Kathryn Merrick.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
Chapter 5 Entity–Relationship Modeling
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix A Object-Oriented.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Database Management System Prepared by Dr. Ahmed El-Ragal Reviewed & Presented By Mr. Mahmoud Rafeek Alfarra College Of Science & Technology Khan younis.
Chapter 2 Data Models Database Systems: Design, Implementation, and Management, Rob and Coronel Adapted for INFS-3200.
Slide 1 Structural Modeling Chapter 7. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
CHAPTER 13 (ONLINE): OBJECT-ORIENTED DATA MODELING © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
1 © Prentice Hall, 2002 Chapter 14: Object-Oriented Data Modeling Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R.
7-1 © Prentice Hall, 2007 Chapter 7: Conceptual Data Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
7-1 © Prentice Hall, 2007 Week 5: Conceptual Data Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 13 (Online): Object-Oriented Data Modeling Modern Database Management 10 th Edition.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
ERD ( Conceptual data model From the statement of data requirements a conceptual data model is produced. This describes.
Object-Oriented Data Modeling
Design Model Lecture p6 T120B pavasario sem.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
 Week08.  Review Schedule Weeks 8-14  This week o Review last class o Introduce Class Diagrams o ICE-03 Sheridan SYST Engineering Quality Systems.
Domain Classes – Part 1.  Analyze Requirements as per Use Case Model  Domain Model (Conceptual Class Diagram)  Interaction (Sequence) Diagrams  System.
1 Kyung Hee University Modeling with Objects Spring 2001.
Entity/Relationship Modelling. Entity Relationship Modelling In This Lecture Entity/Relationship models Entities and Attributes Relationships Attributes.
DBMS ER model-2 Week 6-7.
 To explain why the context of a system should be modelled as part of the RE process  To describe behavioural modelling, data modelling and object modelling.
Chapter 8 Entity-Relationship Modeling Pearson Education © 2009.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) Modern Database Management 11 th Edition Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Appendix A Object-Oriented Analysis and Design A.1.
Computing: An Object-Oriented Approach Chapter 34 Constructing an Initial Structural Model II Prepared by: M206 Team - Kuwait Branch.
CSCE 240 – Intro to Software Engineering Lecture 3.
Rationale Databases are an integral part of an organization. Aspiring Database Developers should be able to efficiently design and implement databases.
1 M206 Chapter 31: An Overview of Software Development 1.Defining the problem 2.Analyzing the requirement – constructing initial structural model 3.Analyzing.
DOMAIN CLASSES – PART 1 BTS430 Systems Analysis and Design using UML.
Object-Oriented Modeling
Class diagram Description
Lec 3: Object-Oriented Data Modeling
Entity Relationship Diagrams
Chapter 20 Object-Oriented Analysis and Design
SYS466 Domain Classes – Part 1.
Understand and Use Object Oriented Methods
Chapter 7: Entity-Relationship Model
Presentation transcript:

Prepared by Mrs.Atiya Masood Constructing an Initial Structural Model I CHAPTER 33

Prepared by Mrs.Atiya Masood New concepts this chapter introduces a number of new ideas connected with object-oriented analysis, including generalisation relationships, recursive associations, derived associations and invariants. In addition, you are introduced to a range of guidelines and techniques that can be used to identify classes, attributes and associations from a negotiated statement of requirements.

Prepared by Mrs.Atiya Masood Introduction In this chapter, we shall look at how we can analyse such an NSR in order to begin the process of determining the appropriate classes and associations, responsibilities and collaborations.

Prepared by Mrs.Atiya Masood Introduction Application area: the real-world context within which the system is required to operate. Problem domain: the collection of real-world entities within the application area that exhibit those behaviors that the required system has to model. User communication: the means by which communication between the problem domain and the rest of the application area takes place. Domain model: the part of the system that models the problem domain. Structural model: a representation of the problem domain in terms of classes and the relationships between them. Initial structural model: represents the structure of the required system in terms of classes and their relationships without considering how responsibilities for the details of the required behaviours should be distributed among the classes.

Prepared by Mrs.Atiya Masood Identifying classes and attributes Classes:- A class encapsulates the behaviour of a set of objects of the same kind. Attributes:- are properties of objects. An object’s behaviour may depend upon the values of its attributes. An association exists between two (not necessarily distinct) classes when there can be links between (some of) their respective objects. When looking for classes, is to identify the things whose behaviour – either behaviour that is about recording something or behaviour that is about doing something – is significant for the application area.

Prepared by Mrs.Atiya Masood Identifying classes and attributes To identifying classes is to identify nouns or noun phrases in the NSR.

Prepared by Mrs.Atiya Masood Identifying classes and attributes Grouping together nouns and noun phrases that are synonyms, library copy (video copies, copies, video copy) film (films, number of films) system title (film's title) unique identifying number member (library member) unique membership number member's name the number of copies of that film that are currently available for loan the films that that member currently has copies of on loan. Note that a singular noun is used to represent each group of synonyms.

Prepared by Mrs.Atiya Masood Identifying classes and attributes Guidelines for rejection Is it an attribute? Does it correspond to a simple property of some other category of object in the application area? Are its possible values simple, possibly ‘pre-defined’, things like strings or numbers or addresses. Ex:-‘title’, which is an attribute of a film; ‘unique identifying number’, which is an attribute of a copy; ‘unique membership number’, which is an attribute of a member; ‘name’, which is another attribute of a member. Does it refer to a behaviour of the system? Does it name some process or identify some result of a process that the system has to carry out? the number of copies of that film that are currently available for loan;

Prepared by Mrs.Atiya Masood Identifying classes and attributes Is it outside the scope of the system? Is it a word or phrase that is used to help describe how the system works or what it consists of, but that does not actually refer to something that is inside the system? Ex: library itself does not need to be modelled: it has no behaviour that is relevant to the application area. A group of video libraries rather than a single ‘library’, then the category library would correspond to a class in the domain model, example, which library holds a particular copy. Does it refer to an aspect of the user interface? Does it describe something concerning the interaction of a user with the system, rather than something that is part of the system itself? ‘ The librarian enters the copy code by using a barcode reader.’ Both ‘librarian’ and ‘barcode reader’ may be rejected, since they refer to aspects of the user interface.

Prepared by Mrs.Atiya Masood Identifying classes and attributes Is it a word or phrase that is used in talking about the system that is to be developed rather than a reference to something in the application  Ex: Words like ‘system’, ‘behaviour’ and ‘requirement’ fall into this category; they do not refer to entities in the application area. Does it refer to links between other objects in the system? In such a case, it is possible that it corresponds more appropriately to an association than to a class. Ex: Loan:- hasOnLoan It is important to note that these are guidelines and not strict rules. it is possible for something to fall into one of the above categories and still require to be represented by a class in the domain model.

Prepared by Mrs.Atiya Masood Identifying classes and attributes we end up with the following list of candidate classes: Copy, Film and Member. Kinds of classes (Adapted from Schlaer, S. and Mellor, S. (1988) Object- Oriented Systems Analysis:) Tangible objects By this we mean physical things in the world of the application area: aeroplanes, vehicles, reactors, and so on. Ex: Copy Roles By this we mean the role or roles that people play in the application area – employee, student, lecturer, driver, and so on. Ex: Member

Prepared by Mrs.Atiya Masood Kinds of classes Events:- By this we mean a circumstance, episode, interaction, happening or significant incident for which it seems likely that some sort of record will need to be kept in the application area – deliveries, registrations, bookings, enrolments, and so on. Organisational units:- By this we mean the organisational units to which people or things in the application area belong – departments, faculties, branches, and so on. Into which category would you place the class Film in the Video Library system???

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Hospital ward patient name of ward supervisor Administration department consultant doctor junior doctor grade of junior doctor doctor team team code name of doctor address of doctor

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Candidate classes for the system: Ward (tangible) Patient, Consultant Doctor, junior doctor, Doctor ( Role) Team (Organisational Unit) Note: Each class name is a single word starting with an uppercase letter. The class name should be singular; patients are represented by the instances of Patient rather than by the class itself. UML notation, classes are represented in a class diagram by a rectangle with the class name inside it,

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Attributes come under the heading of responsibilities. It is important to recognise that when listing attributes in a class description. Thing or property? As well as a name and an address, a doctor has a title; also, a record is kept of the institution where he or she qualified. Look the above statement of client. In this statement name is class or attributes??? If it is significant information in application area, where we must focus on it -  Class If it is some basic information of other object  attributes So name is attributes of doctor

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Generalisation relationships A relationship between classes that allows us to recognise the similarities and differences between two related classes. What is the relationship between Doctor and JuniorDoctor? JuniorDoctor is a kind of doctor as well as ConsultantDoctor Doctor generalises  JuniorDoctor and ConsultantDoctor. generalisation relationship between the classes Doctor and JuniorDoctor and also between Doctor and ConsultantDoctor.

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Doctor  Parent class JuniorDoctor and ConsultantDoctor  Specialisation (or child class)  Arrow indicates the more general class  Child class inherit all attributes of Parent class

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced An instance of a child class should always be substitutable for an instance of its parent class.  Anywhere an instance of Doctor is required we can use an instance of JuniorDoctor.  ‘Any instance of Doctor is linked to exactly one instance of Team ’ we can replace Doctor by JuniorDoctor to get ‘any instance of JuniorDoctor is linked to exactly one instance of Team ’. A child class inherits all the attributes, associations and behaviour of its parent class.

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Abstract classes A class, each instance ‘of’ which is in fact an instance of one of its subclasses, is called an abstract class. No instance of abstract class Every object ‘of’ the abstract class is actually an instance of one of the concrete subclasses. Read this and tell me which class is abstract class and why? Each team is headed by a consultant doctor who is the only consultant doctor in the team; the rest of the team are all junior doctors, at least one of which must be at grade 1. Each doctor is in exactly one team.

Prepared by Mrs.Atiya Masood Associations An association between two (not necessarily distinct) classes is a set of links that have a common meaning. By a link we mean a connection between a pair of objects Hospital Admission and Treatment (HAT) system introduced these links are instances of an association called isCopyOf.

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced The name of an association should be a single ‘word’. Association names should start with a lower-case letter. The name we choose should give an indication of the meaning of the association. Arrow head Indicating the direction in which the name should be read Usually the direction in which the name should be applied is obvious,

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Identifying associations Such grammatical structures are often verbs, verb phrases or prepositional phrases. Read the NSR of HAT and identify Association between Ward,Team, Doctor, ConsultantDoctor, Paitent,JuniorDoctor. Incomplete Class Diagram

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced An important point to note is that, when there is a generalisation relationship, a child class (subclass) inherits the associations of the parent class (superclass). In the HAT system, for example, both JuniorDoctor and ConsultantDocto inherit the hasTreated and the consistsOf associations from Doctor. This follows from the fact that instances of a child class must be substitutable for instances of the parent class.

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Multiplicity:- tells us the range of possible values for the number of instances of one class linked by the association to other Class. Types of Multiplicity One-to-many association  The word ‘one’ means a multiplicity of 1 or 0..1 The word ‘many’ is used to indicate a multiplicity involving numbers greater than 1 such as 0..*, 1..*, 0..2, 5..17, 4, and so on.

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced One-to-one associations:- A one-to-one association is one in which the instances of the classes at either end are never linked to more than one instance of the class at the other end. In other words, the multiplicities at each end are one. 1 1 Team ConsultantDoctor Many-to-many associations An instance of either class may be linked to more than one instance of the other class. Doctor {abstract} Patient isHeadedBy 0..* hasTreated 0..*

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Recursive associations An association to exist between a class and itself. Example: Some nurses supervise other nurses. A nurse is supervised by at most one other nurse.

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Inheritance:- By inheritance we mean the way in which a specialisation of a class inherits all the properties of the parent class. For simplicity we refer to the classes involved as subclasses and super classes. Doctor is an abstract class, it will not have any instances, should we retain it or not? it should be retained. why?  The most important reason (at this stage) is that it models a significant category of objects in the problem domain.  Doctor class defines the common behaviour and properties of its subclasses it ‘abstracts’ out the common associations (hasTreated, consistsOf ) and attributes (name, address) of the classes JuniorDoctor and ConsultantDocto

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced In addition, a subclass should normally satisfy at least one of the following: – It has additional attribute(s) not possessed by the superclass. – It has additional behaviour not possessed by the superclass. – It has additional association(s) not possessed by the superclass. If none of these held, it would be unlikely that the subclass would be needed at all; instances of the superclass

Prepared by Mrs.Atiya Masood We do not have a Treatment class to represent the treatment of a patient by a doctor. Why? Does the event have any attributes whose values need to be recorded?  example, we might want to record the date of the treatment or what medication the treatment involved. If so then we should use a class. Does the event involve more than two other classes in the problem domain?  For example, a treatment might always involve a nurse as well as the patient and the doctor. If that were the case a class would be more appropriate. There is no need to introduce a Treatment class. Hospital Admission and Treatment (HAT) system introduced

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Derived association A derived association is one whose instances can be derived using other association instances. The NSR states that: Each patient is under the care of a single team of doctors. The consultant who heads that team is responsible for the patient. Since p is linked via caresFor to an instance t of Team, the instance of ConsultantDoctor that is linked to p via isResponsibleFor is just the instance of ConsultantDoctor that is linked to t via isHeadedBy. isResponsibleFor can be derived from caresFor and isHeadedBy

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced Derivation of isResponsibleFor If p is an instance of Patient then p is linked via caresFor to exactly one instance t of Team. The instance of ConsultantDoctor linked to p via isResponsibleFor is the instance that is linked to t via isHeadedBy. In a class diagram we indicate that an association is a derived association by preceding its name with a /.

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced The associations isResponsibleFor, isHeadedBy and caresFor form a ‘loop’. Identify possible derived associations is to look for such loops in the class diagram. Many loops will not give rise to derived associations- loops simply indicate likely places to look for them. Why we do not simply remove the derived association isResponsibleFor ; it is, in a sense, redundant.

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced First is that isResponsibleFor models a relationship that is explicitly mentioned in the requirement. second is that we could argue that it is the caresFor association that is redundant, and not the isResponsibleFor association. This is because the caresFor association can be derived by using the isResponsibleFor and the isHeadedBy associations. Do exercise # 10 The associations hasTreated, consistsOf and caresFor also form a loop. Can we extract derived associations?

Prepared by Mrs.Atiya Masood Hospital Admission and Treatment (HAT) system introduced

Prepared by Mrs.Atiya Masood Invariant An invariant is a condition involving classes and associations that must hold if the NSR is to be satisfied. Invariant written in formal language. The invariant are required when there is a loop in the class diagram. Example: If an instance of Patient is linked to an instance of Doctor via hasTreated then that instance of Doctor must be linked via consistsOf to an instance of Team that is linked via caresFor to the original instance of Patient..

Prepared by Mrs.Atiya Masood Invariant Some invariant are absent in class diagram A patient may be treated by any number of doctors but they all must be in the team that cares for the patient. This is an important invariant, and it is not evident from the class diagram. We can state it formally as follows. If p is an instance of Patient that is linked to an instance d of Doctor via hasTreated then d must be linked via consistsOf to the instance of Team that is linked via caresFor to p.

Prepared by Mrs.Atiya Masood Invariant Another common form of invariant is one that places restrictions on the values of the attributes of objects that can participate in certain associations Example: the rest of the team are all junior doctors, at least one of which must be at grade 1. If t is an instance of Team then there must be at least one instance jd of JuniorDoctor such that t is linked via consistsOf to jd and jd has grade 1.

Prepared by Mrs.Atiya Masood Invariant Invariants can concern the uniqueness of certain attributes. Example: no two patients on the same ward can have the same name. Similarly, no two wards can have the same name. We can express these as follows. If p1 and p2 are instances of Patient that are linked via hasOn to the same instance of Ward then the name of p1 is not the same as the name of p2. If w1 and w2 are instances of Ward then the name of w1 is not the same as the name of w2.