{"id":1387,"date":"2020-01-14T11:02:54","date_gmt":"2020-01-14T11:02:54","guid":{"rendered":"https:\/\/18.194.6.167\/blog\/?p=1387"},"modified":"2020-02-03T12:53:58","modified_gmt":"2020-02-03T12:53:58","slug":"apache-flink-going-over-the-hill-with-3594-design-issues","status":"publish","type":"post","link":"https:\/\/blog.embold.io\/es\/apache-flink-going-over-the-hill-with-3594-design-issues\/","title":{"rendered":"Apache Flink going over the hill with 3594 Anti-Patterns!"},"content":{"rendered":"\n<p style=\"text-align:left\">Considering the Embold analysis profile for Apache Flink source code it looks like the code needs some serious refactoring in terms of curtailing down the design and code issues detected. This article aims at analyzing where the code is degrading and how it can get back in the game.  Have you got your Embold analysis profile generated yet? If not, get one <a href=\"https:\/\/embold.io\/\">here<\/a>, Embold is free for your open-source repositories!  <\/p>\n\n\n\n<p>Before jumping to any deductions, let&#8217;s have a look at the overall rating of Apache Flink. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1309\" height=\"527\" src=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/kiran_2-1.jpg\" alt=\"\" class=\"wp-image-1468\" srcset=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/kiran_2-1.jpg 1309w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/kiran_2-1-768x309.jpg 768w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/kiran_2-1-1170x471.jpg 1170w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/kiran_2-1-585x236.jpg 585w\" sizes=\"(max-width: 1309px) 100vw, 1309px\" \/><\/figure>\n\n\n\n<h2>What are Anti-Patterns?<\/h2>\n\n\n\n<p> An anti-pattern is a pattern that seems to work but, is counter-productive. It is code emerged over time and has some major maintainability issues.  However, a repeated pattern of actions, processes or structures that initially appears to be beneficial, but ultimately produces more bad consequences. <\/p>\n\n\n\n<p>Making any changes in such code leads to a resisting effect on unlikely components within the application. The above image clearly points out that the design rating has a lot of scope to improve. Without messing around, we will quickly take you to the Anti-Pattern distribution list. Through Embold, you can easily identify and focus on an inefficient component. <\/p>\n\n\n\n<p>In the image below, we have an array of anti-patterns categorized as per the complexity. &lt;\/br&gt; For more details, refer <a href=\"https:\/\/docs.embold.io\/anti-patterns\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Antipatterns article (opens in a new tab)\">Antipatterns article<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"2542\" height=\"1334\" src=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/1-2.png\" alt=\"\" class=\"wp-image-1517\" srcset=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/1-2.png 2542w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/1-2-768x403.png 768w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/1-2-1170x614.png 1170w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/1-2-1920x1008.png 1920w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/1-2-585x307.png 585w\" sizes=\"(max-width: 2542px) 100vw, 2542px\" \/><\/figure>\n\n\n\n<p>As you can see, there are so many design blunders here. These issues are of huge significance in terms of their <strong>complexity<\/strong>. Looking at the right-hand side list, its evident that the issues in the global context are the topmost culprits. Take a look at the numbers for Global Breakable or Global Butterfly for that matter, fixing such <strong>tightly coupled<\/strong> issues will take a painstaking amount of time and effort.<\/p>\n\n\n\n<h2 style=\"text-align:left\">Leaping right into the code<\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" loading=\"lazy\" width=\"2888\" height=\"1310\" src=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.05-1.png\" alt=\"\" class=\"wp-image-1518\" srcset=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.05-1.png 2888w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.05-1-768x348.png 768w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.05-1-1170x531.png 1170w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.05-1-1920x871.png 1920w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.05-1-585x265.png 585w\" sizes=\"(max-width: 2888px) 100vw, 2888px\" \/><\/figure><\/div>\n\n\n\n<p style=\"text-align:left\">Drilling inside package <strong>&#8220;fink-core&#8221;<\/strong>, we reach class <strong>&#8220;CollectionExecuter&#8221;<\/strong> to find the flaky blocks. The method <strong>&#8220;executeUnaryOperator&#8221; <\/strong>seems to have a serious<strong> Dispersed Coupling<\/strong> involved!!  Now Dispersed Coupling happens when methods of class <em>access <\/em>(depend on) many operations across an excessive number of classes thereby making this particular class difficult to maintain. <\/p>\n\n\n\n<h2 style=\"text-align:left\">Maintainable code is the next Clean Code!<\/h2>\n\n\n\n<p style=\"text-align:left\">One might argue that maintainability is not an issue here, but, the <strong>advent of agility in Software Development<\/strong> has focused on creating a ready-to-ship product in each and <strong>every <\/strong>stage of the project life-cycle. Unmaintainable code slows down the software development process. <\/p>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<p style=\"text-align:left\">Lets now have a closer look at how the method <strong>&#8220;executeUnaryOperator&#8221;<\/strong> is <strong>trapped <\/strong>inside this mare&#8217;s nest called <strong>Dispersed Coupling.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"2557\" height=\"1453\" src=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.51-2.png\" alt=\"\" class=\"wp-image-1520\" srcset=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.51-2.png 2557w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.51-2-768x436.png 768w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.51-2-1170x665.png 1170w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.51-2-1920x1091.png 1920w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.45.51-2-585x332.png 585w\" sizes=\"(max-width: 2557px) 100vw, 2557px\" \/><\/figure>\n\n\n\n<p style=\"text-align:left\">As we can clearly see, this method  <strong>&#8220;executeUnaryOperator&#8221;<\/strong> consisting of  31 lines, calls 10 other methods from 8 classes. However, this class being loosely coupled, it is <strong>less risky<\/strong> to make <strong>changes <\/strong>here. <\/p>\n\n\n\n<blockquote style=\"text-align:left\" class=\"wp-block-quote is-style-default\"><p> The fundamental problem with program maintenance is that fixing a defect has a substantial (20-50 percent) chance of introducing another. So the whole process is two steps forward and one step back..<\/p><cite> <em>&#8212; Fred Brooks<\/em>  <\/cite><\/blockquote>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<h2>Code Issues: the local goons<\/h2>\n\n\n\n<p>Moving ahead to the Code Issues there is another interesting finding from Embold called the Code Issues Distribution list which guides us fairly to the <strong>locality <\/strong>of issue occurrence.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"2552\" height=\"1026\" src=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.47.16.png\" alt=\"\" class=\"wp-image-1465\" srcset=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.47.16.png 2552w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.47.16-768x309.png 768w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.47.16-1170x470.png 1170w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.47.16-1920x772.png 1920w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.47.16-585x235.png 585w\" sizes=\"(max-width: 2552px) 100vw, 2552px\" \/><\/figure>\n\n\n\n<p>Embold also has a lot of <a rel=\"noreferrer noopener\" aria-label=\"third-party tools (opens in a new tab)\" href=\"https:\/\/docs.embold.io\/code-issues\/\" target=\"_blank\">third-party tools<\/a> integrated into it thereby fitting perfectly into your <strong>existing <\/strong>product development <strong>ecosystem<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"2552\" height=\"684\" src=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.48.26-1.png\" alt=\"\" class=\"wp-image-1522\" srcset=\"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.48.26-1.png 2552w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.48.26-1-768x206.png 768w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.48.26-1-1170x314.png 1170w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.48.26-1-1920x515.png 1920w, https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/Screenshot-2020-01-16-at-15.48.26-1-585x157.png 585w\" sizes=\"(max-width: 2552px) 100vw, 2552px\" \/><\/figure>\n\n\n\n<p>Another engaging verdict is the Hotspots detection inside the <strong>&#8220;fink-core&#8221;<\/strong> component. Above image states that:<\/p>\n\n\n\n<ul><li>Class <strong>Record <\/strong>is a <strong>hotspot <\/strong>component in the repository. With the integration of the relevance engine, this class is at a 3% <strong>risk <\/strong>out of 5%. <\/li><li>In spite of having a  pretty disturbed overall rating of  -1.73, the positive here is, one can easily start focusing individually on which aspects to work on. <\/li><li>Code Issues rating is -4.69. Code issues are easier to fix because it occurs in a very <strong>local context<\/strong> as there is hardly any dependency. Hence, this can majorly <strong>leverage <\/strong>the overall <strong>quality <\/strong>of the component.<\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<p>Overall, the take on intelligent Static code analysis solution is that it must have configurations to squeeze the most out of your code analysis as well as indicate clearly on <strong>HOW <\/strong>to make code BETTER. These configurations depend on the logic and <strong>environment <\/strong>of the application; also on your personal expectations of the scan results. &lt;\/br&gt; Embold addresses this concern very well by allowing you to fine-tune the analysis results at various levels, to point a few are:<\/p>\n\n\n\n<ul><li> Code Issue Suppression <\/li><li> File Exclusions <\/li><li> Adding customized Quality gate profiles <\/li><li> Support for DevOps environment by creating an automated feedback loop through the pull request <\/li><\/ul>\n\n\n\n<p> The findings list can be continued for long maybe an upcoming article for the next part but until then happy coding!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Considering the Embold analysis profile for Apache Flink source code it looks like the code needs some serious refactoring in terms of curtailing down the design and code issues detected.&hellip;<\/p>\n","protected":false},"author":9,"featured_media":1551,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,10],"tags":[60,59,46,61,56,62,58],"better_featured_image":{"id":1551,"alt_text":"","caption":"","description":"","media_type":"image","media_details":{"width":3000,"height":2003,"file":"2020\/01\/featured_images_19-1.jpg","sizes":{"thumbnail":{"file":"featured_images_19-1-150x150.jpg","width":150,"height":150,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-150x150.jpg"},"medium_large":{"file":"featured_images_19-1-768x513.jpg","width":768,"height":513,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-768x513.jpg"},"penci-full-thumb":{"file":"featured_images_19-1-1170x781.jpg","width":1170,"height":781,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-1170x781.jpg"},"penci-slider-thumb":{"file":"featured_images_19-1-1170x663.jpg","width":1170,"height":663,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-1170x663.jpg"},"penci-magazine-slider":{"file":"featured_images_19-1-780x516.jpg","width":780,"height":516,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-780x516.jpg"},"penci-slider-full-thumb":{"file":"featured_images_19-1-1920x800.jpg","width":1920,"height":800,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-1920x800.jpg"},"penci-single-full":{"file":"featured_images_19-1-1920x1282.jpg","width":1920,"height":1282,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-1920x1282.jpg"},"penci-thumb":{"file":"featured_images_19-1-585x390.jpg","width":585,"height":390,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-585x390.jpg"},"penci-masonry-thumb":{"file":"featured_images_19-1-585x391.jpg","width":585,"height":391,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-585x391.jpg"},"penci-thumb-square":{"file":"featured_images_19-1-585x585.jpg","width":585,"height":585,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-585x585.jpg"},"penci-thumb-vertical":{"file":"featured_images_19-1-480x650.jpg","width":480,"height":650,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-480x650.jpg"},"penci-thumb-small":{"file":"featured_images_19-1-263x175.jpg","width":263,"height":175,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-263x175.jpg"},"jr_insta_square":{"file":"featured_images_19-1-640x640.jpg","width":640,"height":640,"mime-type":"image\/jpeg","source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1-640x640.jpg"}},"image_meta":{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0","keywords":[]}},"post":1387,"source_url":"https:\/\/blog.embold.io\/wp-content\/uploads\/sites\/2\/2020\/01\/featured_images_19-1.jpg"},"translation":{"provider":"WPGlobus","version":"2.10.8","language":"es","enabled_languages":["en","es","de","fr","ru"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"es":{"title":false,"content":false,"excerpt":false},"de":{"title":false,"content":false,"excerpt":false},"fr":{"title":false,"content":false,"excerpt":false},"ru":{"title":false,"content":false,"excerpt":false}}},"_links":{"self":[{"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/posts\/1387"}],"collection":[{"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/comments?post=1387"}],"version-history":[{"count":86,"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/posts\/1387\/revisions"}],"predecessor-version":[{"id":1554,"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/posts\/1387\/revisions\/1554"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/media\/1551"}],"wp:attachment":[{"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/media?parent=1387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/categories?post=1387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embold.io\/es\/wp-json\/wp\/v2\/tags?post=1387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}