Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of ATM State Diagram, activity Diagram and collaboration Diagram of UML instance

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the UML instance ATM state diagram, activity diagram and collaboration diagram example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

1.4 State diagram

Figure 1.4 depicts several states that customers experience when operating on an ATM, as well as the conditions for transitions between them. Because it is a simplified example, in addition to waiting for the customer to insert the starting state of the magnetic card and the ending state of the service, the customer will be in four states: entering the password, selecting the type of service, deposit and withdrawal.

Figure 5.4ATM state chart

Enter the password state after inserting the magnetic card, enter the selected service type state when the password is entered correctly, and stay in the original state when the password is incorrect, but if it is incorrect for three times, the service ends. After entering the choice of service type, customers can enter the state of deposit and withdrawal according to the choice. After the deposit and withdrawal, the customer can not only choose to end the service to the final state, but also can choose to continue the service to return to the selected service type state.

Through the state diagram, we can unambiguously understand how each active role changes under different conditions, what are the conditions for the transition, whether there will be a deadlock, whether there are conditions that have not been fully considered, and whether there are states that cannot be achieved. State diagrams can help us find problems and correct them in time. Let's take a look at the activity diagram in the UML instance ATM.

1.5 activity diagram

Figure 1.5 refers to the article "AHands-OnIntroductionforDevelopers" of RandyMiller. The customer management and transaction management in figure 1.3 correspond to the Bank in figure 1.5. The card reader, display, input device and banknote counter in figure 1.3 correspond to the ATMMachina in figure 5.5.The bank depositor is Customer. At first glance, the meaning of the activity diagram is very similar to that of the sequence diagram. However, we can notice that the sequence diagram focuses on the sequence of time, while the activity diagram focuses on the mutual restriction between the parts, which can be effectively expressed for some parallel activities. For example, at fork and join in figure 1.5, we can clearly see the existence of some parallel activities.

In this UML example, the activity diagram starts with the customer inserting the card and ends with the customer picking up the card. We can see that although the focus of the activity diagram is not on the chronological order, we can also get the time information.

Figure 1.***TM banking system activity chart

1.6 collaboration Diagram

The collaboration diagram in the UML instance ATM, in the fourth chapter, we know that the collaboration diagram and the sequence diagram can be transformed into each other without information loss, but their emphasis is different. Sequence diagrams focus on the chronological order of message delivery between objects, while collaboration diagrams focus on expressing static connections between objects. Figure 1.6 converts the 5.3 diagram into a collaboration diagram.

1. Insert ATM card

2. Accept ATM card

3. Query password

4. Show request for password input

5. Enter the password

6. Password transmission

7. Request confirmation of password validity

8. Confirm the validity of the password

9. Ask about the type of service

10. Show input service category request

11. Enter a withdrawal request

12. Withdrawal request

13. Inquire about the amount of withdrawal

14. Show request for input amount

15. Enter the amount of withdrawal

16. Transfer the amount of withdrawal

17. Ask for confirmation of the amount of withdrawal

18. Show request for confirmation of amount

19. Enter confirmation

20. Pass confirmation message

21. Request for confirmation of legality of amount

22. Confirm the amount and legality

23. Request for banknotes

24. Calculate the account balance

25. Issuing banknotes

26. Withdraw money

27. Pass the balance and ask if any other services are needed

28. Show the account balance and prompt to select the following services

Figure 1.6ATM system collaboration diagram

From the diagram, we can see that the roles of the collaboration diagram and the objects of the sequence diagram correspond one to one, while the cooperation relationship on the objects on the collaboration diagram and the message delivery on the sequence diagram correspond to each other one by one.

Thank you for reading this article carefully. I hope the article "sample Analysis of ATM State Diagram, activity Diagram and collaboration Diagram of UML instances" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report