Curricular Structure


In contrast to a self-transition, no entry or exit actions are ever executed as a result of an internal transition, even if the internal transition is inherited from a higher level of the hierarchy than the currently active state. Because entry actions are executed automatically whenever an associated state is entered, they often determine the conditions of operation or the identity of the state, very much as a class constructor determines the identity of the object being constructed. Every state in a UML statechart can have optional entry actions , which are executed upon entry to a state, as well as optional exit actions , which are executed upon exit from a state. Figure 8 contrasts local a and external b transitions. The use of entry and exit actions is preferable to placing an action on a transition because it avoids repetitive coding and improves function by eliminating a safety hazard; heater on while door open.

Trending on WorldAtlas


For example, Keystroke is an event for the keyboard, but each press of a key is not an event but a concrete instance of the Keystroke event. Another event of interest for the keyboard might be Power-on, but turning the power on tomorrow at An event can have associated parameters , allowing the event instance to convey not only the occurrence of some interesting incident but also quantitative information regarding that occurrence.

For example, the Keystroke event generated by pressing a key on a computer keyboard has associated parameters that convey the character scan code as well as the status of the Shift, Ctrl, and Alt keys. An event instance outlives the instantaneous occurrence that generated it and might convey this occurrence to one or more state machines. Once generated, the event instance goes through a processing life cycle that can consist of up to three stages.

First, the event instance is received when it is accepted and waiting for processing e. Later, the event instance is dispatched to the state machine, at which point it becomes the current event.

Finally, it is consumed when the state machine finishes processing the event instance. A consumed event instance is no longer available for processing. Each state machine has a state , which governs reaction of the state machine to events. For example, when you strike a key on a keyboard, the character code generated will be either an uppercase or a lowercase character, depending on whether the Caps Lock is active.

Therefore, the keyboard's behavior can be divided into two states: The behavior of a keyboard depends only on certain aspects of its history, namely whether the Caps Lock key has been pressed, but not, for example, on how many and exactly which other keys have been pressed previously. A state can abstract away all possible but irrelevant event sequences and capture only the relevant ones. In the context of software state machines and especially classical FSMs , the term state is often understood as a single state variable that can assume only a limited number of a priori determined values e.

The idea of state variable and classical FSM model is that the value of the state variable fully defines the current state of the system at any given time. The concept of the state reduces the problem of identifying the execution context in the code to testing just the state variable instead of many variables, thus eliminating a lot of conditional logic. In practice, however, interpreting the whole state of the state machine as a single state variable quickly becomes impractical for all state machines beyond very simple ones.

Indeed, even if we have a single bit integer in our machine state, it could contribute to over 4 billion different states - and will lead to a premature state explosion. This interpretation is not practical, so in UML state machines the whole state of the state machine is commonly split into a enumeratable state variable and b all the other variables which are named extended state. Another way to see it is to interpret enumeratable state variable as a qualitative aspect and extended state as quantitative aspects of the whole state.

In this interpretation, a change of variable does not always imply a change of the qualitative aspects of the system behavior and therefore does not lead to a change of state. State machines supplemented with extended state variables are called extended state machines and UML state machines belong to this category.

Extended state machines can apply the underlying formalism to much more complex problems than is practical without including extended state variables. The state diagram from Figure 2 is an example of an extended state machine, in which the complete condition of the system called the extended state is the combination of a qualitative aspect—the state variable —and the quantitative aspects—the extended state variables.

The obvious advantage of extended state machines is flexibility. This flexibility of extended state machines comes with a price, however, because of the complex coupling between the "qualitative" and the "quantitative" aspects of the extended state. The coupling occurs through the guard conditions attached to transitions, as shown in Figure 2. Guard conditions or simply guards are Boolean expressions evaluated dynamically based on the value of extended state variables and event parameters.

Guard conditions affect the behavior of a state machine by enabling actions or transitions only when they evaluate to TRUE and disabling them when they evaluate to FALSE. In the UML notation, guard conditions are shown in square brackets e. The need for guards is the immediate consequence of adding memory extended state variables to the state machine formalism. Used sparingly, extended state variables and guards make up a powerful mechanism that can simplify designs.

On the other hand, it is possible to abuse extended states and guards quite easily. Any parameter values associated with the current event are available to all actions directly caused by that event.

Switching from one state to another is called state transition , and the event that causes it is called the triggering event, or simply the trigger. In both cases, pressing CapsLock is the triggering event.

In extended state machines , a transition can have a guard , which means that the transition can "fire" only if the guard evaluates to TRUE. A state can have many transitions in response to the same trigger, as long as they have nonoverlapping guards; however, this situation could create problems in the sequence of evaluation of the guards when the common trigger occurs. The UML specification [1] intentionally does not stipulate any particular order; rather, UML puts the burden on the designer to devise guards in such a way that the order of their evaluation does not matter.

Practically, this means that guard expressions should have no side effects, at least none that would alter evaluation of other guards having the same trigger. All state machine formalisms, including UML state machines, universally assume that a state machine completes processing of each event before it can start processing the next event. This model of execution is called run to completion , or RTC. New incoming events cannot interrupt the processing of the current event and must be stored typically in an event queue until the state machine becomes idle again.

These semantics completely avoid any internal concurrency issues within a single state machine. The RTC model also gets around the conceptual problem of processing actions associated with transitions, where the state machine is not in a well-defined state is between two states for the duration of the action.

During event processing, the system is unresponsive unobservable , so the ill-defined state during that time has no practical significance. In a multitasking environment , other tasks not related to the task context of the busy state machine can be running, possibly preempting the currently executing state machine. As long as other state machines do not share variables or other resources with each other, there are no concurrency hazards.

The key advantage of RTC processing is simplicity. Its biggest disadvantage is that the responsiveness of a state machine is determined by its longest RTC step. Achieving short RTC steps can often significantly complicate real-time designs.

Though the traditional FSMs are an excellent tool for tackling smaller problems, it's also generally known that they tend to become unmanageable, even for moderately involved systems. Due to the phenomenon known as state and transition explosion , the complexity of a traditional FSM tends to grow much faster than the complexity of the system it describes.

This happens because the traditional state machine formalism inflicts repetitions. For example, if you try to represent the behavior of a simple pocket calculator with a traditional FSM, you'll immediately notice that many events e. A conventional FSM shown in the figure below, has no means of capturing such a commonality and requires repeating the same actions and transitions in many states.

What's missing in the traditional state machines is the mechanism for factoring out the common behavior in order to share it across many states. They provide a number of features for eliminating the repetitions so that the complexity of a UML state machine no longer explodes but tends to faithfully represent the complexity of the reactive system it describes.

Obviously, these features are very interesting to software developers, because only they make the whole state machine approach truly applicable to real-life problems. The most important innovation of UML state machines over the traditional FSMs is the introduction of hierarchically nested states that is why statecharts are also called hierarchical state machines , or HSM s.

The semantics associated with state nesting are as follows see Figure 3: If a system is in the nested state, for example "result" called the substate , it also implicitly is in the surrounding state "on" called the superstate. This state machine will attempt to handle any event in the context of the substate, which conceptually is at the lower level of the hierarchy.

However, if the substate "result" does not prescribe how to handle the event, the event is not quietly discarded as in a traditional "flat" state machine; rather, it is automatically handled at the higher level context of the superstate "on". This is what is meant by the system being in state "result" as well as "on". Of course, state nesting is not limited to one level only, and the simple rule of event processing applies recursively to any level of nesting.

States that contain other states are called composite states ; conversely, states without internal structure are called simple states.

A nested state is called a direct substate when it is not contained by any other state; otherwise, it is referred to as a transitively nested substate.

Because the internal structure of a composite state can be arbitrarily complex, any hierarchical state machine can be viewed as an internal structure of some higher-level composite state. It is conceptually convenient to define one composite state as the ultimate root of state machine hierarchy. In the UML specification, [1] every state machine has a top state the abstract root of every state machine hierarchy , which contains all the other elements of the entire state machine.

The graphical rendering of this all-enclosing top state is optional. As you can see, the semantics of hierarchical state decomposition are designed to facilitate reusing of behavior. The substates nested states need only define the differences from the superstates containing states.

A substate can easily inherit [6] the common behavior from its superstate s by simply ignoring commonly handled events, which are then automatically handled by higher-level states.

In other words, hierarchical state nesting enables programming by difference. The aspect of state hierarchy emphasized most often is abstraction —an old and powerful technique for coping with complexity. Instead of addressing all aspects of a complex system at the same time, it is often possible to ignore abstract away some parts of the system. Hierarchical states are an ideal mechanism for hiding internal details because the designer can easily zoom out or zoom in to hide or show nested states.

However, composite states don't simply hide complexity; they also actively reduce it through the powerful mechanism of hierarchical event processing. Without such reuse, even a moderate increase in system complexity could lead to an explosive increase in the number of states and transitions.

For example, the hierarchical state machine representing the pocket calculator Figure 3 avoids repeating the transitions Clear and Off in virtually every state. Avoiding repetition allows the growth of HSMs to remain proportionate to growth in system complexity. As the modeled system grows, the opportunity for reuse also increases and thus potentially counteracts the disproportionate increase in numbers of states and transitions typical of traditional FSMs.

Analysis by hierarchical state decomposition can include the application of the operation 'exclusive-OR' to any given state. For example, if a system is in the "on" superstate Figure 3 , it may be the case that it is also in either "operand1" substate OR the "operand2" substate OR the "opEntered" substate OR the "result" substate.

This would lead to description of the "on" superstate as an 'OR-state'. Such decomposition means that a composite state can contain two or more orthogonal regions orthogonal means compatible and independent in this context and that being in such a composite state entails being in all its orthogonal regions simultaneously.

Orthogonal regions address the frequent problem of a combinatorial increase in the number of states when the behavior of a system is fragmented into independent, concurrently active parts. For example, apart from the main keypad, a computer keyboard has an independent numeric keypad. From the previous discussion, recall the two states of the main keypad already identified: The numeric keypad also can be in two states—"numbers" and "arrows"—depending on whether Num Lock is active.

The complete state space of the keyboard in the standard decomposition is therefore the Cartesian product of the two components main keypad and numeric keypad and consists of four states: The use of orthogonal regions allows the mixing of independent behaviors as a Cartesian product to be avoided and, instead, for them to remain separate, as shown in Figure 4. In most real-life situations, orthogonal regions would be only approximately orthogonal i.

Therefore, UML statecharts provide a number of ways for orthogonal regions to communicate and synchronize their behaviors. Among these rich sets of sometimes complex mechanisms, perhaps the most important feature is that orthogonal regions can coordinate their behaviors by sending event instances to each other. Even though orthogonal regions imply independence of execution allowing more or less concurrency , the UML specification does not require that a separate thread of execution be assigned to each orthogonal region although this can be done if desired.

In fact, most commonly, orthogonal regions execute within the same thread. Every state in a UML statechart can have optional entry actions , which are executed upon entry to a state, as well as optional exit actions , which are executed upon exit from a state. Entry and exit actions are associated with states, not transitions. Regardless of how a state is entered or exited, all its entry and exit actions will be executed.

Because of this characteristic, statecharts behave like Moore machines. The UML notation for state entry and exit actions is to place the reserved word "entry" or "exit" in the state right below the name compartment, followed by the forward slash and the list of arbitrary actions see Figure 5.

The value of entry and exit actions is that they provide means for guaranteed initialization and cleanup , very much like class constructors and destructors in Object-oriented programming. This state has a very important safety-critical requirement: Always disable the heater when the door is open. Additionally, while the door is open, the internal lamp illuminating the oven should light up. However, such a solution would cause the repetition of actions in many transitions.

More importantly, such an approach leaves the design error-prone during subsequent amendments to behavior e. In fact, the total size of Sahamnews.

This result falls beyond the top 1M of websites and identifies a large and not optimized web page that may take ages to load. The most efficient way is to compress content using GZIP which reduces data amount travelling through the network between server and browser. HTML code on this page is well minified. It is highly recommended that content of this web page should be compressed using GZIP, as it can save up to Image size optimization can help to speed up a website loading time.

The chart above shows the difference between the size before and after optimization. Sahamnews images are well optimized though. The diagram shows the current total size of all JavaScript files against the prospective JavaScript size after its minification and compression.

It is highly recommended that all JavaScript files should be compressed and minified as it can save up to CSS files minification is very important to reduce a web page rendering time. The faster CSS files can load, the earlier a page can be rendered. Our browser made a total of 90 requests to load all elements on the main page. The less responsive or slowest element that took the longest time to load 1. We recommend that multiple CSS and JavaScript files should be merged into one by each type, as it can help reduce assets requests from 18 to 1 for JavaScripts and from 8 to 1 for CSS and as a result speed up the page load time.

Language claimed in HTML meta tag should match the language actually used on the web page. Unfortunately we cannot identify language used on the page probably there is a mix of languages, too little text or something else , while the claimed language is Persian. Our system also found out that Sahamnews.