{"id":5547,"date":"2022-05-23T02:09:38","date_gmt":"2022-05-23T02:09:38","guid":{"rendered":"https:\/\/www.booksofall.com\/in\/?post_type=product&#038;p=5547"},"modified":"2022-06-15T05:18:59","modified_gmt":"2022-06-15T05:18:59","slug":"uml-sequence-diagrams","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/","title":{"rendered":"UML Sequence Diagrams"},"content":{"rendered":"<p><strong>UML Sequence Diagrams<\/strong><\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Sequence_diagram\">Sequence diagrams<\/a> are one of the most interesting and useful diagrams in the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Unified_Modeling_Language\">Unified Modeling Language (UML)<\/a>. They help you document and understand the dynamic aspects of your software system\u2014specifically the sequence of messages that are sent and received between objects. They can help you comprehend and solve difficult issues in the process-intensive portions of your applications.<\/p>\n<p>This third article in the series covers one of the most interesting diagrams in the UML\u2014sequence diagrams. They are most often used in the construction phase of software projects and are especially useful when analyzing the processintensive portions of your application. Sequence diagrams are closely related to collaboration diagrams (discussed in the next article in this series). While the collaboration diagram\u2019s main focus is to show how objects are associated with each other, sequence diagrams show the time ordering of messages between objects.<\/p>\n<p><strong>Why use Sequence Diagrams?<\/strong><\/p>\n<p>As mentioned in the previous article on class diagrams, unless you are using business objects in your applications, you won\u2019t have much need for sequence diagrams. This is because if you\u2019re not using business objects, most of your application logic resides inside methods of user interface objects or in functions and procedures\u2014and there really isn\u2019t much messaging that occurs between objects. However, once you decide to elevate your programming by using business objects in your applications, sequence diagrams help you answer two very important questions:<\/p>\n<p>1. Which objects should be assigned a particular responsibility?<\/p>\n<p>2. In what order should messages pass between objects?<\/p>\n<p>These questions are very difficult to answer correctly when you simply try to envision object messaging in your head. In contrast, when you document your thought process in a sequence diagram, suddenly the answers to these questions become crystal clear. At a higher level, it also helps you comprehend the overall flow of a particular process. In addition, sequence diagrams help you easily identify unnecessary messages between objects and factor them out. You may also discover that objects you originally thought should be involved in a particular process shouldn\u2019t be involved at all!<\/p>\n<p><strong>Modeling Use Cases<\/strong><\/p>\n<p>So, what kinds of things should you document in a sequence diagram? Usually, a sequence diagram is used to document the logic of a use case (for a discussion of use cases, see CoDe Magazine Issue 2 &#8211; 2001). In this article, we\u2019ll go step-bystep through the process of building a sequence diagram for a particular use case, but first, you need to learn about the different elements of sequence diagrams.<\/p>\n<p><strong>Sequence Diagram Elements<\/strong><\/p>\n<p>There are four primary elements of a sequence diagram:<\/p>\n<p>\u2022 Objects \u2022 Lifelines \u2022 Messages \u2022 Focus of control<\/p>\n<p><strong>Objects<\/strong><\/p>\n<p>Objects that are involved in the sequence of events you are documenting should be placed at the top of the sequence diagram across its horizontal axis. As shown in Figure 1, it\u2019s a good idea to place the actor that initiates a particular sequence at the upper left side of the diagram. You can also place a <a href=\"https:\/\/en.wikipedia.org\/wiki\/User_interface\">\u201cUI\u201d (user interface)<\/a> placeholder class on the diagram with which the actor interacts. This is an excellent tool for providing context for a use case. Next, you can place objects on the diagram that are instantiated by the UI (e.g., the User object) or by other objects. You should place the most important objects to the left and subordinate objects to the right. It\u2019s best to place objects on the diagram in a way that minimizes lines that cross.<\/p>\n<p><strong>Lifelines<\/strong><\/p>\n<p>The lifeline is the dotted line that extends down the vertical axis from the base of each object. The lifeline indicates the life span of an object over a period of time.<\/p>\n<p><strong>Messages<\/strong><\/p>\n<p>Messages are the most important element of a sequence diagram. They indicate when one object calls an operation on another object (or itself). They are also used to indicate return values. Message flow begins at the top left object (which is usually an actor) and flows down the vertical axis from one object to another.<\/p>\n<p>Messages are shown on UML diagrams as labeled arrows, with the arrowhead indicating the direction of the call. When a message is sent to an object, the text associated with the message specifies the name of the method that is being called on the receiving object. For example, in Figure 1, the ValidateUser() message is sent to the \u201cUser\u201d object. This indicates that the User object has a method named \u201cValidateUser.\u201d In addition, the ValidateUser() method accepts two arguments: ID and password. With most modeling tools you can optionally display the type of the arguments (e.g., boolean, currency, string).<\/p>\n<p>When a message is sent from an actor to the user interface, it does not indicate the name of a method on the UI. Rather, since the UI class is simply a placeholder, the message text is used to indicate the action that the actor performs (e.g., \u201cEnter ID and password\u201d).<\/p>\n<p>Note: When you add a message to a sequence diagram, most modeling tools automatically add a corresponding operation to the class that receives the message.<\/p>\n<p>When an object calls an operation on itself, this is known as a reflexive message or message to self. For example, in Figure 1, the UI object (though not a real object) has a reflexive \u201cDisplay error\u201d message.<\/p>\n<p>It is not necessary to document a return for every message on a sequence diagram because in the UML specification a return is implied. However, if the method is returning something of interest, it\u2019s perfectly valid to show the return value on the diagram.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe style=\"width: 100%; height: 700px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/uml-sequence-diagrams-yo0mxa4bf?enforceShowPromotionBar=true\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"featured_media":5551,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"A sequence diagram or SSD shows process interactions arranged in time sequence in the field of software engineering."},"product_brand":[],"product_cat":[213],"product_tag":[201],"class_list":{"0":"post-5547","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-computer-uml","7":"product_tag-lecture-notes","9":"first","10":"instock","11":"shipping-taxable","12":"product-type-simple"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>UML Sequence Diagrams - BooksOffAll Indian<\/title>\n<meta name=\"description\" content=\"A sequence diagram or SSD shows process interactions arranged in time sequence in the field of software engineering.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/\" \/>\n<meta property=\"og:locale\" content=\"hi_IN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UML Sequence Diagrams - BooksOffAll Indian\" \/>\n<meta property=\"og:description\" content=\"A sequence diagram or SSD shows process interactions arranged in time sequence in the field of software engineering.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOffAll Indian\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-15T05:18:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg\" \/>\n<meta name=\"twitter:label1\" content=\"\u0905\u0928\u0941\u092e\u093e\u0928\u093f\u0924 \u092a\u0922\u093c\u0928\u0947 \u0915\u093e \u0938\u092e\u092f\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 \u092e\u093f\u0928\u091f\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/\",\"url\":\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/\",\"name\":\"UML Sequence Diagrams - BooksOffAll Indian\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/in\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg\",\"datePublished\":\"2022-05-23T02:09:38+00:00\",\"dateModified\":\"2022-06-15T05:18:59+00:00\",\"description\":\"A sequence diagram or SSD shows process interactions arranged in time sequence in the field of software engineering.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#breadcrumb\"},\"inLanguage\":\"hi-IN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"hi-IN\",\"@id\":\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg\",\"contentUrl\":\"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg\",\"width\":\"596\",\"height\":\"842\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/in\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/in\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"UML Sequence Diagrams\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/in\/#website\",\"url\":\"https:\/\/www.booksofall.com\/in\/\",\"name\":\"BooksOffAll Indian\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/in\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/in\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"hi-IN\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/in\/#organization\",\"name\":\"BooksOffAll Indian\",\"url\":\"https:\/\/www.booksofall.com\/in\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"hi-IN\",\"@id\":\"https:\/\/www.booksofall.com\/in\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOffAll Indian\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/in\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"UML Sequence Diagrams - BooksOffAll Indian","description":"A sequence diagram or SSD shows process interactions arranged in time sequence in the field of software engineering.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/","og_locale":"hi_IN","og_type":"article","og_title":"UML Sequence Diagrams - BooksOffAll Indian","og_description":"A sequence diagram or SSD shows process interactions arranged in time sequence in the field of software engineering.","og_url":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/","og_site_name":"BooksOffAll Indian","article_modified_time":"2022-06-15T05:18:59+00:00","og_image":[{"url":"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg","twitter_misc":{"\u0905\u0928\u0941\u092e\u093e\u0928\u093f\u0924 \u092a\u0922\u093c\u0928\u0947 \u0915\u093e \u0938\u092e\u092f":"5 \u092e\u093f\u0928\u091f"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/","url":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/","name":"UML Sequence Diagrams - BooksOffAll Indian","isPartOf":{"@id":"https:\/\/www.booksofall.com\/in\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg","datePublished":"2022-05-23T02:09:38+00:00","dateModified":"2022-06-15T05:18:59+00:00","description":"A sequence diagram or SSD shows process interactions arranged in time sequence in the field of software engineering.","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#breadcrumb"},"inLanguage":"hi-IN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/"]}]},{"@type":"ImageObject","inLanguage":"hi-IN","@id":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#primaryimage","url":"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg","contentUrl":"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/img_62a157355096e.jpeg","width":"596","height":"842"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/in\/uml-sequence-diagrams\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/in\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/in\/categories\/"},{"@type":"ListItem","position":3,"name":"UML Sequence Diagrams"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/in\/#website","url":"https:\/\/www.booksofall.com\/in\/","name":"BooksOffAll Indian","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/in\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/in\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"hi-IN"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/in\/#organization","name":"BooksOffAll Indian","url":"https:\/\/www.booksofall.com\/in\/","logo":{"@type":"ImageObject","inLanguage":"hi-IN","@id":"https:\/\/www.booksofall.com\/in\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/in\/wp-content\/uploads\/sites\/13\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOffAll Indian"},"image":{"@id":"https:\/\/www.booksofall.com\/in\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/in\/wp-json\/wp\/v2\/product\/5547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/in\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/in\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/in\/wp-json\/wp\/v2\/media\/5551"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/in\/wp-json\/wp\/v2\/media?parent=5547"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/in\/wp-json\/wp\/v2\/product_brand?post=5547"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/in\/wp-json\/wp\/v2\/product_cat?post=5547"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/in\/wp-json\/wp\/v2\/product_tag?post=5547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}