{"id":6972,"date":"2022-08-10T15:14:37","date_gmt":"2022-08-10T13:14:37","guid":{"rendered":"https:\/\/blue.pri.ee\/ttu\/?page_id=6972"},"modified":"2022-09-01T09:13:40","modified_gmt":"2022-09-01T07:13:40","slug":"uml-sample-wd40","status":"publish","type":"page","link":"https:\/\/blue.pri.ee\/ttu\/resources\/introduction-to-algorithms-and-uml\/uml-sample-wd40\/","title":{"rendered":"UML example: WD40"},"content":{"rendered":"<p>In this example, we&#8217;ll translate a classical flowchart into a UML activity diagram. First introduce yourself to the diagram and figure out the 4 possible flows in it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/blue.pri.ee\/ttu\/files\/Prog1\/engineering_flowchart.jpg\" width=\"604\" height=\"446\" \/><\/p>\n<p>Since the diagram is already describing a flow, the only thing we need to do is convert it to UML using the standardized language elements.<\/p>\n<p>Look at the flowchart and think of the following:<\/p>\n<ul>\n<li>Where are decisions being made? They may be presented as questions wit ha Yes or No answers. Use UML decision node.<\/li>\n<li>Where are the actions? Use UML action state.<\/li>\n<li>Where is the start of the algorithm? Use UML start node.<\/li>\n<li>Where is the end? Could there be multiple endings? Use UML end node.<\/li>\n<li>Think, can there be some things in the flowchart that are not needed for the UML activity diagram. E.g. if nothing is being done, then doing noting is not an action &#8211; it&#8217;s the absence of an action.<\/li>\n<\/ul>\n<p><span style=\"color: #ff0000;\"><strong>Recommendation: before going forward, solve the task by creating a UML activity diagram based on the given flowchart and compare your solution.\u00a0<\/strong><\/span><\/p>\n<p>NB! There are multiple correct solutions for this conversion. Before showing you the solution, lets go over some mistakes.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blue.pri.ee\/ttu\/resources\/introduction-to-algorithms-and-uml\/uml-sample-wd40\/#Common_mistakes\" >Common mistakes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blue.pri.ee\/ttu\/resources\/introduction-to-algorithms-and-uml\/uml-sample-wd40\/#Solution\" >Solution<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blue.pri.ee\/ttu\/resources\/introduction-to-algorithms-and-uml\/uml-sample-wd40\/#Variations\" >Variations<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Common_mistakes\"><\/span>Common mistakes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Before looking at the solution, lets make sure that you didn&#8217;t do any of the following mistakes.<\/p>\n<ul>\n<li>Answers &#8220;Yes&#8221; and &#8220;No&#8221;\u00a0<strong>are not actions<\/strong>. They cannot be placed inside action states &#8211; only actions where we can do something go there. In this case, they are answers to the question which we based our decision node on.<\/li>\n<li>Missing merge node &#8211; if multiple flows merge (after being separated by decision nodes), you must use a merge node to join them. In the case of merge node not being available, you can reuse a decision node.\u00a0<b>Do not use a join node! Join node is only\u00a0 used for synchronization of parallel flows after a fork node.<\/b><\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Solution\"><\/span>Solution<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>This would be one possible solution for the task.<\/p>\n<p><a href=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2022\/08\/ducttape.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-7014 size-full\" src=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2022\/08\/ducttape.png\" alt=\"\" width=\"803\" height=\"682\" srcset=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2022\/08\/ducttape.png 803w, https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2022\/08\/ducttape-300x255.png 300w, https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2022\/08\/ducttape-768x652.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Variations\"><\/span>Variations<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>As said, this algorithm has multiple correct solutions. Some alterations could be as follows:<\/p>\n<ul>\n<li>The algorithm can have 3 different endings &#8211; one where nothing is being done, one where WD40 will be applied and one where duct tape will be applied. A merge node must precede the ending where nothing will be done. It&#8217;s also important to comment all of the endings differently (e.g. WD40 applied to reduce friction).<\/li>\n<li>Questions such as &#8220;Does it move&#8221; do not need to be written as a note element. Note can be omitted and the answers can directly be written on the control flow arrows. (E.g. for the first decision node, they could it that &#8220;The object moves&#8221; and &#8220;The object does not move&#8221;. When writing decision node this way, the question itself will not be present in the design.)<br \/>\n<a href=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2022\/08\/Visual_Paradigm_mITyUTfPGl.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6980 size-medium\" src=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2022\/08\/Visual_Paradigm_mITyUTfPGl-300x159.png\" alt=\"\" width=\"300\" height=\"159\" srcset=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2022\/08\/Visual_Paradigm_mITyUTfPGl-300x159.png 300w, https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2022\/08\/Visual_Paradigm_mITyUTfPGl.png 520w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/li>\n<li>The questions themselves can be brought out as action\u00a0 &#8211; e.g. &#8220;Ask of the object moves?&#8221;. Adding the question as an action state does not affect the decision nodes. You are not allowed to omit anything from the decision by adding the question as an action. Since this can be considered as redundant, it was omitted from the sample solution.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this example, we&#8217;ll translate a classical flowchart into a UML activity diagram. First introduce yourself to the diagram and figure out the 4 possible flows in it. Since the diagram is already describing a flow, the only thing we need to do is convert it to UML using the standardized language elements. Look at &hellip; <a href=\"https:\/\/blue.pri.ee\/ttu\/resources\/introduction-to-algorithms-and-uml\/uml-sample-wd40\/\" class=\"more-link\">Loe edasi <span class=\"screen-reader-text\">UML example: WD40<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1619,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-templates\/code-width-wide.php","meta":{"footnotes":""},"class_list":["post-6972","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/pages\/6972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/comments?post=6972"}],"version-history":[{"count":0,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/pages\/6972\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/pages\/1619"}],"wp:attachment":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/media?parent=6972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}