首页 > 其他分享 >学习uml2(不全)part1 (也许有part2)

学习uml2(不全)part1 (也许有part2)

时间:2023-07-20 16:02:16浏览次数:43  
标签:account author Administrator blog part1 part2 details uml2 new


 


UML 2.0 学习


《 Learning UML 2.0 》


1.Use case description


The series of examples bellow describe cases from the basic to the complicated. And a mode of use case template is introduced which is a wonderful one, I think.


 


      Basic:




学习uml2(不全)part1 (也许有part2)_class


Table 2-3. The detailed description for the "Create a new Personal Wiki" use case

Use case name

Create a new Personal Wiki

Related Requirements

Requirement A.2.

Goal In Context

A new or existing author requests a new personal Wiki from the Administrator.

Preconditions

The author has appropriate proof of identity.

Successful End Condition

A new personal Wiki is created for the author.

Failed End Condition

The application for a new personal Wiki is rejected.

Primary Actors

Administrator.

Secondary Actors

Author Credentials Database.

Trigger

The Administrator asks the CMS to create a new personal Wiki.

Main Flow

Step

Action

 

1

The Administrator asks the system to create a new personal Wiki.

 

2

The Administrator enters the author's details.

 

3

The author's details are verified using the Author Credentials Database.

 

4

The new personal Wiki is created.

 

5

A summary of the new personal Wiki's details are emailed to the author.

Extensions

Step

Branching Action

 

3.1

The Author Credentials Database does not verify the author's details.

 

3.2

The author's new personal Wiki application is rejected.


 


 


      Include:



学习uml2(不全)part1 (也许有part2)_blog_02


Use case name

Create a new Blog Account

Related Requirements

Requirement A.1.

Goal In Context

A new or existing author requests a new blog account from the Administrator.

Preconditions

The author has appropriate proof of identity.

Successful End Condition

A new blog account is created for the author.

Failed End Condition

The application for a new blog account is rejected.

Primary Actors

Administrator

Secondary Actors

None

Trigger

The Administrator asks the CMS to create a new blog account.

Included Cases

Check Identity

Main Flow

Step

Action

 

1

The Administrator asks the system to create a new blog account.

 

2

The Administrator selects an account type.

 

3

The Administrator enters the author's details.

 

4


include::Check Identity

The author's details are checked.

 

5

The new account is created.

 

6

A summary of the new blog account's details are emailed to the author.


 


 


Use case name

Create a new Personal Wiki

Related Requirements

Requirement A.2

Goal In Context

A new or existing author requests a new personal Wiki from the Administrator.

Preconditions

The author has appropriate proof of identity.

Successful End Condition

A new personal Wiki is created for the author.

Failed End Condition

The application for a new personal Wiki is rejected.

Primary Actors

Administrator

Secondary Actors

None

Trigger

The Administrator asks the CMS to create a new personal Wiki.

Included Cases

Check Identity

Main Flow

Step

Action

 

1

The Administrator asks the system to create a new personal Wiki.

 

2

The Administrator enters the author's details.

 

3


include::Check Identity

The author's details are checked.

 

5

The new personal Wiki is created.

 

6

A summary of the new personal Wiki's details are emailed to the author.


 




 


Use case name

Check Identity

Related Requirements

Requirement A.1, Requirement A.2.

Goal In Context

An author's details need to be checked and verified as accurate.

Preconditions

The author being checked has appropriate proof of identity.

Successful End Condition

The details are verified.

Failed End Condition

The details are not verified.

Primary Actors

Author Credentials Database.

Secondary Actors

None.

Trigger

An author's credentials are provided to the system for verification.

Main Flow

Step

Action

 

1

The details are provided to the system.

 

2

The Author Credentials Database verifies the details.

 

3

The details are returned as verified by the Author Credentials Database.

Extensions

Step

Branching Action

 

2.1

The Author Credentials Database does not verify the details.

 

2.2

The details are returned as unverified.


 


 


      Generializtion:



学习uml2(不全)part1 (也许有part2)_credentials_03


Use case name

Create a new Editorial Blog Account

Related Requirements

Requirement A.1.

Goal In Context

A new or existing author requests a new editorial blog account from the Administrator .

Preconditions

The author has appropriate proof of identity.

Successful End Condition

A new editorial blog account is created for the author.

Failed End Condition

The application for a new editorial blog account is rejected.

Primary Actors

Administrator.

Secondary Actors

None.

Trigger

The Administrator asks the CMS to create a new editorial account that will allow an author to edit entries in a set of blogs.

Base Use Cases

Create a new Blog Account

Main Flow

Step

Action

 

1

The Administrator asks the system to create a new blog account.

 

2

The Administrator selects the editorial account type.

 

3

The Administrator enters the author's details.

 

4

The Administrator selects the blogs that the account is to have editorial rights over.

 

5


include::Check Identity

The author's details are checked.

 

6

The new editorial account is created.

 

7

A summary of the new editorial account's details are emailed to the author.

Extensions

Step

Branching Action

 

5.1

The author is not allowed to edit the indicated blogs.

 

5.2

The editorial blog account application is rejected.

 

5.3

The application rejection is recorded as part of the author's history.


 


 


      Extend:



学习uml2(不全)part1 (也许有part2)_class_04


Use case name

Create a new Blog Account

Related Requirements

Requirement A.1.

Goal In Context

A new or existing author requests a new blog account from the Administrator.

Preconditions

The author has appropriate proof of identity.

Successful End Condition

A new blog account is created for the author.

Failed End Condition

The application for a new blog account is rejected.

Primary Actors

Administrator.

Secondary Actors

None.

Trigger

The Administrator asks the CMS to create a new blog account.

Included Cases

Check Identity

Main Flow

Step

Action

 

1

The Administrator asks the system to create a new blog account.

 

2

The Administrator selects an account type.

 

3

The Administrator enters the author's details.

 

4


include::Check Identity

The author's details are checked.

 

5

The new account is created.

 

6

A summary of the new blog account's details are emailed to the author.

Extensions

Step

Branching Action

 

4.1

The author is not allowed to create a new blog.

 

4.2

The blog account application is rejected.

 

4.3

The application rejection is recorded as part of the author's history.


 


 


2.Activity diagram


Based on:


Use case name

Create a new Blog Account

Related Requirements

Requirement A.1.

Goal In Context

A new or existing author requests a new blog account from the Administrator.

Preconditions

The system is limited to recognized authors, and so the author needs to have appropriate proof of identity.

Successful End Condition

A new blog account is created for the author.

Failed End Condition

The application for a new blog account is rejected.

Primary Actors

Administrator.

Secondary Actors

Author Credentials Database.

Trigger

The Administrator asks the Content Management System to create a new blog account.

Main Flow

Step

Action

 

1

The Administrator asks the system to create a new blog account.

 

2

The Administrator selects an account type.

 

3

The Administrator enters the author's details.

 

4

The author's details are verified using the Author Credentials Database.

 

5

The new blog account is created.

 

6

A summary of the new blog account's details are emailed to the author.

Extensions

Step

Branching Action

 

4.1

The Author Credentials Database does not verify the author's details.

 

4.2

The author's new blog account application is rejected.



学习uml2(不全)part1 (也许有part2)_class_05


 


 


3.class diagram


      dependency


 declares that a class needs to know about another class to use objects of that class.


 


The dependency relationship is often used when you have a class that is providing a set of general-purpose utility functions, such as in Java's regular expression (java.util.regex ) and mathematics (java.math ) packages. Classes depend on the java.util.regex and java.math classes to use the utilities that those classes offer.


      association


association means that a class will actually contain a reference to an object, or objects, of the other class in the form of an attribute.


Note that: the difference between association and dependency is that in the case of the former related objects are in the form of attributes and in the latter case there is no such a requirement. In the latter case related objects may be used as local variables or locally used.


 



学习uml2(不全)part1 (也许有part2)_class_06


the related codes are:


public class BlogAccount {     

            

         // Attribute introduced thanks to the association with the BlogEntry class     

        private BlogEntry[]      entries;     

            

         // ... Other Attributes and Methods declared here ...     

      }     

            

      public class BlogEntry {     

            

         // Attribute introduced thanks to the association with the Blog class     

         private BlogAccount blog;     

            

         // ... Other Attributes and Methods declared here ...     

      }


Note two words in the diagram: “blog” and “entries”. They are corresponded to the two fields in the two classes. And are there necessaries to mark up fields in the class diagram?


 


4.Object diagram


Object with a name:

学习uml2(不全)part1 (也许有part2)_application_07


 


Object with the name and class:

学习uml2(不全)part1 (也许有part2)_application_08


 


Anonymous object:

学习uml2(不全)part1 (也许有part2)_uml_09


 


Class diagram and object diagram:


Class diagrams describe how all of the different types of objects within your system interact with each other. They also draw attention to the many ways that the objects will exist and interact within your system at runtime. In addition to class diagrams, object diagrams help you capture the logical view of your model,


5.Sequence Diagram


Table 7-1. How to understand the components of a participant's name

Example participant name

Description

admin

A part is named admin, but at this point in time the part has not been assigned a class.

: ContentManagementSystem

The class of the participant is ContentManagementSystem, but the part currently does not have its own name.

admin : Administrator

There is a part that has a name of admin and is of the class Administrator.

eventHandlers [2] : EventHandler

There is a part that is accessed within an array at element 2, and it is of the class EventHandler.

: ContentManagementSystem ref cmsInteraction

The participant is of the class ContentManagementSystem, and there is another interaction diagram called cmsInteraction that shows how the participant works internally (see "A Brief Overview of UML 2.0's Fragment Types," later in this chapter).


 


Event, signal, message:


Events are the building blocks for signals and messages. Signals and messages are really different names for the same concept: a signal is the terminology often used by system designers, while software designers often prefer messages.



学习uml2(不全)part1 (也许有part2)_credentials_10


another diagram:



学习uml2(不全)part1 (也许有part2)_blog_11


 


message signatures:


A message arrow comes with a description, or signature. The format for a message signature is:


attribute = signal_or_message_name (arguments) : return_type


You can specify any number of different arguments on a message, each separated using a comma. The format of an argument is:


<name>:<class>


Table 7-2. How to understand the components of a message's signature

Example message signature

Description

doSomething( )

The message's name is doSomething, but no further information is known about it.

doSomething(number1 : Number, number2 : Number)

The message's name is doSomething, and it takes two arguments, number1 and number2, which are both of class Number.

doSomething( ) : ReturnClass

The message's name is doSomething; it takes no arguments and returns an object of class ReturnClass.

myVar = doSomething( ) : ReturnClass

The message's name is doSomething; it takes no arguments, and it returns an object of class ReturnClass that is assigned to the myVar attribute of the message caller.


 


Nested messages:


When a message from one participant results in one or more messages being sent by the receiving participant, those resulting messages are said to be nested within the triggering message,



学习uml2(不全)part1 (也许有part2)_application_12


 


message types:



学习uml2(不全)part1 (也许有part2)_blog_13


 


sequence fragment,建模复杂结构:


更多参见


http://www.ibm.com/developerworks/rational/library/3101.html



学习uml2(不全)part1 (也许有part2)_class_14


Table 7-4. The fragment family and explanations why each type might be useful when creating sequence diagrams

Type

Parameters

Why is it useful?

ref

None

Represents an interaction that is defined elsewhere in the model. Helps you manage a large diagram by splitting, and potentially reusing, a collection of interactions. Similar to the reuse modeled when the <<include>> use case relationship is applied.

assert

None

Specifies that the interactions contained within the fragment box must occur exactly as they are indicated; otherwise the fragment is declared invalid and an exception should be raised. Works in a similar fashion to the assert statement in Java. Useful when specifying that every step in an interaction must occur successfully, i.e., when modeling a transaction.

loop

min times,


max times,


[guard_condition]

Loops through the interactions contained within the fragment a specified number of times until the guard condition is evaluated to false. Very similar to the Java and C# for(..) loop. Useful when you are trying execute a set of interactions a specific number of times.

break

None

If the interactions contained within the break fragment occur, then any enclosing interaction, most commonly a loop fragment , should be exited. Similar to the break statement in Java and C#.

alt

[guard_condition1] ...


[guard_condition2] ...


[else]

Depending on which guard condition evaluates to true first, the corresponding sub-collection of interactions will be executed. Helps you specify that a set of interactions will be executed only under certain conditions. Similar to an if(..) else statement in code.

opt

[guard_condition]

The interactions contained within this fragment will execute only if the guard condition evaluates to true. Similar to a simple if(..) statement in code with no corresponding else. Especially useful when showing steps that have been reused from another use case's sequence diagrams, where <<extend>> is the use case relationship.

neg

None

Declares that the interactions inside this fragment are not to be executed, ever. Helpful if you are just trying to mark a collection of interactions as not executed until you're sure that those interactions can be removed. Most useful if you happen to be lucky enough to be using an Executable UML tool where your sequence diagrams are actually being run. Also can be helpful to show that something cannot be done, e.g., when you want to show that a participant cannot call read( ) on a socket after close( ).Works in a similar fashion to commenting out some method calls in code.

par

None

Specifies that interactions within this fragment can happily execute in parallel. This is similar to saying that there is no need for any thread-safe locking required within a set of interactions.

region

None

Interactions within this type of fragment are said to be part of a critical region. A critical region is typically an area where a shared participant is updated. Combined with parallel interactions, specified using the par fragment type, you can model where interactions are not required to be thread- or process-safe (par fragment) and where locks are required to prevent parallel interactions interleaving (region fragment ). Has similarities synchronized blocks and object locks in Java.


UML1.X使用guard的方式:



学习uml2(不全)part1 (也许有part2)_uml_15


 


6.State Machine Diagrams


The key elements are state and transition.



学习uml2(不全)part1 (也许有part2)_uml_16


Internal Behavior of states:


Entry behavior happens as soon as the state becomes active and is written as entry/behavior. Exit behavior happens immediately before the state becomes inactive and is written as exit/behavior. do behavior, which is behavior that is ongoing while the state is active.



学习uml2(不全)part1 (也许有part2)_application_17

 


internal transition: a transition that causes a reaction within a state, but doesn't cause the object to change states. An internal transition is different from a self transition because self transitions cause entry and exit behavior to occur whereas internal transitions don't.


Internal transitions are written as trigger [guard] / behavior, and they are listed inside a state.



学习uml2(不全)part1 (也许有part2)_class_18


singles:


The main purpose of the diagram bellow is to visually emphasize sending and receiving signals. Although both diagrams say the same thing, the version with the signal icons focuses on the transitions and, in this case, makes the diagram more readable.



学习uml2(不全)part1 (也许有part2)_class_19


标签:account,author,Administrator,blog,part1,part2,details,uml2,new
From: https://blog.51cto.com/u_11326739/6787362

相关文章

  • 函数式编程part2-Lambda表达式
    2.1概述Lambda是JDK8中一个语法糖。他可以对某些匿名内部类的写法进行简化。它是函数式编程思想的一个重要体现。让我们不用关注是什么对象。而是更关注我们对数据进行了什么操作。2.2核心原则可推导可省略2.3基本格式(参数列表)->{代码}......
  • 函数式编程-part1概述和理解
    为什么学?能够看懂公司里的代码大数量下处理集合效率高,因为有并行流,而自己创建处理会有很多问题代码可读性高消灭嵌套地狱本系列将从Lambda表达式、Stream流、Optional、函数式接口、方法引用等顺序开始讲解//查询未成年作家的评分在70以上的书籍由于洋流影响所......
  • 代码随想录算法训练营第57天 | ● 647. 回文子串 ● 516.最长回文子序列 ● 动
     第九章 动态规划part17●  647. 回文子串  ●  516.最长回文子序列●  动态规划总结篇 今天 我们就要结束动态规划章节了,大家激不激动!!!   详细布置   647. 回文子串    动态规划解决的经典题目,如果没接触过的话,别硬想 直接看题解。https:......
  • 多线程part2-多线程的两个概念
    并发同一时刻,有多个指令在单个CPU上交替执行理解:打游戏的时候,右手操作鼠标,同时用右手喝可乐,手速特别快交替执行,这时,你的右手相当于CPU,执行的对象相当于线程并行同一时刻,有多个指令在多个CPU上同时执行理解:关键点在于同时 ......
  • 算法学习day57动态规划part17-516、647
    packageLeetCode.DPpart17;/***516.最长回文子序列*给你一个字符串s,找出其中最长的回文子序列,并返回该序列的长度。*子序列定义为:不改变剩余字符顺序的情况下,删除某些字符或者不删除任何字符形成的一个序列。**/publicclassLongestPalindromicSubsequence_51......
  • 算法学习day55动态规划part15-115、392
    packageLeetCode.DPpart15;publicclassDistinctSubsequences_115{publicintnumDistinct(Strings,Stringt){int[][]dp=newint[s.length()+1][t.length()+1];for(inti=0;i<s.length()+1;i++){dp[i][0]=......
  • 算法学习day56动态规划part16-583、72
    packageLeetCode.DPpart16;/***583.两个字符串的删除操作*给定两个单词word1和word2,返回使得word1和word2相同所需的最小步数。*每步可以删除任意一个字符串中的一个字符。**/publicclassDeleteOperationforTwoStrings_583{publicintminDist......
  • 算法学习day52动态规划part13-674、300、718
    packageLeetCode.DPpart13;/***674.最长连续递增序列*给定一个未经排序的整数数组,找到最长且连续递增的子序列,并返回该序列的长度。*连续递增的子序列可以由两个下标l和r(l<r)确定,*如果对于每个l<=i<r,都有nums[i]<nums[i+1],*那么子序列[nums[......
  • 算法学习day53动态规划part14-1143、53、1035
    packageLeetCode.DPpart14;/***1143.最长公共子序列*给定两个字符串text1和text2,返回这两个字符串的最长公共子序列的长度。*如果不存在公共子序列,返回0。*一个字符串的子序列是指这样一个新的字符串:它是由原字符串在不改变字符的相对顺序的情况下删除某些......
  • 算法学习day50动态规划part11-123、188
    packageLeetCode.DPpart11;/***123.买卖股票的最佳时机III*给定一个数组,它的第i个元素是一支给定的股票在第i天的价格.*设计一个算法来计算你所能获取的最大利润。你最多可以完成两笔交易。*注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。......