uml diagrams for website development

2022.03.17

one、foreword

Talking about Analysis and Design of Object-Oriented Technology,Naturally inseparable UML。for UML the concept,Many programmer friends are familiar with,also in use,but at work,Some friends are actually not good at using UML even right UML This thing is ambiguous,including myself。So I hope to combine my own experience and practice,write a UML introductory article,Helping programmers who are object-oriented can make better use of it,So that you can successfully complete your programming design work。

(uml diagrams for website development)The following is the outline of this article。

(uml diagrams for website development)

uml diagrams for website development


two、start with an example

(uml diagrams for website development)Let's take a real world example。when we were in college,as a student,Everyone has a student card,will belong to a class,May use bicycles for school。Many students also take the driver's license test,Pick a vacation time to practice driving,The car could be a sedan or a pickup。

(uml diagrams for website development)If you want to record the above information and behavior online,How to express it in the software world?

I believe that the operation of many friends is,Find the subject and object of this passage,also found the roles involved in this example,Then use verbs to judge the relationship and ability of each role,Finally, express it in code,produce executable program。

like the picture below,Identify key entities and their relationships。


uml diagrams for website development


in software engineering,Solve real problems,It is the most obvious characteristic of the information age,It makes our life and work more convenient。

But the real world is complicated,flexible,Everyone's understanding may be different,Mapping from the real world to the software world,becomes difficult,a mess。

(uml diagrams for website development)How to Make Mapping the Real World to the Software World Simple and Easy,This is UML problem to be solved。

three、what is UML?

UML full name is Unified Modeling Language(Unified Modeling Language),it starts withGraphical wayto describe the concept of software。

3.1 Why is it called a language

language first,Why is it called a language?

The foothold of the name is the language。since language,then it willlanguage-specific,For example, structurally it consists of vocabulary and grammar,Functionally, it can solve communication problems。

(uml diagrams for website development)Most of the languages you are familiar with should be Chinese and English,If you are in the software industry,C language and Java You should not be unfamiliar with the language。English and Java language is obviously language,are often not discussed together,why?Because they are languages of different dimensions。English isSolve real-world human-to-human communication problemshuman language,Java YesSolve the problem of communication between programmers and computers in the software worldcomputer language。

Human language is essentiallyExpression of facts and opinions,Computer languages are essentially0 and 1 expression。The form of expression of the former is difficult to determine,and there may be ambiguity,So there will be「To be misunderstood is the fate of the expressor」such a view, But the latter is deterministic and unambiguous 0 1 Express。

So it seems,UML the goal isexpression through a certain structure,To solve the communication problem from the real world to the software world

3.2 what is modeling

Let's talk modeling,what is the mold,how to build?

Modeling in a nutshell,Refers toSolve a problem in an abstract way。The various abstract perspectives together form a problem domain。


uml diagrams for website development(uml diagrams for website development)


(uml diagrams for website development)For traditional models,It was built to prove that something would work in this problem domain。Of course it has premise,That is, the cost of building the model is much lower than the cost of building the real object。such as building airplanes or building high-rise buildings。

(uml diagrams for website development)For software models,Built to communicate with others,Also to preserve the final result of software design in this problem domain。Of course it also has a premise,It is the model that explains the problem more than the code。

such as shopping,A can buy clothes on Taobao,B can buy books on Amazon,C can buy mobile phones on Jingdong。

who buys?is a、B and C,They can abstract adults。

buy something?have clothes、Books and Cell Phones,they can be abstracted。

where to buy?on Taobao,Amazon and JD.com,They can be abstracted into fields。

The overall abstraction is that people come to the scene to buy goods。Therefore, the people and goods yard abstracted from the shopping scene,to solve problems in retail。Of course there may be some rules,For example, you can only trade by becoming a registered member。

we will find,a specific event(such as shopping)inside,certain people's behavior(For example, A, B and C need to go to the e-commerce website),there will be a specific(such as goods),have specific rules(such as registered members),complete the shopping together。

a specific thing = behavior of a particular person + specific thing + specific rules

In the abstract perspective of the people and goods yard,many specific things,including membership registration,Member place an order,Member pays,Merchant Ships,courier, etc.。


uml diagrams for website development


simply speaking,that ispeople、thing、things and rules

man is the center of everything,people do things,To do things use some things and produce others,At the same time, you need to follow certain rules。

human-driven system,process of event,record results,rules are control

The key to building a model isfigure out who,who does what,what produces what,What are the rules in the middle,Put people again、Thing、The relationship between things is defined,A model is basically formed.。

3.3 Where is the meaning of unified?

(uml diagrams for website development)Uniform universal meaning isFormation standard。Standard,that isEveryone understands the expression,All people comply with the format。Standard canLet information circulate in the crowd,Even this information comes from different regions、Different cultures、Different societies or different organizations。

For example, the US dollar is used as an internationally used currency to facilitate global economic trade.,Our country's popular Mandarin is convenient for communication communication in different regions.。

In the software world,There is a standard and guidance behind any component development model.,for example Java of JSR standard。Standard,Programming is easy to assemble,Collaboration efficiency will also increase a lot。right UML Convinced,This is the meaning of unified。

Four、Why do you need? UML

A software project must experienceBusiness research、Stand、Demand collection、Architecture design、Coding development and test verificationMultiple links。

Each link may be different in terms of role,The same words, the same words, the longer the post, the easier distortion。Therefore, it is easy to have finally delivered products that are not what customers really want.。

How to avoid the distortion of the information transfer between the role,Guarantee information can be accurately conveyed and accurate?A good way isEveryone uses a standardized language。

Unified modeling language(UML)Try to cover the entire software with a standardized language,Let different characters of different teams can communicate smoothly with the same language。

In terms of information communication,Graphic relative to text,The accepted ability of the human brain is obviously stronger。therefore,UML Adopted「Visualize」Graphical way to define language。

Fives、UML Applicable scene

UML Cannot describe a certain field,Can also express software design in the concept,You can also describe the completed software implementation。

It applies to the entire process of object-oriented analysis design。This process can be divided into three stages,As shown below。


uml diagrams for website development


The first stage isTransfer real world to business model by modeling。Business model real mapped participants(Business activity driver)Behavior in the real world。


uml diagrams for website development


See,Real world mapping to business model,Use Participant and Example These two UML Core element expression。Participants act as drivers for a specific event,The use case describes the service target of this drive.。These two elements will also be mentioned behind the article.。

The second stage isConceptualization to business model,Establish models suitable for computer understanding and implementation,That is the concept model,Or analyze model。Analysis modelThe original demand is introduced upwards.,downRealization of a high-level abstraction for your computer,Is a transition model。


uml diagrams for website development(uml diagrams for website development)


Realistic world is very different,Use boundary、Describe the core elements of control and entities,At the same time, it is also introduced. Bag、Assembly These concepts with real world do not coherence make packaging。

The third stage isInstallation of concept model,Get a relatively detailed design model。


uml diagrams for website development(uml diagrams for website development)


In the design model,The boundary class in the conceptual model can be converted to an operation interface or system interface;Control class can be converted to a compute program or control program,For example, workflow、Algorithm, etc.;The physical class can be converted to a database table、XML Documents or other classes with persistence characteristics。

The same concept model will be different design models due to different selection。For example, using different programming languages,Different middleware will get different design。

(uml diagrams for website development)Why do I need this conversion??

because“boundary”、“control”、“entity”Concept of these objectization,Although it is a computer understandable,But it is not a real object instance,That is to say they are not executable.,Concept model is just paper talks。Real object world behavior is Java kind、C++ kind、JSP These executable code consists of。

in other words,Design model is an instantiation of conceptual model under specific environments and conditions,Instantiated object behavior implements the information described in the concept model。

(uml diagrams for website development)The following is a complete process of object-oriented analysis design,It expresses how the real world passes UML Map to the object of the object。


uml diagrams for website development


six、UML Composition structure

It took a relatively large space analysis in front. UML Positioning and applicable scene,The purpose is to help readers build UML Overall systemic cognition,Not too early falling UML Use detail。We want to apply a technology or tool,Can't just because it's cool or said that the industry is in use, so we want to use,It should be combined with your own use scenarios and features of technology or tools.,To confirm that this technology or tool is not what we need.。

Learn from the reader UML After the excellent characteristics of object-oriented design,Let's take a look UML Some details。

Everything is language,Basic vocabulary and grammar。

(uml diagrams for website development)So corresponding to UML inside,Basic words are core elements,Grammar is the core view。

UML The composition structure is as follows:


uml diagrams for website development


6.1 Core element

Let's introduce the core elements first.,The following figure is the outline。

(uml diagrams for website development)

uml diagrams for website development


6.1.1 Version

(uml diagrams for website development)Version:Also known as「Types of」or「Constructor」。is true UML Expansion of elemental definition,Give special meanings on the basis of elemental definitions,Make this element to specific occasions。

for example,We mentioned before「Border class」、「Entity class」、「Control class」Both are class version。

6.1.2 Participant

(uml diagrams for website development)

uml diagrams for website development


Participant positioning:First driver of an event,Also the server of the system。For example, you are shopping in e-commerce website,You are participants。

6.1.3 Example


uml diagrams for website development


Use case positioning:A series of operations performed by the system,And generate the value of the participant can observe。For example, you traded in e-commerce website,Will generate online orders,User place is a use case。

(uml diagrams for website development)Use case version:


uml diagrams for website development


  • Business case:Modeling in business areas in demand。None related to computer system,For example, the order can not rely on online services,And just offline signing agreements。The goal of business modeling is to let demand staff and customers reach consensus。
  • Business use case implementation:A implementation of business use cases,A business use can have a variety of implementations。Such as payment,Cash,Can also transfer bank card transfer,You can also pay a third party。


uml diagrams for website development


  • Conceptual case:Key concepts used to get business models,Analyze the core business structure。Business architecture is the concept of concept moderation,At the same time, provide important guidance for the system modeling phase.。For example, the user orders this use case,Can get some core services from the implementation process,And show them。


uml diagrams for website development


  • System usage case:Used to define system ranges、Get functional needs。That is, we often hang the use case of the mouth.。Way to sign a contract in the line mentioned in business case,Will not be included in the system use case,But if it is an electronic signing,You can become a system use case.。
  • System use case implementation:An implementation of system use case,A system use can have a variety of implementations。Such as payment,Can be connected to WeChat payment interface,You can also access Alipay payment interface。

You will find,as wellUsed version,The difference between business use cases and system use isBusiness use case is a customer service perspective,System use case is the system perspective。

6.1.4 boundary


uml diagrams for website development


Border positioning:Analysis of business modeling and system modeling stages,guaranteeAnalytical particle size is within a certain range,Will not spread。

For example, an e-commerce website as a border according to the domain responsibilities,There will be stores、Commodity domain、Member domain、Trading domain、Payment domain and marketing domain, etc.。All domains are only responsible for things within the domain,It is possible to reduce the situation of chaotic coupling.。

A good analysis and design like a basket of shells,Clear and cool;A poor design is like a pile of chopped eggs,Stick-stick。shell,Is a good key。

6.1.5 Business entity


uml diagrams for website development(uml diagrams for website development)


Business entity positioning:It representsThings handled or used by participants to perform business cases,ParticularlyBusiness modeling phaseEstablish a domain model。Business entity is class(class)A version of。

Business entity structure:Contains properties and methods。Property is used to save business entity features,Method for accessing business entities。Such as a TV,Watch it as a business entity,Its attribute has operational status and volume,Its method is the remote control,We can open、close、Tune sound,But we can't try to let it fly.——Because it doesn't have this method。

6.1.6 Bag


uml diagrams for website development


(uml diagrams for website development)Packet positioning:Accommodate and UML Element classification。for example Java The backend often provides jar Package to the access party。

6.1.7 Analyze


uml diagrams for website development


Analysis class positioning:Used to represent the main responsibility cluster in the system,This generates the design class and subsystem of the system。

  • Border class:UsefulInteraction between system external environment and internal operationsModel。For example, the window of the real world,Computer world web page。
  • Control class:UsefulControl behavior for use caseModel。For example, display logic and business logic are separated by control layer MVC Architecture。
  • Entity class:UsefulInformation and related behaviors that need to be storedModel。Source from the business modelBusiness entity

The abstract level of the analysis is higher,More stable than design and implementation,Therefore, convenient maintenance,It is also easier to get a stable architecture to guide the development of the entire software.。

6.1.8 Design


uml diagrams for website development


Design class positioning:Is an abstraction of one or more objects in the system implementation,thusMap to implement code,Depending on the language。

(uml diagrams for website development)Design class structure

  • Types of:Incident and abstraction of the characteristics of an object。Map to the encoding class。
  • Attributes:Object characteristics。Map to the encoding field。
  • method:The only way to access object properties。Map to the encoding method。

6.1.9 relation


uml diagrams for website development


Relationship positioning:AbstractContact between objects,Let the object constitute a particular structure。

Relationship is divided into the following:

  • Association(association)
  • relation:A kind ofhaveRelationship,That is, a class knows the properties and methods of another class;For example, teachers and students can be two-way,Can also be one-way。Two-way associations can have two arrows or no arrows,One-way association has an arrow。
  • Arrows and connecting:Solid line with ordinary arrows,Point to the owner。
  • Applicable scene:Class Diagram。
  • rely(dependency)
  • relation:A kind ofuseRelationship,That is, the implementation of a class requires another class assistance.,Is a weak relationship,Frequency scene change。For example, when apple,People depend on the knife,I get away from this scene,Dependent relationships do not exist。
  • Arrows and connecting:Dotted line with arrow,Pointing。
  • Applicable scene:Class Diagram。
  • Generalization(generalization)
  • relation:A kind ofinheritRelationship,For example, a cat is a kind of animal。
  • Arrows and connecting:Solid line with triangle,Arrow points to the parent class。
  • Applicable scene:Class Diagram。
  • accomplish(realization)
  • relation:A kind ofaccomplishRelationship,Such as the relationship between use case and use case implementation,Interface and implementation of the relationship。
  • Arrows and connecting:Triangular dashed line,Arrow points to use case implementation or interface class。
  • Applicable scene:Use case,Class Diagram。
  • polymerization(aggregation)
  • relation:YesOverall and partRelationship,andPart can leave the whole and exist alone。Life cycle is independent。Such as cars and tires are polymerization relationships,Tires can still exist。
  • Arrows and connecting:Solid line with hollow rhombus,Rhombus points to the whole。
  • Applicable scene:Class Diagram。
  • combination(composition)
  • relation:YesOverall and partRelationship,butPart cannot leave the overall and exist alone。Tong live。Such as companies and departments are combined relationships,No company does not exist。
  • Arrows and connecting:Unhearer(Black-hearted:To die together,Conscience is black)Rings,Rhombus points to the whole。
  • Applicable scene:Class Diagram。

Differences between related relationships and dependencies

  • Association relationship is a static natural connection,Relational relationship is a temporary connection。

In addition, there is only the relationship used in the case.:


uml diagrams for website development


  • Expand(extends)
  • relation:Used in use case modelInsert an extension of an extension point in a basic use case。
  • Arrows and connecting:Dotted plus version with arrow<<extends>>。
  • Characteristics:Use case optional。
  • Include(include)
  • relation:Used in a model modelExplain the behavior of the insertion in the use case example of performing basic use cases。
  • Arrows and connecting:Dotted plus version with arrow<<include>>。
  • Characteristics:Use case required。

6.1.10 Assembly


uml diagrams for website development(uml diagrams for website development)


Component positioning:Logical code module for achieving specific functions。Such as distributed application architecture,Remove business target into multiple functions,Each function is deployed as a component。These components can also be represented by other scenes。

6.1.11 node


uml diagrams for website development


Node positioning:Represents deployment unit。For example, in the environment of distributed applications,There are a lot of servers or equipment.,Just through the node to reflect the physical deployment。

6.2 Core view

Let's introduce it to UML Core element,These elements are applied to various stages of facing object analysis design, respectively.,It is the mutual combination between them,Before it is formed UML Various views,Final guidance software design。

Next, the structure view and behavior view of the core view,The following figure is the outline。


uml diagrams for website development


6.2.1 Architectural view

Structure view is also knownStatic view。Static view isStatic thingof。It only describesStatic structure of things,Do not describe its dynamic behavior。The static view of this brief introduction here includesUse case,Object map,Class Diagram,Component map,Bag map and deployment diagram

6.2.1.1 Use case

Modal exampleParticipant、Use cases and relationshipsThese three core elements,Different perspectives can get different examples of examples,It shows the functional needs of the system。

Different perspectives,It can correspond to three phases of object-oriented analysis design.。

  • Establish a business model stage,outputBusiness case
  • Establish a conceptual stage,outputConcept illustration
  • Establish design model stage,outputDescription of the system
(uml diagrams for website development)In the case of the use of books,Business case is as follows,It is completely from the perspective of business,Not related to computer system。


uml diagrams for website development


And we have analyzed in business use cases,Can decompose some key conceptual cases,And establish the relationship between them,As shown below(bu Business use case,cu Conceptual case)。


uml diagrams for website development


We have analyzed business use cases,Draw the system example。But not all business use cases have system usage,For example, check the loan certificate may be manual work.,Do not need to be included in the scope of system construction。

The following figure is a case where the system is borrowed.。


uml diagrams for website development


6.2.1.2 Class Diagram

Class diagram forDisplay the relationship between the class and its mutual relationship。

The way the class map model is used is fromConceptual layer,To the explanatory layer,Finally, the realization layerThe process of such an abstract level gradually reduces and refine。

Concept layer class diagram is located in the business modeling phase,This stage is adoptedBusiness entityThis core element is expressed。

The picture below is a business entity map of online shopping.。


uml diagrams for website development


Online shopping mainly、Order、Pay your account for these key classes,These interactions of these classes can complete the online shopping business objectives。

(uml diagrams for website development)Description layer class diagram is located in the conceptual modeling phase,This stage is adoptedAnalyzeThis core element is expressed。

The following figure shows the explanatory layer diagram of online shopping,This class diagram expresses the perspective of the computer.,This business goal is done by this business goal?,The interfaces of these classes ensure the achievement of this business goal.。


uml diagrams for website development


Implementation class diagram is located in the design modeling stage,This stage is adoptedDesignThis core element is expressed。

At this layer,Class diagram can be regarded as pseudo code,therefore,At this level,Category must explicitly use which implementation language、What design pattern、What communication standard、What specification is followed?。

The figure below shows the class diagram of the query product function.。can be seen,Realization layer class diagram,Class descriptions and class relationships are already pseudo code levels.。


uml diagrams for website development


This is visible,At different stages of the software life cycle,Three different expressions,They areConcept layer class diagram,Explanation of layer diagrams and implementation layers

(uml diagrams for website development)Many friends will only use the realization layer diagram when modeling.,Not they understand the problem area,Instead, it is not clear that there are such three floors.。

6.2.1.3 Object map

(uml diagrams for website development)Object diagram is an instance of class diagrams,The identification and class chart basically。Since there is a life cycle,Object map can only exist at a time period of the system,So the object map can be imagined to be running a snapshot of a certain moment。

For example, a running train,If you use object maps,At some point in time, you will find the following static pictures.:

  • Current operating status(Operation or parking)
  • Current number of passengers。(If you capture at different times,This value changes)


uml diagrams for website development


6.2.1.4 Packet diagram

In the actual project,Elements obtained by modeling processes may be very much,If the relationship between these elements is drawn,It will be particularly chaotic,Especially complex,It is also difficult to identify。

(uml diagrams for website development)That is to better understand and manage these modeling elements,We needOrganizing elements。The package chart has played such a role.,By package this container,CanFrom big to small、Organize modeling elements from coarse to fine,Convenientanalyze,Communication and refinement

The picture below is the area of online shopping.,It expresses the key business sector and its dependencies。


uml diagrams for website development


The following figure shows the class level of the query product feature,It expresses the viewpoint of implementing which level of software architecture。


uml diagrams for website development(uml diagrams for website development)


6.2.1.5 Component map

When some packages canRepeatedly used by multiple scenes,The package can think that there is a specific function,Ability to complete specific goals。

In this situation,Package can be defined as components,Component is a special package,It does not only have the role of ordinary bag organization and accommodation,Also complete specific features

Such as module(Login module),Library library(Java Guava Bag)。

The following figure can express the process of component implementation,Various packages produced by third-party software or object-oriented analysis design,Can define components。

(uml diagrams for website development)

uml diagrams for website development


Components can be divided into the following categories:Module、Subsystem、Library、Executive files and packages, etc.。


uml diagrams for website development


6.2.1.6 Deployment diagram

Deployment diagram depictsPhysical system running structure,Including the systemHardware distribution and specific way software deployed to hardware

Deployment mapDesign modeling stage,useNode and relationshipTwo core elements to draw。Commonly used in distributed applications and multi-equipment applications。


uml diagrams for website development


(uml diagrams for website development)The above figure is a simple deployment map,Expressed clients such as browser nodes,Will ask Web Server node,Finally, return data through the database server node。If involving a distributed environment,Will consider multiple Web Server,Multiple Database Server,Even considering multi-machine room,Deployment of physical levels such as different places。

6.2.2 Behavior view

Structure view,Let's talk about behavioral views。

Behavioral view is also calledDynamic view。Dynamic view is descriptionThings dynamic behaviorof。Dynamic view cannot be independent,It mustBased on a static view or UML element,Descriptions of things specified in static viewsDynamic behavior。

Dynamic views herein include state diagrams、Activity map、Timing diagram and collaboration map。

6.2.2.1 State diagram

State diagramState machine,itDescribes a life cycle of an object,You can understand it into a running machine,This machineResponsible for this object in fixed several states。

This object can beBusiness entity object,can also beAnalysis class object,OptionalDesign class object。Means of,Object-oriented analysis designthree phases(Business modeling,Concept model,Design modeling),Can express in the state diagram。

The picture below is a life cycle of a product.。Green part is a state diagram related element,The red part is an explanation of an element。


uml diagrams for website development


(uml diagrams for website development)In the figure,We can see that,Status graph has the following key elements:

  1. Initial state:It is a state machinestarting point,No need to trigger。Solid circle。
  2. condition:State is objectConditions when performing a certain event or waiting for an event。For example, want to perform product storage actions,The product has to be a lack of storage,If you want to sell a product,The product has to be in the storage state。
  3. Transfer:TransferThe relationship between the two states,It indicates that when the specified event occurs and meets the specified condition,Objects in the first state will perform some operations and enter the second state。For example, the product is entered into the work,In the case where the product's status has never been entered into the library。
  4. event:Event is aSpecific action or behavior,Sometimes including timers such as system clock。If the condition is satisfied,The incident will trigger a transfer。For example, the product sells this action,Departure products from the stored state to the sales state。
  5. condition:Condition is oneBoolean expression,The value of this expression will be checked when the event occurs.。Condition evaluation results may determine the branch of the transfer,Or refuse to transfer。Conditions may reference the current state。For example, the product is unqualified this Boolean judgment,Determined the product is available,Still not being sold。
  6. Final state:Final state representationState machine execution end,Or end the object life cycle。Expressed with a rings。

6.2.2.2 Activity map

The activity map describesComplete the activity that needs to be doneAnd theseEvent execution order

UML There are two levels of activity maps,One isUse an example activity diagram,It is used to describeUse case scene,Commonly used in business modeling stages,Another kindObject map,DescriptionObject interaction,Commonly used in design modeling stages。

The picture below is a use case activity map for boarding procedures.。Green part is an active diagram related element,The red part is an explanation of an element。


uml diagrams for website development


In the figure,We can see that,The activity map has the following key elements:

  • Starting point:Starting pointMark the beginning of business processes。One activity map has only one。Solid circle。
  • Activity:Activity is one of the business processesExecution unit。For example, check-in and the actions like tickets and ID cards are needed.。
  • judge:judgeDecision according to a certain condition,Perform different process branches。For example, the identity check determines whether you can continue to check the check-in。
  • Basic stream:Basic streammain、Commonly used、Default business process branch。For example, the normal branch of the identity check。
  • tributary:The tributary is entered after judgingBusiness process branch。Such as no baggage branch in the figure。
  • Abnormal flow:Abnormal flowabnormal、Not business goals are looking forward to、Faulty、Handling accidentBusiness process branch。For example, the ID card is wrong。
  • Synchronize:SynchronizeSynchronous start and synchronization
  • Synchronous start representation from itStart multiple tributing parallel。Such as checked luggage processing and boarding operations,In parallel。
  • Synchronous convergenceMultiple tributation is reached at the same time after reaching the follow-up activity
  • End point:End pointThe termination of business processes。one or more。
(uml diagrams for website development)Use an example activity diagram is often from the perspective of business,Analysis to complete a goal,What activities to do。If you are in the corner of the system design,To express the activities required to complete the goals,Just use the object activity map。

For example, based on the object interaction process of the query product,The following object map can be drawn。

(uml diagrams for website development)

uml diagrams for website development


(uml diagrams for website development)although UML Allows the interaction of an active drawing,But actual work,I have never used it.。because UML Have other better tools to draw object interactions,For example, the timing chart of next to the next。

6.2.2.3 Timing chart

Timing diagram for descriptionInteractive mode between the time order arrangement

The front class map has three levels of views:Conceptual layer、Explanation layer and realization,Sub-objective analysis design, respectivelyBusiness modeling phase、Conceptual modeling stage and design modeling stage,corresponding,You can also be pair at these three levels.Business entity object、Analysis class objects and design class objectsDrawBusiness model timing chart、Concept model timing chart and design model timing chart


uml diagrams for website development


Next, introduce three timing charts。

Business model timing chart forBusiness entity interactive modeling in the field model,GoalImplement business case

The activity map mentioned in the previous section,Can help us find business entities,The activity map can also be easily converted into time chart,The following figure is a time-sequence diagram of the business model of purchasing goods online。

(uml diagrams for website development)

uml diagrams for website development(uml diagrams for website development)


Some of the timing charts UML element,Several commonly used:

  • Object:ExpressParticipate in interactive objects。Each object has a life cycle line,When the object is activated,A strip will appear on the life cycle line(Session),Obstitute。
  • Life cycle line:ExpressObject of the object。When the object is activated,Session on the life cycle line,Represents an object to participate in this session。
  • information:ExpressAction taken by inter-object interaction。Life cycle line from an object to another object。Common news types have the following:
  • Simple message:To the right solid arrow,This most commonly used。
  • Return message:Source message returns,Not new news。Use the left one-way dashed arrow。Need not need to draw a return message for each source message,On the one hand, the source is returned by default.,On the other hand, excessive return messages will make the chart more complex.。
  • Synchronous message:ExpressObjects that make messages will stop all follow-up actions,Always wait until the message party response。Right×One-way solid line arrow。Synchronization messages will block all behaviors。The method call between usually programs is synchronized。
  • Asynchronous message:I don't wait for a response after the source message issues a message.,Can you continue to do other operations。Expressed with the right one-way arrow。Asynchronous news generally requires support of the message middleware,Such as MQ Wait。
  • Session:ExpressInteractive,During the sessionAll objects share a context environment。For example, operational context。
  • destroy:ExpressThe termination of the life cycle。Draw at the end of the life cycle line,Never necessary to emphasize。
(uml diagrams for website development)Business model timing chart isProducts in the business modeling stage,It shows the actual needs of the business,UsageDescription Language should adopt business terms

Enter the conceptual mode of development,Can be usedAnalysis class drawing concept model timing chart。Compared with the business model timing chart,It is also to show business needs,Different pointsAnalysis class represents the system prototype,Therefore, the timing chart of this stage has already understood the computer level.。

therefore,Concept model timing chartNot both actual business needs,Have beenBasic concept of computer implementation。As shown below。

(uml diagrams for website development)

uml diagrams for website development


can be seen,In conceptual model,Sequence diagram relative to business model,Our expression adds secure authentication and commodity catalog。This is because we are actually doing the function of logging in.,Our software system needs to pay attention to identity。When we get goods,In order to avoid misconduct。

in addition,Our business entities are turned to analyze and express,Website as a border class,Isolation user operation and system behavior。Safety certification as a control class,Used to determine if it can successfully log in。Commodity catalog and goods as entity classes,Entity information for expressing users actually want to see or operate。

The analysis class is already the prototype of the system.,Enter the design modeling phase,What we do is to doSelect the right implementation to implement this prototype

Design modeling stage,We use design model timing chart to implement interaction in the conceptual model。

(uml diagrams for website development)Design model timing diagram uses design class as an object to draw,It is also the most commonly used dynamic view in our daily development and design.。Here are the design model of the commodity query。

(uml diagrams for website development)

uml diagrams for website development


can be seen,In design model timing diagram,The news will be meticulous to the method level。Because at this stage,Related technology selection,Such as programming language,Interactive agreement,Middleware, etc. have been more clear。

Timing diagram except for three stages of modeling,When you needExpressive interaction,Or thinkAnalyze the responsibilities and interfaces of the objectTime,Optional chart。

6.2.2.4 Collaboration map

(uml diagrams for website development)Collaborative drawings and timing charts,Also describing interactive mode between objects,the difference is,The timing map isObject interaction execution order,And the cooperation map isStructure relationship between objects。

therefore,Timing diagramGet an understanding of the calling process,And the collaborative map is suitableGet an understanding of the object structure。

(uml diagrams for website development)Collaboration maps can be converted to each other with timing charts,Three ways to correspond to the timing chart,Collaborative map is also divided intoBusiness model collaboration mapConcept model collaboration mapandDesign model timing chart。This article only introduces business model collaboration maps,The other two collaboration can be derived from the corresponding timing chart,Here is not described here.。

Business model collaboration map also uses business entities to draw,Target is also an active example scene。The picture below is a business model of online purchase of goods.。

(uml diagrams for website development)

uml diagrams for website development


(uml diagrams for website development)can be seen,Collaborative map and timing chart,The structure between the objects is natural,Very easyDo you know which objects affect which objects or which objects need to provide。But in the order of execution is very weak.,Must rely on the number of message text。

(uml diagrams for website development)The following is commonly used in collaborative graphics UML element:

  • Object:ExpressParticipate in collaborative objects
  • Object association:UsefulConnect two objects,Represents the association of both。This association is temporary,It is only effective in this interaction。
  • information:Consistent with the message definition in timing chart。
  • Message serial number:showSuccessful order of messaging

6.2.3 summary

This section introduced UML Core view,Let's look at the outline of the core view。

(uml diagrams for website development)

uml diagrams for website development(uml diagrams for website development)


Core view static view and dynamic view。Static viewExpressive structural views,Dynamic viewExpressive behavioral view

A good modeling,Structural and behaviorality is indispensable,Negative explanationWhat is the top grow?,Also explainWhat should this matter?

seven、Summarize

(uml diagrams for website development)This article starts from one example,introduced UML the concept of,introducedwhat is UML,Why use UMLAnd when UML。We understand one thing,I know that I have to know it.

Then introduced UML Composition structure,From the perspective of elements and views,Explain how to draw graphics and related concepts。There are also many ways to draw the samples in the article.,If there is a mistake,Also think about readers。

The paper is getting angry,Perceive this matter。Know and do always have a distance,In practice。

I hope this article can be inspired by the readers who engage in objects.,Welcome to communicate with me,Also welcomeForwardTo a friend in need。

(over)

返回列表
更多新闻资讯