software development 2011-2014 theory slideshows by mark kelly edited and modified by mr hem use...
TRANSCRIPT
Software Development 2011-2014Theory Slideshows
By Mark KellyEdited and Modified by Mr
Hem
Use Cases UML
Use-case actors relaxing
UML
• Unified Modelling Language• A standard graphical language to model
computer applications. • Is programming-language independent, can
be used with C++, Visual Basic, Java, Python: anything.
UML
UML provides several types of diagrams to represent applications under development.– class diagram– sequence diagram– statechart diagram– component diagram– deployment diagram.– activity diagram
And...
Use Case Diagram
• UCD• The diagram we need to know for VCE SD.• Is a picture of functional requirements in an
information system.• Lists the tasks that a system can do.
Use Case Diagram:• Used during analysis phase of PSM• Maps out the functional requirements of a
system• Describes what a system does from the
standpoint of an external observer. • The emphasis is on what a system does rather
than how.• (How is worked out during design phase of
PSM)
UCD• Serves to scope the system’s high-level functionality
– Defines what functions will or will not be performed by the system– Shows developers if they have missed anything important.
• help development teams visualise the functional requirements of a system
• Used to highlight new requirements as the system is analysed and the design takes shape.
• E.g. “if we now want the system to do X, we’ll also need it to do A, B and C.”
UCD
• Good tool for communicating with clients due to their simplicity.
• Umm – simplicity of the UCD, not the client.
• Well, usually.
UCD COMPONENTS
• Actors• Use Cases• Relationships (communications)• Includes, extends• System boundaries
ACTORS• A person, organisation, or external system
that plays a role in the system being developed.
• May initiate or participate in processes.• Actors are drawn as stick figures. • Cos stick figures are cool. • Like ninjas, but without swords.
ACTORS
• Always drawn around the edges of the UCD• The same actor only appears once in a UCD• Must be connected to at least one process• ‘Process’ is called a Use Case.
Use Case
• Pronounced “yoose case”, not “yooze case”• Drawn as an oval• Name is put in or under the oval• Name must start with an active verb (“make”,
“open” etc)
Watch out!
• In a use case’s name don't combine sentences with commas or 'and'.
• This implies that interactions have been combined.
• Same rule applies in DFDs
Association
• Sometimes called “communication”• Shown as a line.• Sometimes shown as arrow (more details later)• Connects an actor to a use case.• Each actor may be associated with several use
cases.• Each use case may be associated with several
actors.
Arrowed associations
Important thing to make clear now• Arrows do not indicate data flow!• They are not Data Flow Diagrams (DFD)• Communication is always two way between
actor and use case.
Arrows in UCD
• An arrow just indicates which actor initiated the use case (the primary actor) and which actor was affected by it starting (the passive actor)
• With no arrow, it’s unclear which actor started a use case...
Example
Can a patient make an appointment, or can a scheduler? Or both? Can a scheduler cancel an appointment?Hard to say.
Reading a UCD
• The “Make Appointment” use case contains the procedures involved in that activity• The use case will define the procedures for setting up the appointment.
Reading a UCD
• The patient may request medication.• The “Request medication” use case specifies how the system will handle that request for medication.
Reading a UCD
• Perhaps these procedures will be in the “Pay Bill” use case:
1.generate invoice2.send invoice3.cash the cheque4.send a receipt
Version 2Arrows make it clearer:-Only patients make and cancel appointments, not schedulers-Patients request medication, doctors respond- Clerks begin the bill payment use case. Patients respond.
Quick Quiz1. How many actors
are in this UCD?2. How many
communications (associations)?
3. How many use cases?
4. Can a doctor request that a patient be given medication?
Think it out...
Quick Quiz1. How many actors
are in this UCD? 42. How many
communications (associations)? 8
3. How many use cases? 4
4. Can a doctor request that a patient be given medication? Yes.
Actors are roles, not individuals or job titles
• Mr Southerby as CEO needs access to management information.
• Fred Smith as Order Entry Clerk needs to enter orders.
• Sometimes Mr Southerby may need to enter an order when Fred isn't there...
• But DON’T draw an arrow between Mr Southerby and the Enter Order use case!
Actors are roles, not individuals or job titles
• Entering orders is not the role of the CEO. • It’s the role of the clerk.• So when Mr Southerby enters orders, he’s
taking on the role of Order Entry Clerk.
Actors are roles, not individuals or job titles
• The system does not know or care which individual is entering orders.
• The system cares which agent is doing it.• And when Mr S enters an order, he is at that
moment the agent called the ‘order entry clerk’.
Actors are roles, not individuals or job titles
Actors are roles, not individuals or job titles• When naming actors, think of the role that a
person takes on rather than their name or job title.
• Most job titles involve the putting on of a number of different hats in different situations.
• Name the actor with the role, not a job title. Think hats!
The final UCD
More practice
1.Which actor initiates the entering of an order?2.Which actor responds to an order being entered?3. Is the Accounts System actor a human?4.Who starts off the getting of an address?5.Can the Accounts System cancel an order?6.During order entry, does the accounts system
send information to the order entry clerk?7.Who is the passive actor during order entry?8.Who is the primary actor during order entry?
More practice
During order entry, does the accounts system send information to the order entry clerk?
Yes. The arrow does not indicate the direction of data flow.
Data flow is always 2-way (unlike a DFD)
Another example• Use-case
diagrams generally show groups of use cases.
• What can you deduce from this UCD?
Another example• This system
lets the band manager view a sales statistics report and the Billboard report for the band's CDs.
Another example
• It also lets the record manager view a sales statistics report and the Billboard report for a particular CD.
Another example• Our system
fetches Billboard reports from an external system called Billboard Reporting Service.
Another example• In addition, the absence of use
cases in this diagram shows what the system doesn't do.
• There is no way for a band manager to listen to songs from the different albums on the Billboard because we see no reference to a use case called Listen to Songs from Billboard 200.
• This absence is not a trivial matter. • It might show developers that extra
functionality is required of the system.
<<INCLUDE>>
• <<include>> • like a subprogram• denotes the inclusion of behaviour described
by another use case. • saves repetition and wasted space.• Shown as a dotted line with “<<include>>”
label
<<INCLUDE>>
• Both the Manage Customer Details and Enter Order use cases include the Find Customer Record use case.
• They both have the procedures from Find Customer Record in common.
<<extend>>
• Like a conditional <<include>>.• Only takes place under certain conditions. • An <<extend>> is a use case that extends another use case (the ‘base’ use case) when circumstances require it.•When the extending use case’s activities are finished, the base use case’s activities resume from the point they branched off into the <<extend>> use case.
<<extend>>
• Like a conditional <<include>>.• Only takes place under certain conditions. • An <<extend>> is a use case that extends another use case (the ‘base’ use case) when circumstances require it.•When the extending use case’s activities are finished, the base use case’s activities resume from the point they branched off into the <<extend>> use case.
<<extend>>
•The extending use case is really an alternate course of the base use case•It can be used to describe different actions to be taken dependent on current condition. •In other words, it can indicate conditional branches in activities.•Shown as a dotted line with “<<extend>>” label
<<extend>>Note how some activities only take place if wine has been ordered.
Note: Solid lines or arrows between use cases are not allowed. The only way to link use cases is with includes or extends.
Creating a UCD
Then convert the text to a UCD:
• Clerk enters customer ID into system.• If ID exists, account management module is triggered.• Otherwise, New Account module is triggered.• Then, clerk enters a product IDs of customer's purchase.• If an item is not in stock, customer is advised of delay in delivery and the
back-order process is triggered.• 4 to 5 may be repeated• Clerk then.... (etc)
Creating a UCD
Then convert the text to a UCD:
• Clerk enters customer ID into system.• If ID exists, account management module is triggered.• Otherwise, New Account module is triggered.• Then, clerk enters a product IDs of customer's purchase.• If an item is not in stock, customer is advised of delay in delivery and the
back-order process is triggered.• 4 to 5 may be repeated• Clerk then.... (etc)
System Boundaries• You can draw a rectangle – the system boundary -
around use cases to indicate the scope of the system. They are not often used.
• An example of their use is to mark off functional components that will be rolled out in different major releases of a system...
Generalisation
• Not examinable, but nice to know• If there is a triangular arrowhead to a use
case it indicates generalisation/specialisation.• This means that one particular use case might
have much in common with another more general use case
• Might have similar behaviours, constraints, requirements etc.
Generalisation
• If so, to save repetition, describe the use case just once for the general case.
• Where there are specific variations of this general case, just use the general case and describe the differences involved in the special cases.
Generalisation• E.g. dealing with a customer
order placed over the telephone, and dealing with an order placed over the internet have many things in common.
• There's only a small difference based on the source of the order.
• This can be shown like this:
Generalisation• A general, multipurpose "Place
order" use case is defined• It contains all the behaviours that
phone orders and internet orders have in common.
Generalisation• The "Phone order" and "internet
order" use cases contain just the specific behaviours required for each ordering method.
• Then they share the general behaviour described in the "Place order" case study.
Generalisation• The Place order use-case (called the parent
use case) may not only be used by the specialised (child) use cases.
• The parent may be used in its own right.
•The order registry clerk can enter the order for a customer• The clerk can just follow the behaviours in Place order.• Does not use child use cases needed when customers order themselves.
Another example
• use cases: “customer uses machine”, “maintain machine” and “audit”•Actors: “customer”, maintenance engineer“,”“local branch official” and “central computer”. •actors are stick people (even where they are machines).
Another example
•Lines (associations) connect use cases to 1 or more actors•box around the use cases emphasizes the boundary between the system (defined by the use cases) and the actors who are external.
Final examples•Note how headed arrows show:
• the Local bank office initiates the ATM maintenance use case; • the customer initiates the use of the ATM;• the use of the ATM initiates interaction with the central computer.
PracticeCreate a UCD to describe the following
requirements of a new system.• Customers can contact salesmen to make a
purchase.• Salesmen enter the sale into the sales database.• Customers can track their sale’s progress via the
database.• The accounts department sends an invoice to the
customer.