Developing the Conceptual Model

  BIT201 Obj ect Modeling using UML Readings

  z Larman

  z

Chapter 9: Building a Conceptual Model Developing the Conceptual Model

  z

  Chapter 10: Adding Attributes

  z

  Chapter 11: Adding Associations z

  Reading 2: Novak and Gowin

  z

  Concept Mapping for Meaningful Learning Chong Ven Yu 1 Modeling Systems Object-Oriented A & D z

  Object-Oriented Analysis:

  z

  Models are meant to describe and abstract certain aspects of a

  z

  focus on finding and describing the objects and concepts real-world system, which may be very complex. in the problem domain

  z Object-Oriented Analysis and Design are processes in which z

  Object-Oriented Design:

  models are created . z

  emphasis on defining logical software objects that will be implemented

  z

  Object-Oriented Programming:

  z

  the design components are implemented using an Object- 3 Oriented Programming Language 4 Object-Oriented Analysis Object-Oriented Analysis

  z Involves four main activities z

  These activities are done iteratively: z

  Artifacts that will be generated in Object-Oriented Analysis:

  Create System z

  Conceptual Model

  Definition z

  Use Case Diagram

  Build Object z Define System

  High Level Use Case

  Model Requirements z

  Expanded Use Case

  Finalize z

  System Sequence Diagram

  Analysis Documentation z 5 Contracts 6

  • Concepts

  Do not exclude a concept because the requirements do not indicate an obvious role or because it has no attributes.

  z

  Symbol – words or images representing a concept

  z

  Intension – definition of a concept

  9

  z

  Extension – set of examples to which the concept applies

  z E.g. consider an event of a sale transaction. z

  Name – Sale

  z

  Intension – ‘represents the event of a purchase transaction and has a date and time’

  z

  Extension – all examples or instances of sales Strategies to Identify Concepts

  z Better to overspecify a conceptual model z

  1 0

  z A concept is an idea, thing or object. z

  Exclude irrelevant features z

  Later joined by Ivar Jacobson, creator of OOSE (Object-Oriented Software Engineering) method. z

  combine the Booch and OMT methods z

  1 2

  z “… is a language for specifying, visualizing and constructing the artifacts of software system...” z A notational system aimed at modeling systems using OO concepts. z Initially developed by Grady Booch and Jim Rumbaugh (1994) to

  The Unified Modeling Language

  Do not add things that are not there

  Use the existing names found in the requirements specification z

  z Quite valid to have attributeless concepts z

  z Add the attributes required to fulfil the information requirements. z

  1 1

  Add the associations to record relationships

  z List the candidate concepts using the Concept Category List and noun phrase identification z Draw them in a conceptual model – as a concept map. z

  How to Make a Conceptual Model

  Identify the noun and noun phrases in textual descriptions of a problem domain especially the expanded use cases

  A concept consists of:

  1..*

  Conceptual Models

  1 VideoStore

  stocks

  1

  1

  has-catalog-of

  1

  1

  1

  1

  Media type numberOfDays rentalFee overdueFeePerDay

  HVR Conceptual Model

  Communicates to developers what the important terms are and how they are related

  Clarifies terminology or vocabulary of the domain z

  Concepts z Association between concepts z Attributes of concepts z

  z A conceptual model shows z

  Member name b Id

  1

  1..*

  1

  performs

  1

  1

  memberId phone address depositPaid membershipExpiryDate

  taken-on

  1

  Rental rentalDate dueDate returnDate rentalFee overdueFee

  records

  describes

  1

  1

  falls-under

  Video Specification title producer dateReleased numberOfCopies

  Video Item barcode dateAcquired status

  The UML was submitted as a candidate for the standard modeling language and notation in 1997

  1 8

  1 Video Item barc ode date Ac quired stat us

  Mem ber nam e mem berId phone dd

  1 6

  z Example: One video item can be associated with many rentals, but each rental is for one video item and one customer.

  1 performs 1..*

  1 address depositPaid Rental mem bershipE xpiryDate rentalDate dueDate returnDate rentalFee overdueFee

  1

  Attributes

  z

  z An attribute is a logical data value of an object z

  Attributes in a conceptual model should be simple attributes or pure data values. E.g. tt ib t t B l D t N b St i

  1 7 z attribute types: Boolean, Date, Number, String….

  z typical attributes: Name, Address, Colour, Size, Status z Attributes should not be foreign keys

  Summary

  z A conceptual model is not strictly correct or wrong. z

  It provides a useful description of the concepts and their important relationships. z The model is updated in subsequent development cycles.

  Multiplicity defines how many instances of type A can be associated with one instance of type B, at a particular moment in time.

  Multiplicities

  UML Definitions Terms UML Definition Class Description of a set of objects that share the

  objects with attributes and operations but may not include any methods may not include any methods Interface A set of externally visible operations.

  same attributes, operations, methods, relationships and semantics.

  Implementation An implemented software class e g Implementation An implemented software class e.g. Class a Java class.

  Operation A service that can be requested from an object to effect ‘behaviour’.

  UML Definitions Terms UML Definition Method Implementation of an operation’s algorithm

  or procedure

  Type Similar to class – describes a set of like

  Association Structural relationships between objects of

  TypeName

  different types

  Associations

  z An association is a relationship between concepts indicating some meaningful and interesting connection. z Associations imply knowledge of a relationship which needs to be preserved for some duration z

  Association Guidelines 1 5

  z

  Association Guidelines

  z Focus on those associations for which knowledge of the relationship needs to be preserved for some time z Naming Associations z Name an association based on TypeName-VerbPhrase-

  • tak en -on

  BIT201 Obj ect Modeling using UML Developing the Conceptual Model (2) 1 9 CONCEPTUAL MODEL

  z

  Classes

  z A class describes a set of objects with an equivalent role or roles in a system. z Every object belongs to a class.

  CONCEPTUAL MODEL What kind of things are classes ?

CONCEPTUAL MODEL

  Tangible or ‘real-world’ things: book,copy, course

  z

  z an object of class A receives a message with an object of class B as an argument

  B, or collections of objects of class B

  z class A and class B are associated if : z an object of class A sends a message to an object of class B z an object of class A creates an object of class B z an object of class A has an attribute whose values are objects of class

  2 4

  z associations correspond to verbs z express relationships between classes z links are instances of associations

  CONCEPTUAL MODEL Associations

  is done to, by or in the system. Determine if an instance of the event or operation has state, behaviour and identity. If not, discard it.

  z Vague, cannot tell unambiguously what is meant by a noun. z An event or an operation, where the noun refers to something which

  E.g. ‘ loan’ and ‘short term loan’ are different but probably only in the value of the attributes.

  R d d t h th l i i th 2 3 z Redundant when the same class is given more than one name.

  CONCEPTUAL MODEL How to build a good class model ? z Noun Identification. z Identify candidate classes by selecting nouns and noun phrases from the requirements specification. z Discard inappropriate candidates.

  system should composed of encapsulated modules, with low coupling and high cohesion

  requirements

  z

  Build a system which is easy to maintain and adapt to future

  y q y p y the objects z

  z

  every behaviour required of the system must be provided for by

  z

  z Build a system as quickly and cheaply as possible, satisfying current requirements

  What makes a class model good?

  z

  Interactions: meeting

  z

  Events: arrival,leaving, request

  z

  Roles: library member, student 2 1

  2 2

  • 1 stocks
  • 1

SUBTYPE/SUPERTYPE

  p y p yp yp , ways that are of interest. z The subtype represents an animate thing that behaves differently from the supertype or other subtypes z

  Student Member collegeName studentId discountRate deposit Paid m embershipEx piryDat e

  z Create a subtype of a supertype when: z The subtype has additional attributes of interest z

  The subtype has additional associations of interest z

  The subtype concept is operated upon, handled, reacted to or manipulated differently than the supertype or other subtypes, in

  2 9

  Abstract Types

  These should all be considered in the context of the problem domain.

  z Example: z

  If every member of a type T is also a member of a subtype, then type T is called an abstract type.

  3 0

  Credit Payment Cheque Payment Cash Payment

  Payment

  abstract type in dicaed by italic

  A Student Member is a Member

  2 8

  CONCEPTUAL MODEL Multiplicities

  memberOfStaff MemberOfStaff

  z Multiplicity defines how many instances of class A can be associated with one instance of class B, at a particular moment in time time.

  Store Item

  GEN-SPEC Generalization

  z Every memberOfStaff is a LibraryMember z memberOfStaff is more specialized than

  LibraryMember

  LibraryMember - or - LibraryMember is a generalization of MemberOfStaff z some operations may only be specific to

  GEN-SPEC

  M ember name m emberId phone address

  z The conceptual model can be extended using generalization. z

  Generalization is the activity of z identifying commonality among concepts z defining supertype and subtype relationships

  2 7 Credit Pay ment Cheque Payment Cash Payment

  Payment suupertype - more general subtype - mor e specialized

  z A supertype definition is more general or encompassing than a subtype definition. z

  All the instances of a subtype are instances of their supertype set. E l

SUBTYPE/SUPERTYPE

  • COMPOSITION

  p z

  can include a new method implementing the same operation for which Lecturer already had a method

  GEN-SPEC

  z

  Inheritance

  z DirectorOfStudies inherits from Lecturer z DirectorOfStudies is a subclass (derived class) of Lecturer z DirectorOfStudies is a specialization of Lecturer

  Le ct ure r

  name submit Marks()

  3 5

  DirectorOfStudies is more specialized than Lecturer z Lecturer is a superclass (base class) of

  receipt of some message, from what lecturer implements

  DirecorOfStudies z Lecturer is a generalization of

  DirectorOfStudies

  Dire ct orOfSt udies

  overseeSt udent s()

  Association Classes

  z An association between two classes can be treated as a class with attributes and operations. z

  The name of the association class and the name of the association should be the same. M odule **

  3 6

  z As well as inheriting the methods of Lecturer, DirectorOfStudies

  z Possible for DirectorOfStudies to implement different behaviour, on

  An Association Class avoiding an Association Class 1..*

  • * 1 Student Module 1..* Mark *
  • 1 is taking 1..* * 1 * 1..* 1. .* 1 S tudent is tak ing 1. .* is Tak ing m ark

      z Composition is a special kind of aggregation. z In a composition association, the whole strongly owns its parts. z

      Aggregation and Composition Aggregation is a kind of association for modeling whole-part relationships

      Ha nd Fin ger

      1

      1 0..7 AGGREGATION

      z

      Aggregation is a way of recording that an object is part of an

      object of another class z An object can simultaneously be part of several other objects e.g. j y p j g a single Module could be part of several different HonoursCourses.

      HonoursCourse Module * 1..*

      If the whole object is copied or deleted, its parts are copied or deleted with it.

      include in the class the extra attributes and operations of DirectorOfStudies.

      3 3

      z The multiplicity at the whole end must be 1 or 0..1 i.e. a part cannot be part of more than one whole by composition. z

      Composition is shown like an aggregation, except that the diamond is filled in. z

      An object can simultaneously be part of several other objects e.g. a single Module could be part of several different HonoursCourses.

      Board

      Square

      GEN-SPEC Inheritance z Problem : a Lecturer class has been implemented. Add a new class

      called DirectorOfStudies, a kind of lecturer who apart from performing the same duties as a lecturer, is responsible for overseeing the progress of certain students.

    • 1
    • 1

      3 4 z Solution: specify DirectorOfStudies as a subclass of Lecturer and