Advance Software Engineering                                                          UML Diagram                         ...
Advance Software Engineering                                                             UML Diagramtransition line connec...
Advance Software Engineering                                                          UML DiagramAs shown in Figure 5, eac...
Advance Software Engineering                                                                        UML DiagramSynch state...
Advance Software Engineering                                                           UML DiagramSwim lanesIn activity di...
Advance Software Engineering                                                                              UML Diagram     ...
Advance Software Engineering                                                                          UML Diagramverificat...
Upcoming SlideShare
Loading in...5
×

Lab # 05

588

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
588
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Lab # 05"

  1. 1. Advance Software Engineering UML Diagram LAB # 05Objective: • To understand Activity Diagram.The Activity DiagramThe purpose of the activity diagram is to model the procedural flow of actions that are part of alarger activity. In projects in which use cases are present, activity diagrams can model a specificuse case at a more detailed level. However, activity diagrams can be used independently of usecases for modeling a business-level function, it models procedural flow, the activity diagramfocuses on the action sequence of execution and the conditions that trigger or guard thoseactions. The activity diagram is also focused only on the activitys internal actions and not on theactions that call the activity in their process flow or that trigger the activity according to someevent.Although UML sequence diagrams can protray the same information as activity diagrams, butactivity diagrams show all potential sequence flows in an activity, whereas a sequence diagramtypically shows only one flow of an activity.The basicsConsider the action element in an activity diagram, whose official UML name is action state. Anaction is indicated on the activity diagram by a "capsule" shape. The text inside it indicates theaction (e.g., Customer Calls Ticket Office or Registration Office Opens).Figure 1: A sample action that is part of an activity diagram.Because activity diagrams show a sequence of actions, they must indicate the starting point ofthe sequence. The initial state is drawn as a solid circle with a transition line (arrow) thatconnects it to the first action in the activitys sequence of actions. Figure 2 shows what anactivity diagrams initial state looks like.It is important to note that there can be only one initial state on an activity diagram and only one 1
  2. 2. Advance Software Engineering UML Diagramtransition line connecting the initial state to an action. Although it may seem obvious that anactivity can have only one initial state, there are certain circumstances -- namely, thecommencement of asynchronous action sequences -- that may suggest that a new initial stateshould be indicated in the activity diagram. UML does not allow this. Figure 3 offers an exampleof an incorrect activity diagram, because the initial state has two transition lines that point to twoactivities.Figure 3: Incorrect rendering of an initial state within an activitydiagram. The initial state can indicate only ONE action.The activitys flow terminates when the transition line of the last action in the sequence connectsto a "final state" symbol, which is a bullseye (a circle surrounding a smaller solid circle).Beyond the basicsActivities modeled for real software development projects include decision points that controlwhat actions take place. And sometimes activities have parallel actions.Decision pointsTypically, decisions need to be made throughout an activity, depending on the outcome of aspecific prior action. In creating the activity diagram for such cases, you might need to modeltwo or more different sequences of actions. The UML specification provides two ways to modeldecisions like this. The first way is to show a single transition line coming out of an action andconnecting to a decision point. The UML specification name for a decision point is decision, andit is drawn as a diamond on an activity diagram. Since a decision will have at least two differentoutcomes, the decision symbol will have multipletransition lines connecting to different actions. Figure 5shows a fragment of a sample activity diagram with adecision.Figure 5: A decision point models a choice that must be madewithin the sequence of actions. 2
  3. 3. Advance Software Engineering UML DiagramAs shown in Figure 5, each transition line involved in a decision point must be labeled with textabove it to indicate "guard conditions," commonly abbreviated as guards. Guard condition text isalways placed in brackets -- for example, [guard condition text]. A guard condition explicitlytells when to follow a transition line to the next action. According to the decision point shown inFigure 5, a bartender (user) only needs to "make sure the customer is at least 21 years old" whenthe customer orders an alcoholic drink. If the customer orders any other type of drink (the "else"condition), then the bartender simply gets the drink for the customer. The [else] guard iscommonly used in activity diagrams to mean "if none of the other guarded transition linesmatches the actual condition," then follow the [else] transition line.Merge pointsSometimes the procedural flow from one decision path may connect back to another decisionpath, as shown in Figure 6 at the "Customers Age > = 21" condition. In these cases, we connecttwo or more action paths together using the same diamond icon with multiple paths pointing toit, but with only one transition line coming out of it. This does not indicate a decision point, butrather a merge.Figure 6 shows the same decision as in Figure 5, but Figure 6 expands the activity diagram.Performing a check of the customers age leads the user to a second decision: If the customer isyounger than 21, the bartender must tell the customer to order another non-alcoholic drink,which takes our sequence back to the action "Customer Orders Drink." However, if the customeris 21 years old or older, then our action sequence takes take us to the same action the bartenderwould follow if the person had ordered a non-alcoholic drink: "Get Drink For Customer."Figure 6: A partial activity diagram, showingtwo decision points("Drink is alcoholic" and "Customers age <21") and one merge("else" and "Customers age >= 21") 3
  4. 4. Advance Software Engineering UML DiagramSynch states for asynchronous actionsWhen modeling activities, you sometimes need to show that certain action sequences can bedone in parallel, or asynchronously. A special notation element allows you to show parallelaction sequences, or synch states. To be clear, a synch state that forks actions into two or morethreads represents a de-synchronizing of the flow (asynchronous actions), and a synch state thatjoins actions back together represents a return to synchronized flow. A synch state is drawn as athick, solid line with transition lines coming into it from the left (usually) and out of it on theright (usually). To draw a synch state that forks the action sequence into multiple threads, firstconnect a transition line from the action preceding the parallel sequence to the synch state. Thendraw two transition lines coming out of the synch state, each connecting to its own action. Figure9 is an activity diagram fragment that shows the forking of execution modeled. Figure 9: A thick, solid line indicates a synch state, allowing two or more action sequences to proceed in parallel. 4
  5. 5. Advance Software Engineering UML DiagramSwim lanesIn activity diagrams, it is often useful to model the activitys procedural flow of control betweenthe objects (persons, organizations, or other responsible entities) that actually execute the action.To do this, you can add swim lanes to the activity diagram (swim lanes are named for theirresemblance to the straight-line boundaries between two or more competitors at a swim meet).To put swim lanes on an activity diagram, use vertical columns. For each object that executesone or more actions, assign a column its name, placed at the top of the column. Then place eachaction associated with an object in that objects swimlane. Figure 12 shows that two objects execute actions(e.g., Band Manager and Reporting Tool). The BandManager object executes the "Selects the View Sales ForMy Band Report" action, and the Reporting Toolexecutes the "Retrieve Bands the Band ManagerManages" action. It is important to note that, althoughusing swimlanes improves the clarity of an activitydiagram (since all the activities are placed in theswimlanes of their respective executor objects), all the previously mentioned rules governingactivity diagrams still hold true. In other words, you read the activity diagram just like you wouldif no swimlanes were used. 5
  6. 6. Advance Software Engineering UML Diagram Task TO Be Performed……Task # 01 : When I order Chinese food for delivery, I call the Chinese food delivery guy, give himmy phone number, and his computer will automatically display my address if Ive ordered foodbefore. But if Im a new customer calling for the first time, he must get my address before hetakes my order.Task# 02 : Below an activity diagram is shown. Give an interpretation of the diagram.Task# 03 : Eastern State University (ESU) BackgroundThe ESU course registration problem will be used as an example throughout this book. The process of assigningprofessors to courses and the registration of students is a frustrating and time consuming experience. After theprofessors of ESU have decided which courses they are going to teach for the semester, the Registrars office entersthe information into the computer system. A batch report is printed for the professors indicating which courses theywill teach. A course catalog is printed and distributed to the students. The students currently fill out (mulitpart,multicolor) registration forms that indicate their choice in courses, and return the completed forms to the Registrarsoffice. The typical student load is four courses. The staff of the Registrars office then enters the students forms intothe mainframe computer system. Once the students curriculum for the semester has been entered, a batch job is runovernight to assign students to courses. Most of the time the students get their first choice; however, in those caseswhere there is a conflict, the Registrars office talks with each student to get additional choices. Once all the studentshave been successfully assigned to courses, a hard copy of the students schedule is sent to the students for their 6
  7. 7. Advance Software Engineering UML Diagramverification. Most student registrations are processed within a week, but some exceptional cases take up to twoweeks to solve. Once the initial registration period is completed, professors receive a student roster for each coursethey are scheduled to teach. Draw an activity diagram for the senerio described above.Task # 04 Draw an activity diagram models the business process of enrolling in a university, takes this approach. Astudent gets enrolled in the university if the form filled is correct otherwise a help system is available. If studentsuccessfully get enrolled in the university he/she can attend classes can enrolled in the seminar committee and needto pay library fee as well.Task # 05 Create an activity diagram describing the process of a person (user) using the machine to buy a ticketfrom Hamburg to Lübeck. Actually, the machine only takes coins (no credit cards, debit cards).Task # 06 Create a sequence diagram for the following collaboration. Use the classes and methods on the next slide.A customer wants to draw money from his bank account. He enters his card into an ATM (automated tellermachine). The ATM machine prompts „Enter PIN“. The customer enters his PIN. The ATM (internally) retrievesthe bank account number from the card. The ATM encrypts the PIN and the account number and sends it over to thebank. The bank verifies the encrypted Account and PIN number. If the PIN number is correct, the ATM displays„Enter amount“, draws money from the bank account and pays out the amount.(Use Swimlanes) 7

×