ooad-lecture2-usecasediagram

Upload: awais-sahab

Post on 07-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    1/19

    Use Case DiagramsUse Case Diagrams

    UMLUML--Behavioral DiagramBehavioral Diagram

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    2/19

    UML DiagramsUML Diagrams

    UMLUML

    UseUseCaseCase

    ClassClassdiagramdiagram

    sequencesequencediagramdiagram

    statestatetransitiontransitiondiagramdiagram

    activityactivitydiagramdiagram

    objectobjectdiagramdiagram

    CollaboratiCollaboration diagramon diagram

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    3/19

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    4/19

    The difficult y with requirementsThe difficult y with requirementsSy stem Requirements are normall y written in EnglishSy stem Requirements are normall y written in English

    According to the Oxford English Dictionar y, the 500 words used most in the According to the Oxford English Dictionar y, the 500 words used most in theEnglish language each have an average of 23 different meanings.English language each have an average of 23 different meanings.

    Anti Anti--nuclear protestors released live cockroaches insidenuclear protestors released live cockroaches insidethe White House Frida y, and these were arrested whenthe White House Frida y, and these were arrested when

    the y left and blocked a securit y gate.the y left and blocked a securit y gate.

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    5/19

    From a British Airwa ys Memorandum, quoted in PilotFrom a British Airwa ys Memorandum, quoted in PilotMagazine, December 1996:Magazine, December 1996:

    The Landing Pilot is the NonThe Landing Pilot is the Non- -Handling Pilot until the decision altitude call, whenHandling Pilot until the decision altitude call, when

    the Handling Nonthe Handling Non- -Landing Pilot hands the handling to the NonLanding Pilot hands the handling to the Non- -Handling LandingHandling LandingPilot, unless the latter "calls go around," in which case the Handling NonPilot, unless the latter "calls go around," in which case the Handling Non- -LandingLandingPilot continues handling and the NonPilot continues handling and the Non- -Handling Landing Pilot continues nonHandling Landing Pilot continues non- -handling until the next call of "land" or "go around" as appropriate.handling until the next call of "land" or "go around" as appropriate.

    In view of recent confusions over these rules, it was deemed necessar y toIn view of recent confusions over these rules, it was deemed necessar y torestate them clearl y.restate them clearl y.

    Now s yntax is oka y BUT U cant getNow s yntax is oka y BUT U cant getthe sense out of it.can u???the sense out of it.can u???

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    6/19

    Now, whats wrong with theseNow, whats wrong with thesestatements?statements?

    The s ystem shall list all the details of the members.The s ystem shall list all the details of the members.

    Instructions to make teaInstructions to make teaFill kettle with water Fill kettle with water

    Put tea bag in cupPut tea bag in cup

    Pour water from kettle into cupPour water from kettle into cup

    Add milk &/or sugar (to taste) Add milk &/or sugar (to taste)

    DrinkDrink

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    7/19

    As you alread y know As you alread y knowCompleteComplete

    UnambiguousUnambiguous

    Correct ( does what the user wants)Correct ( does what the user wants)

    . Whatever that is.. Whatever that is.

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    8/19

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    9/19

    CheckCheck- -List of Fuzz y requirementsList of Fuzz y requirements

    Words and phrases whose meaning can be disputed between developer andWords and phrases whose meaning can be disputed between developer andcustomer, such as instantaneous, simultaneous, achievable, minimum,customer, such as instantaneous, simultaneous, achievable, minimum,

    Contractuall y troublesome phrases:Contractuall y troublesome phrases:

    "Design goal." The developer will spend mone y and other resources"Design goal." The developer will spend mone y and other resourceswith no guarantee of goal accomplishment.with no guarantee of goal accomplishment.

    "To the extent practicable." A decision in the e yes of the developer."To the extent practicable." A decision in the e yes of the developer.

    "Where applicable." There are no criteria for judgment."Where applicable." There are no criteria for judgment.

    "S hall be considered." The developer will think about."S hall be considered." The developer will think about.

    "A minimum of X." The developer will provide exactl y X."A minimum of X." The developer will provide exactl y X.

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    10/19

    Use CaseUse Case- -definitiondefinition

    a diagram that shows a set of use cases, actors and their relationships.a diagram that shows a set of use cases, actors and their relationships.

    use cases represent s ystem functionalit y, the requirements of the s ystem fromuse cases represent s ystem functionalit y, the requirements of the s ystem from

    users perspective.users perspective.

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    11/19

    NotationsNotationsUse caseUse case

    a description of a set of sequences of actions, includinga description of a set of sequences of actions, includingvariants, that s ystem performs, which yields an observablevariants, that s ystem performs, which yields an observablevalue to an actor.value to an actor.

    Actor Actor

    People or s ystem that provide or receive information fromPeople or s ystem that provide or receive information fromthe s ystem; the y are among the stake holders of thethe s ystem; the y are among the stake holders of thes ystems ystem

    IncludesIncludes

    specifies that the source use case explicitl y incorporatesspecifies that the source use case explicitl y incorporatesthe behavior of another use case. at a location specified b y the behavior of another use case. at a location specified b y the source.the source.

    ExtendsExtends

    specifies that the target use case extends the behavior of specifies that the target use case extends the behavior of

    the source.the source.

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    12/19

    S ample Use CaseS ample Use Case

    Appl y course Appl y course Appl y course Appl y course

    LoginLoginLoginLogin

    View courseView courseparticularsparticulars

    View courseView courseparticularsparticulars

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    13/19

    Actors Actors

    Could be human beings, other s ystems, timersCould be human beings, other s ystems, timersand clocks or other hardware devices.and clocks or other hardware devices.

    Could be human beings, other s ystems, timersCould be human beings, other s ystems, timersand clocks or other hardware devices.and clocks or other hardware devices.

    Actors that stimulate the s ystem and are the Actors that stimulate the s ystem and are theinitiators of the event are called primar y actorsinitiators of the event are called primar y actors(active). Actors that onl y receive stimuli from(active). Actors that onl y receive stimuli from

    the s ystem are called secondar y actorsthe s ystem are called secondar y actors(passive).(passive).

    Actors that stimulate the s ystem and are the Actors that stimulate the s ystem and are theinitiators of the event are called primar y actorsinitiators of the event are called primar y actors(active). Actors that onl y receive stimuli from(active). Actors that onl y receive stimuli from

    the s ystem are called secondar y actorsthe s ystem are called secondar y actors(passive).(passive).

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    14/19

    Actors Actors

    Who or what will be interestedWho or what will be interestedin the s ystem?in the s ystem?

    Who or what will be interestedWho or what will be interestedin the s ystem?in the s ystem?

    who or what will want to changewho or what will want to changethe data in the s ystem?the data in the s ystem?

    who or what will want to changewho or what will want to changethe data in the s ystem?the data in the s ystem?

    who or what will want towho or what will want tointerface with the s ystem?interface with the s ystem?

    who or what will want towho or what will want tointerface with the s ystem?interface with the s ystem?

    who or what will want towho or what will want tointerface with the s ystem?interface with the s ystem?

    who or what will want towho or what will want tointerface with the s ystem?interface with the s ystem?

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    15/19

    G uidelines and CautionsG uidelines and CautionsUse cases should begin with a verb. i.e. generate report. use cases should notUse cases should begin with a verb. i.e. generate report. use cases should notbe open ended i.e. Register, it should rather be Register new student.be open ended i.e. Register, it should rather be Register new student.

    Avoid showing communication between actors. Avoid showing communication between actors.

    Actors should be named as singular. i.e. student and not students. Also no Actors should be named as singular. i.e. student and not students. Also nonames should be used i.e. John, sam etc.names should be used i.e. John, sam etc.

    Do not show behavior in a use case diagram. Instead onl y depict s ystemDo not show behavior in a use case diagram. Instead onl y depict s ystemfunctionalit y.functionalit y.

    Use case diagrams do not show sequence.Use case diagrams do not show sequence.

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    16/19

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    17/19

    Draw a use case diagram?Draw a use case diagram?

    In order to generate an invoice clerk must login. if a clerk is a first time user, oneIn order to generate an invoice clerk must login. if a clerk is a first time user, onemust have themselves registered. there should be an option for the user tomust have themselves registered. there should be an option for the user toregister on self with in the login page. an y user can use the s ystem to viewregister on self with in the login page. an y user can use the s ystem to viewproducts online.products online.

    the option of log in is also provided when a user views products online.the option of log in is also provided when a user views products online.

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    18/19

    The use case diagramThe use case diagram

    Register Register User User

    Register Register User User

    LoginLoginLoginLogin

    View ProductsView ProductsView ProductsView Products

    ClerkClerk User User

    G enerateG enerateReportReport

    G enerateG enerateReportReport

  • 8/6/2019 OOAD-Lecture2-UsecaseDiagram

    19/19

    Hotel Management Sy stemHotel Management Sy stemG uests can reserve room in the hotel in advance or can reserve rooms onG uests can reserve room in the hotel in advance or can reserve rooms onspot depending on the availabilit y of the rooms. The operator would enter spot depending on the availabilit y of the rooms. The operator would enter data pertaining to guests such as their arrival time, advance paid, anddata pertaining to guests such as their arrival time, advance paid, andapprox: duration of sta y and t ype of room required e.g. ac, non ac, deluxe,approx: duration of sta y and t ype of room required e.g. ac, non ac, deluxe,single or double. The computer should register this data and dependingsingle or double. The computer should register this data and dependingon the availabilit y of a suitable room, the computer should provisionall y aon the availabilit y of a suitable room, the computer should provisionall y alot a room number to the guests. And assign a unique token number tolot a room number to the guests. And assign a unique token number tohim or her. if the guests can not be accommodated the computer him or her. if the guests can not be accommodated the computer generates an apolog y message.generates an apolog y message.

    The hotel catering services manager would input the quantit y and t ype of The hotel catering services manager would input the quantit y and t ype of food items as and when consumed b y the guests along with the tokenfood items as and when consumed b y the guests along with the tokennum of the guests and the corresponding data and time. You can assumenum of the guests and the corresponding data and time. You can assume

    that different food items have different code numbers and hence thethat different food items have different code numbers and hence thecatering services manager need not enter the full name of different foodcatering services manager need not enter the full name of different fooditems.items.

    When a customer prepares to check out the hotel automation softwareWhen a customer prepares to check out the hotel automation softwareshould generate the entire bill for the customer and the balance amountshould generate the entire bill for the customer and the balance amountpa yable b y him.pa yable b y him.