UML Sequence diagram is important for Salesforce Integration with third party system. It will give step by step execution of complete integration based on activity time. Let us see UML diagram concept in detail.
UML (Unified Modelling Language) is standard modelling language for designing and documenting a system in an object oriented manner. Modelling is about creating some model or some software product. So basically, UML will help us in designing software application. UML will help developer in writing proper code for application based on design.
UML diagram should be created once requirement phase is completed or some time it is also created in requirement phase.
UML Diagram Types:
UML diagram are divided in below two categories based on type of information need to show.
- Structural Diagram
- Behavioral Diagram
1. Structural Diagram
UML Structural diagrams depict the static elements of a system that are independent of time. These static elements forms the main structure and those are stable. Below are types of structural UML diagram
- Class Diagram
- Object Diagram
- Component Diagram
- Composite Structure Diagram
- Deployment Diagram
- Package Diagram
- Profile Diagram
2. Behavioral Diagram
UML Behavioral Diagrams depict the elements of a system that are dependent on time and dynamic concepts of the system and it also manage how they relate to each other
- Activity Diagrams
- Use Case Diagrams
- StateMachine Diagrams
- Timing Diagrams
- Sequence Diagrams
- Communication Diagrams
- Interaction Overview Diagrams
UML Diagram based on SDLC Cycle
All UML diagram are not required in each phase of project. Based on project requirement it is created.
In this phase use case diagram is required. If use cases are being complicated then we can create activity diagram.
Other than use case and activity diagram, we can create in this phase. Again it is not necessary to create each diagram for smaller project. Based on requirement only create UML diagrams.
Whatever we have created in design phase we can use in development phase.
UML diagram which we have created and requirement and design phase are required in this phase as we need to test complete system.
UML Sequence Diagram:
A sequence diagram is a type of interaction diagram because it describes how—and in what order—a group of objects works together. Sequence diagram shows interactions between objects over a specific period of time.
Sequence diagram is used to visualize the sequence of calls in a system to perform specific functionality. These diagrams are used by software developers and business professionals to understand requirements for a new system or to document an existing process.
Benefit of Sequence diagram:
Below are benefits of sequence diagram
- Represent the details of a UML use case.
- Model the logic of a procedure, function, or operation.
- Show how objects and components interact with each other to complete a process.
- Plan and understand the detailed functionality of an existing or future scenario.
Sequence Diagram Symbols/Notations:
- An actor in a UML diagram represents a type of role where it interacts with the system and its objects.
- We use actors to depict various roles including human users and other external subjects.
- We represent an actor in a UML diagram using a stick person notation.
- We can have multiple actors in a sequence diagram.
2. Activation Box:
Activation box represents the time needed for an object to complete a task. The longer the task will take, the longer the activation box becomes in UML diagram.
3. Object Symbol
Object symbol represents a class or object in UML. This object symbol demonstrates how an object will behave in the context of the system. We should not list class attributes using this shape.
- A lifeline is a named element which depicts an individual participant in a sequence diagram.
- Each instance in a sequence diagram is represented by a lifeline.
- Lifeline elements are located at the top in a sequence diagram.
- Lifeline elements are part of the system.
5. Message Elements
Communication between objects are depicted using messages. The messages appear in a sequential order on the lifeline. We represent messages using arrows. Lifelines and messages form the core of a sequence diagram.
- A synchronous message waits for a reply before the interaction can move forward.
- The sender waits until the receiver has completed the processing of the message.
- The caller continues only when it knows that the receiver has processed the previous message i.e. it receives a reply message.
- We use a solid arrow head to represent a synchronous message
- An asynchronous message does not wait for a reply from the receiver.
- The interaction moves forward irrespective of the receiver processing the previous message or not.
- We use a lined arrow head to represent an asynchronous message.
We use a Create message to instantiate a new object in the sequence diagram. It is represented with a dotted arrow and create word labelled on it to specify that it is the create Message symbol.
We can use a Delete Message to delete an object. When an object is deallocated memory or is destroyed within the system we can use the Delete Message symbol. It destroys the occurrence of the object in the system. It is represented by an arrow terminating with a x.
In certain scenarios might arise where the object needs to send a message to itself like recursive methods. Such messages are called Self Messages. Represented with a U shaped arrow.
- Reply messages are used to show the message being sent from the receiver to the sender.
- We represent a return/reply message using an open arrowhead with a dotted line.
- The interaction moves forward only when a reply message is sent by the receiver.
- A Found message is used to represent a scenario where an unknown source sends the message.
- It is represented using an arrow directed towards a lifeline from an end point.
- A Lost message is used to represent a scenario where the recipient is not known to the system.
- It is represented using an arrow directed towards an end point from a lifeline
Guards (Constraint) Message:
- To model conditions we use guards in UML.
- They are used when we need to restrict the flow of messages on the pretext of a condition being met.
- Guards play an important role in letting software developers know the constraints attached to a system or a particular process.
Sequence Diagram For REST API Integration:
Here is sequence of events when we implement Remote Call-in pattern using either REST API for notifications from external events or SOAP API to query a Salesforce object.