{"id":6353,"date":"2022-05-27T02:40:33","date_gmt":"2022-05-27T02:40:33","guid":{"rendered":"https:\/\/www.booksofall.com\/cn\/?post_type=product&#038;p=6353"},"modified":"2022-06-15T05:12:10","modified_gmt":"2022-06-15T05:12:10","slug":"uml-2-notes-state-diagrams","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/","title":{"rendered":"UML 2 Notes: State Diagrams"},"content":{"rendered":"<p><b>UML state machine<\/b>, <sup id=\"cite_ref-UML2_2_1-0\" class=\"reference\"><\/sup>also known as\u00a0<b>UML statechart<\/b>, is an extension of the\u00a0<a title=\"Mathematics\" href=\"https:\/\/en.wikipedia.org\/wiki\/Mathematics\">mathematical<\/a>\u00a0concept of a\u00a0<a title=\"Finite-state machine\" href=\"https:\/\/en.wikipedia.org\/wiki\/Finite-state_machine\">finite automaton<\/a>\u00a0in\u00a0<a title=\"Computer science\" href=\"https:\/\/en.wikipedia.org\/wiki\/Computer_science\">computer science<\/a>\u00a0applications as expressed in the\u00a0<a title=\"Unified Modeling Language\" href=\"https:\/\/en.wikipedia.org\/wiki\/Unified_Modeling_Language\">Unified Modeling Language<\/a>\u00a0(UML) notation.<\/p>\n<p>The concepts behind it are about organizing the way a device, computer program, or other (often technical) process works such that an entity or each of its sub-entities is always in exactly one of a number of possible states and where there are well-defined conditional transitions between these states.<\/p>\n<p>UML state machine is an object-based variant of\u00a0<a class=\"mw-redirect\" title=\"Harel statechart\" href=\"https:\/\/en.wikipedia.org\/wiki\/Harel_statechart\">Harel statechart<\/a>, <sup id=\"cite_ref-Harel87_2-0\" class=\"reference\"><\/sup>adapted and extended by UML. The goal of UML state machines is to overcome the main limitations of traditional\u00a0<a title=\"Finite-state machine\" href=\"https:\/\/en.wikipedia.org\/wiki\/Finite-state_machine\">finite-state machines<\/a>\u00a0while retaining their main benefits. UML statecharts introduce the new concepts of\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine#Hierarchically_nested_states\">hierarchically nested states<\/a>\u00a0and\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine#Orthogonal_regions\">orthogonal regions<\/a>, while extending the notion of\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine#Actions_and_transitions\">actions<\/a>. UML state machines have the characteristics of both\u00a0<a title=\"Mealy machine\" href=\"https:\/\/en.wikipedia.org\/wiki\/Mealy_machine\">Mealy machines<\/a>\u00a0and\u00a0<a title=\"Moore machine\" href=\"https:\/\/en.wikipedia.org\/wiki\/Moore_machine\">Moore machines<\/a>. They support\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine#Actions_and_transitions\">actions<\/a>\u00a0that depend on both the state of the system and the triggering\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine#Events\">event<\/a>, as in Mealy machines, as well as\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine#Entry_and_exit_actions\">entry and exit actions<\/a>, which are associated with states rather than transitions, as in Moore machines.<sup id=\"cite_ref-Samek09_4-0\" class=\"reference\"><\/sup><\/p>\n<p>The term &#8220;UML state machine&#8221; can refer to two kinds of state machines:\u00a0<i>behavioral state machines<\/i>\u00a0and\u00a0<i>protocol state machines<\/i>. Behavioral state machines can be used to model the behavior of individual entities (e.g., class instances), a subsystem, a package, or even an entire system. Protocol state machines are used to express usage protocols and can be used to specify the legal usage scenarios of classifiers, interfaces, and ports.<\/p>\n<h4><span id=\"Basic_state_machine_concepts\" class=\"mw-headline\">Basic state machine concepts<\/span><\/h4>\n<p>Many software systems are\u00a0<a title=\"Event-driven programming\" href=\"https:\/\/en.wikipedia.org\/wiki\/Event-driven_programming\">event-driven<\/a>, which means that they continuously wait for the occurrence of some external or internal\u00a0<b><a href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine#Events\">event<\/a><\/b>\u00a0such as a mouse click, a button press, a time tick, or an arrival of a data packet. After recognizing the event, such systems react by performing the appropriate computation that may include manipulating the hardware or generating \u201csoft\u201d events that trigger other internal software components. (That&#8217;s why event-driven systems are alternatively called\u00a0<b>reactive systems<\/b>.) Once the event handling is complete, the system goes back to waiting for the next event.<\/p>\n<p>The response to an event generally depends on both the type of the event and on the internal\u00a0<b><a href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine#States\">state<\/a><\/b>\u00a0of the system and can include a change of state leading to a\u00a0<b><a href=\"https:\/\/en.wikipedia.org\/wiki\/UML_state_machine#Actions_and_transitions\">state transition<\/a><\/b>. The pattern of events, states, and state transitions among those states can be abstracted and represented as a\u00a0<b><a title=\"Finite-state machine\" href=\"https:\/\/en.wikipedia.org\/wiki\/Finite-state_machine\">finite-state machine<\/a><\/b>\u00a0(FSM).<\/p>\n<p>The concept of a FSM is important in\u00a0<a title=\"Event-driven programming\" href=\"https:\/\/en.wikipedia.org\/wiki\/Event-driven_programming\">event-driven programming<\/a> because it makes the event handling explicitly dependent on both the event-type and on the state of the system. When used correctly, a state machine can drastically cut down the number of execution paths through the code, simplify the conditions tested at each branching point, and simplify the switching between different modes of execution.\u00a0<sup id=\"cite_ref-Samek08_5-0\" class=\"reference\"><\/sup>Conversely, using event-driven programming without an underlying FSM model can lead programmers to produce error prone, difficult to extend and excessively complex application code.<sup id=\"cite_ref-Samek03b_6-0\" class=\"reference\"><\/sup><\/p>\n<h4><span id=\"Basic_UML_state_diagrams\" class=\"mw-headline\">Basic UML state diagrams<\/span><\/h4>\n<p>UML preserves the general form of the\u00a0<a title=\"State diagram\" href=\"https:\/\/en.wikipedia.org\/wiki\/State_diagram\">traditional state diagrams<\/a>. The UML state diagrams are\u00a0<a title=\"State diagram\" href=\"https:\/\/en.wikipedia.org\/wiki\/State_diagram#Directed_graph\">directed graphs<\/a>\u00a0in which nodes denote states and connectors denote state transitions. For example, Figure 1 shows a UML state diagram corresponding to the computer keyboard state machine. In UML, states are represented as rounded rectangles labeled with state names. The transitions, represented as arrows, are labeled with the triggering events followed optionally by the list of executed actions. The\u00a0<b>initial transition<\/b>\u00a0originates from the solid circle and specifies the default state when the system first begins. Every state diagram should have such a transition, which should not be labeled, since it is not triggered by an event. The initial transition can have associated actions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe style=\"width: 100%; height: 700px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/uml-2-notes--state-diagrams-ytrt8csuy?enforceShowPromotionBar=true\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"featured_media":6356,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"State machine is an extension of the mathematical concept of a finite automaton in computer science applications as expressed in the UML notation."},"product_brand":[],"product_cat":[213],"product_tag":[201],"class_list":{"0":"post-6353","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 2 Notes: State Diagrams - BooksOfAll Simplified Chinese<\/title>\n<meta name=\"description\" content=\"State machine is an extension of the mathematical concept of a finite automaton in computer science applications as expressed in the UML notation.\" \/>\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\/cn\/uml-2-notes-state-diagrams\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UML 2 Notes: State Diagrams - BooksOfAll Simplified Chinese\" \/>\n<meta property=\"og:description\" content=\"State machine is an extension of the mathematical concept of a finite automaton in computer science applications as expressed in the UML notation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll Simplified Chinese\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-15T05:12:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg\" \/>\n<meta name=\"twitter:label1\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/\",\"url\":\"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/\",\"name\":\"UML 2 Notes: State Diagrams - BooksOfAll Simplified Chinese\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg\",\"datePublished\":\"2022-05-27T02:40:33+00:00\",\"dateModified\":\"2022-06-15T05:12:10+00:00\",\"description\":\"State machine is an extension of the mathematical concept of a finite automaton in computer science applications as expressed in the UML notation.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg\",\"contentUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg\",\"width\":\"596\",\"height\":\"842\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/cn\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"UML 2 Notes: State Diagrams\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#website\",\"url\":\"https:\/\/www.booksofall.com\/cn\/\",\"name\":\"BooksOfAll Simplified Chinese\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/cn\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#organization\",\"name\":\"BooksOfAll Simplified Chinese\",\"url\":\"https:\/\/www.booksofall.com\/cn\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll Simplified Chinese\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"UML 2 Notes: State Diagrams - BooksOfAll Simplified Chinese","description":"State machine is an extension of the mathematical concept of a finite automaton in computer science applications as expressed in the UML notation.","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\/cn\/uml-2-notes-state-diagrams\/","og_locale":"zh_CN","og_type":"article","og_title":"UML 2 Notes: State Diagrams - BooksOfAll Simplified Chinese","og_description":"State machine is an extension of the mathematical concept of a finite automaton in computer science applications as expressed in the UML notation.","og_url":"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/","og_site_name":"BooksOfAll Simplified Chinese","article_modified_time":"2022-06-15T05:12:10+00:00","og_image":[{"url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg","twitter_misc":{"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/","url":"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/","name":"UML 2 Notes: State Diagrams - BooksOfAll Simplified Chinese","isPartOf":{"@id":"https:\/\/www.booksofall.com\/cn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg","datePublished":"2022-05-27T02:40:33+00:00","dateModified":"2022-06-15T05:12:10+00:00","description":"State machine is an extension of the mathematical concept of a finite automaton in computer science applications as expressed in the UML notation.","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#primaryimage","url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg","contentUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/img_62a186fc39c5a.jpeg","width":"596","height":"842"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/cn\/uml-2-notes-state-diagrams\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/cn\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/cn\/categories\/"},{"@type":"ListItem","position":3,"name":"UML 2 Notes: State Diagrams"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/cn\/#website","url":"https:\/\/www.booksofall.com\/cn\/","name":"BooksOfAll Simplified Chinese","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/cn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/cn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/cn\/#organization","name":"BooksOfAll Simplified Chinese","url":"https:\/\/www.booksofall.com\/cn\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll Simplified Chinese"},"image":{"@id":"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product\/6353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/media\/6356"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/media?parent=6353"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_brand?post=6353"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_cat?post=6353"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_tag?post=6353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}