{"id":1580,"date":"2020-06-26T11:16:42","date_gmt":"2020-06-26T05:46:42","guid":{"rendered":"https:\/\/binaryterms.com\/?p=1580"},"modified":"2021-01-18T11:09:23","modified_gmt":"2021-01-18T05:39:23","slug":"state-model","status":"publish","type":"post","link":"https:\/\/binaryterms.com\/state-model.html","title":{"rendered":"State Model"},"content":{"rendered":"<p>A <strong>state model<\/strong> describes the timely behaviour of the class objects over a period of time. A state model has multiple <strong>state diagrams<\/strong> where each state diagram describes a class in the model.<\/p>\n<p>State model shows these changes in the object with the help of <strong>states, events, transitions<\/strong> and <strong>conditions<\/strong>. Events are the incidents that occur to the object at a particular time whereas the state shows the value of the object at a particular time. In this section, we will discuss state model along with its elements and importance.<\/p>\n<h3>Content: State Model in Object Orientation<\/h3>\n<ol>\n<li><a href=\"#WhatisStateModelling?\">What is State Modelling?<\/a><\/li>\n<li><a href=\"#ElementsofStateModel\">Elements of State Model<\/a><\/li>\n<li><a href=\"#StateDiagram\">State Diagram<\/a><\/li>\n<li><a href=\"#KeyTakeaways\">Key Takeaways<\/a><\/li>\n<\/ol>\n<p><a name=\"WhatisStateModelling?\"><\/a><\/p>\n<h3>What is State Modelling?<\/h3>\n<p>A state model describes the life of the objects over a period of time and it also defines the sequence of operations that are implemented on the object over that period of time. Further, the state model also explains what kind of operations are implemented, on what they are implemented and how they are implemented?<\/p>\n<p>So, on an, all the state model thereby represents <strong>behaviour<\/strong> and <strong>control<\/strong> aspect of the entire system. The state model is comprised of several state diagrams. Each state diagram represents a class with the aspects important from the application point of view. The figure below will show you the sample state diagram that shows the relation of events to states which we will discuss in the section below.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1584\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg\" alt=\"sample state diagram\" width=\"549\" height=\"190\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg 549w, https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram-300x104.jpg 300w\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" \/><\/p>\n<p><a name=\"ElementsofStateModel\"><\/a><\/p>\n<h3>Elements of State Model<\/h3>\n<p>As we have learnt above that the state model consists of several state diagram where each state diagram represents a class. A state diagram describes the relation between events and states which are the significant elements of the state model. 4Let us discuss them one by one.<\/p>\n<p><strong>Events<\/strong><\/p>\n<p>Events are the incidents that take place at a particular time. For example, a train departs from the station, a person switches off the button and so on. In the problem statement, you can identify events as the verbs in past tense or you can identify them as the beginning of some condition.<\/p>\n<p>The two non-relating events are said to be concurrent if they don\u2019t have an impact on each other. Events can also be the error condition like the transaction aborted, timeout condition. Well we have several types of events but here we will discuss some common type as given below:<\/p>\n<p>1. Signal Event<\/p>\n<p>The signal event describes, sending and receiving of information from one object to another at a particular time. This event specifies one-way transmission.<\/p>\n<p>2. Change Event<\/p>\n<p>A change event is an event that occurs whenever a boolean expression is satisfied. This boolean expression is checked continuously and whenever the expression result changes from true to false or from false to true the change event occurs.<\/p>\n<p>Although we know that the change event is not checked continuously but it should be check so frequently that it appears continuous from the application point of view. The UML representation of the change event is as follow:<\/p>\n<p style=\"text-align: center\"><em>when(room temperature &lt; heating point)<\/em><\/p>\n<p>In UML the change event is expressed using \u2018<strong>when<\/strong>\u2019 keyword followed by the boolean expression.<\/p>\n<p>3. Time Event<\/p>\n<p>The time event is the event that occurs at a specified time or after the specified time elapsed. The absolute time event is represented in the UML using the &#8216;<strong>when<\/strong>&#8216; keyword followed by the parenthesis with a time expression. The Time interval event is represented by the &#8216;<strong>after<\/strong>&#8216; keyword followed parenthesis with expression evaluating the time duration.<\/p>\n<p style=\"text-align: center\"><em>when(time = 18:30)<\/em><br \/>\n<em>after(10 seconds)<\/em><\/p>\n<p><strong>States<\/strong><\/p>\n<p>The state represents the values of the attributes of an object at a particular time. Thus, the state defines the behaviour of an object at a point in time. Like, the water at a point in time can either be in a liquid state or solid-state or gaseous state.<\/p>\n<p>A state can be identified as a verb with the suffix of \u2018<strong>ing<\/strong>\u2019 for example, eating, waiting, sitting. In UML the state of an object is represented with the <em>round box<\/em> containing the state name.<\/p>\n<p>While defining the state of an object, attributes whose values do not have an impact on the state of an object are ignored. An object has a finite number of state and at a time it can be in one state only. As an event occurs the object changes its current state depending on the type of event occurred.<\/p>\n<p>The difference between the event and the state is that the event represents a particular point in the time scale whereas state represents an interval in the time scale.<\/p>\n<p><strong>Transitions and Condition<\/strong><\/p>\n<p>When an object changes its current state to another state it is termed as the transition. The source state and the target state of a transition are usually different but, in some cases, both source and target may be the same.<\/p>\n<p>Transition triggers the change in the original state of an object on the occurrence of an event. Thereby the target state or the next state of the object depends on the object\u2019s original state and the event to which the object\u2019s original state has responded.<\/p>\n<p>The occurrence of the transition also depends on the guard condition which is a boolean expression. The guard condition is checked only once when an event occurs and if it turns out true the transition takes place.<br \/>\n<a name=\"StateDiagram\"><\/a><\/p>\n<h3>State Diagram<\/h3>\n<p>The state diagram in a state model represents the order of the events which causes the change in states sequentially. A state diagram is basically a graph, where every node in a graph denotes the state and every line connecting the nodes are the transitions that respond to an event and cause changes in the state.<\/p>\n<p>There are multiple state diagrams in a state model and each state diagram would represent a class and its timely behaviour, important from the application point of view. The diagram below represents the state diagram for a chess game.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1582\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/state-diagram.jpg\" alt=\"state diagram\" width=\"500\" height=\"325\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/state-diagram.jpg 500w, https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/state-diagram-300x195.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>In the above diagram, the rounded boxes with a name are the states. The arrowed lines are the transitions and arrowhead points to the target state. The labels over the transition lines are the event that lets the transition and change of states occur.<\/p>\n<p>Each state diagram in the state model is presented in the rectangular frame and the name of the corresponding state diagram is written in the pentagonal tag at the left corner of the rectangular frame as you can see in the figure above. Guard conditions are optional are if required are written in square brackets just beside the events.<br \/>\n<a name=\"KeyTakeaways\"><\/a><\/p>\n<h3>Key Takeaways<\/h3>\n<div id=\"keytake\">\n<ul>\n<li>State model shows the behavioural aspect of the object over a period of time.<\/li>\n<li>A state model has several state diagram each for a class.<\/li>\n<li>Elements of state diagram are events, states, transitions and conditions.<\/li>\n<li>Events are the incidents that occur at a point in time.<\/li>\n<li>The state is the value of attributes of an object at a particular point of time.<\/li>\n<li>Transition is the change of state from one to another.<\/li>\n<li>The guard condition is the test which when turns true the transition occurs in the state.<\/li>\n<li>The state diagram shows the sequence of events and the sequence of changes occurred in the states due to events.<\/li>\n<\/ul>\n<\/div>\n<p>So, this is all about the state modelling which represents the changes that occur in the state of the objects over a period of time. We have discussed the elements of state modelling along with the examples.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A state model describes the timely behaviour of the class objects over a period of time. A state model has multiple state diagrams where each state diagram describes a class in the model. State model shows these changes in the object with the help of states, events, transitions and conditions. Events are the incidents that [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[10],"tags":[],"class_list":{"0":"post-1580","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-oot","7":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is State Model in Object Orientation? - Binary Terms<\/title>\n<meta name=\"description\" content=\"A state model has multiple state diagrams where each state diagram describes a class in the model. The state model describes the changes that occur in the class object over the period of time.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/binaryterms.com\/state-model.html\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is State Model in Object Orientation? - Binary Terms\" \/>\n<meta property=\"og:description\" content=\"A state model has multiple state diagrams where each state diagram describes a class in the model. The state model describes the changes that occur in the class object over the period of time.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/binaryterms.com\/state-model.html\" \/>\n<meta property=\"og:site_name\" content=\"Binary Terms\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-26T05:46:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-18T05:39:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg\" \/>\n<meta name=\"author\" content=\"Neha T\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Neha T\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/binaryterms.com\/state-model.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/state-model.html\"},\"author\":{\"name\":\"Neha T\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\"},\"headline\":\"State Model\",\"datePublished\":\"2020-06-26T05:46:42+00:00\",\"dateModified\":\"2021-01-18T05:39:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/binaryterms.com\/state-model.html\"},\"wordCount\":1228,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/state-model.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg\",\"articleSection\":[\"Object Oriented Technology\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/binaryterms.com\/state-model.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/binaryterms.com\/state-model.html\",\"url\":\"https:\/\/binaryterms.com\/state-model.html\",\"name\":\"What is State Model in Object Orientation? - Binary Terms\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/binaryterms.com\/state-model.html#primaryimage\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/state-model.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg\",\"datePublished\":\"2020-06-26T05:46:42+00:00\",\"dateModified\":\"2021-01-18T05:39:23+00:00\",\"description\":\"A state model has multiple state diagrams where each state diagram describes a class in the model. The state model describes the changes that occur in the class object over the period of time.\",\"breadcrumb\":{\"@id\":\"https:\/\/binaryterms.com\/state-model.html#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/binaryterms.com\/state-model.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/binaryterms.com\/state-model.html#primaryimage\",\"url\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg\",\"contentUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg\",\"width\":549,\"height\":190,\"caption\":\"sample state diagram\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/binaryterms.com\/state-model.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/binaryterms.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"State Model\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/binaryterms.com\/#website\",\"url\":\"https:\/\/binaryterms.com\/\",\"name\":\"Binary Terms\",\"description\":\"The Computer Science &amp; IT Guide\",\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/binaryterms.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/binaryterms.com\/#organization\",\"name\":\"Binary Terms\",\"url\":\"https:\/\/binaryterms.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"contentUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"width\":400,\"height\":63,\"caption\":\"Binary Terms\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\",\"name\":\"Neha T\",\"url\":\"https:\/\/binaryterms.com\/author\/author\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is State Model in Object Orientation? - Binary Terms","description":"A state model has multiple state diagrams where each state diagram describes a class in the model. The state model describes the changes that occur in the class object over the period of time.","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:\/\/binaryterms.com\/state-model.html","og_locale":"en_GB","og_type":"article","og_title":"What is State Model in Object Orientation? - Binary Terms","og_description":"A state model has multiple state diagrams where each state diagram describes a class in the model. The state model describes the changes that occur in the class object over the period of time.","og_url":"https:\/\/binaryterms.com\/state-model.html","og_site_name":"Binary Terms","article_published_time":"2020-06-26T05:46:42+00:00","article_modified_time":"2021-01-18T05:39:23+00:00","og_image":[{"url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg","type":"","width":"","height":""}],"author":"Neha T","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Neha T","Estimated reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/binaryterms.com\/state-model.html#article","isPartOf":{"@id":"https:\/\/binaryterms.com\/state-model.html"},"author":{"name":"Neha T","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe"},"headline":"State Model","datePublished":"2020-06-26T05:46:42+00:00","dateModified":"2021-01-18T05:39:23+00:00","mainEntityOfPage":{"@id":"https:\/\/binaryterms.com\/state-model.html"},"wordCount":1228,"commentCount":0,"publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"image":{"@id":"https:\/\/binaryterms.com\/state-model.html#primaryimage"},"thumbnailUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg","articleSection":["Object Oriented Technology"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/binaryterms.com\/state-model.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/binaryterms.com\/state-model.html","url":"https:\/\/binaryterms.com\/state-model.html","name":"What is State Model in Object Orientation? - Binary Terms","isPartOf":{"@id":"https:\/\/binaryterms.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/binaryterms.com\/state-model.html#primaryimage"},"image":{"@id":"https:\/\/binaryterms.com\/state-model.html#primaryimage"},"thumbnailUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg","datePublished":"2020-06-26T05:46:42+00:00","dateModified":"2021-01-18T05:39:23+00:00","description":"A state model has multiple state diagrams where each state diagram describes a class in the model. The state model describes the changes that occur in the class object over the period of time.","breadcrumb":{"@id":"https:\/\/binaryterms.com\/state-model.html#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/binaryterms.com\/state-model.html"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/binaryterms.com\/state-model.html#primaryimage","url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg","contentUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/06\/sample-state-diagram.jpg","width":549,"height":190,"caption":"sample state diagram"},{"@type":"BreadcrumbList","@id":"https:\/\/binaryterms.com\/state-model.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/binaryterms.com\/"},{"@type":"ListItem","position":2,"name":"State Model"}]},{"@type":"WebSite","@id":"https:\/\/binaryterms.com\/#website","url":"https:\/\/binaryterms.com\/","name":"Binary Terms","description":"The Computer Science &amp; IT Guide","publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/binaryterms.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/binaryterms.com\/#organization","name":"Binary Terms","url":"https:\/\/binaryterms.com\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/","url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","contentUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","width":400,"height":63,"caption":"Binary Terms"},"image":{"@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe","name":"Neha T","url":"https:\/\/binaryterms.com\/author\/author"}]}},"_links":{"self":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/1580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/comments?post=1580"}],"version-history":[{"count":2,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/1580\/revisions"}],"predecessor-version":[{"id":2183,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/1580\/revisions\/2183"}],"wp:attachment":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/media?parent=1580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/categories?post=1580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/tags?post=1580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}