In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to carry out UML class diagram example analysis, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.
UML modeling language is very useful in the process of software development. Here we will introduce an example of UML class diagram. I hope you will have a new understanding of UML modeling language through the examples of this section. Please take a look at the details of this section next.
An example of UML class diagram for easy introduction to Unified Modeling language
This series will give a complete example of modeling with UML, comprehensively applying the previous knowledge to achieve the purpose of "taking the rest of this as an example".
ATM (automatic teller machine) was a very new thing in our country ten years ago, but now it can be seen everywhere in the streets and alleys of cities. We also often deal with ATM in our daily life. Next we will take the simplified ATM system as an example to apply the knowledge of use case diagram, class diagram, sequence diagram, state diagram, activity diagram and collaboration diagram learned in the previous chapters to this example.
UML class diagram instance
Figure 1.2UML comprehensive example of the banking system class diagram
The UML comprehensive example banking system class diagram shown in figure 1.2 is similar to figure 3.5, except that the staff is replaced with ATM. The whole banking system includes account bank, bank depositor bank and ATM system.
Many individual accounts make up the account bank. The account has three attributes: account type, account number and balance, all of which are private, and their types are char,int,double respectively. The six operations are setType, getType, getAccountNumbe, setAccountNumbe, caculateBalance, getBalance, and all of them are public except caculateBalance for protected.
SetType sets the account type, the return type is void, the parameter type is char, and enter the account type.
GetType gets the account type, and the return type is char with no parameters.
SetAccountNumbe sets the account number, the return type is void, the parameter type is int, enter the account number.
GetAccountNumbe gets the account number, and the return type is int, with no parameters.
CaculateBalance calculates the balance. The return type is void, the parameter is double,***, the input deposit and withdrawal amount is the parameter, and the second parameter is the deposit balance, which is both input and output.
GetBalance gets the account balance with a return type of double with no parameters.
Many bank depositors form depositors' banks. The ATM system includes many ATM machines. What attributes and operations are included in the two classes of bank depositors and ATM machines, their visibility and the return type, number of parameters and parameter types of the operation are clear from the class diagram. More attributes and operations can be added one by one to make the class diagram more specific and complete, so that each member involved in the project can understand the structure of the entire designed class without ambiguity. Also for a real banking system, this class diagram is too simple. For example, the account type, we can first define an abstractclass, which contains the most basic properties and operations of an account. Some operations are first defined as abstract, such as the calculation of the balance. And then continue with this abstractclass, we can have savingaccount, checkingaccount and so on. Different accounts have different balance calculation methods, we can add specific algorithms. There may be some unique operations for different accounts, we can also add, for example, savingaccount can enjoy a discount on air tickets when the deposit reaches. UML class diagram examples through the class diagram can not only enable designers to clearly express their design intentions, but also help the group to organize their own ideas, enrich and optimize their own design.
The above is how to carry on the UML class diagram example analysis, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.