
{"id":2224,"date":"2015-09-17T22:10:46","date_gmt":"2015-09-17T22:10:46","guid":{"rendered":"http:\/\/www.codergears.com\/Blog\/?p=2224"},"modified":"2015-09-18T14:21:09","modified_gmt":"2015-09-18T14:21:09","slug":"the-hidden-cost-of-a-high-coupling-with-external-frameworks","status":"publish","type":"post","link":"https:\/\/codergears.com\/Blog\/?p=2224","title":{"rendered":"The hidden cost of a high coupling with external frameworks."},"content":{"rendered":"<p>Using frameworks accelerate the development of your projects, currently and for each language there \u00a0are many thousands of frameworks and libraries, each one of them has its advantages and its inconvenients and almost every project use at least one external framework. However make your project highly dependent to \u00a0an\u00a0external framework comes with a price.<\/p>\n<p>Let\u2019s discover\u00a0the impact of the high coupling for different actors of the project.<!--more--><\/p>\n<p><span style=\"font-style: italic; color: #3333ff;\">Human resource recruiter:<\/span><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">If a project is highly coupled with the external frameworks, the HR must search for a developer who master also\u00a0the frameworks used\u00a0which makes its task more difficult.<\/span>We can discover that when reading some job offers, where sometimes many frameworks and libraries are \u00a0mentioned.<\/p>\n<p><span style=\"font-style: italic; color: #3333ff;\">Architect and designer:<\/span><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">When the project is highly coupled with other frameworks we lose of flexibility, and any evolution, migration or adaptation of the project became more complicated.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"font-style: italic; color: #3333ff;\">Developer:<\/span><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">Any framework has its difficulties and force every developer \u00a0to master it because it&#8217;s highly coupled with the project will add more\u00a0complexity to the project and it will have a big impact on the developement time and quality.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"font-style: italic; color: #3333ff;\">Tester:<\/span><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">It\u2019s very difficult to isolate just our code and test it if it\u2019s highly coupled with other frameworks. Sometimes the tester need to do some advanced server configuration like for the J2EE servers.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">It\u2019s nice to use frameworks to accelerate the development\u00a0<\/span><span style=\"font-weight: bold; color: #333333;\">but use them carefully and avoid as possible unnecessary coupling.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">Let\u2019s analyze some C++ open source projects to discover what skills needed to integrate the development team.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"font-weight: bold; color: #3333ff;\">Case I: Emule project (http:\/\/www.emule-project.net)<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">After the analysis of\u00a0emule with CppDepend we observe that it uses MFC and ATL libraries<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><a style=\"color: #999999;\" href=\"http:\/\/1.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0exaPADRI\/AAAAAAAAADc\/k9Wl7SbmOC8\/s1600-h\/emuledep.PNG\"><img loading=\"lazy\" decoding=\"async\" id=\"BLOGGER_PHOTO_ID_5353969366218050834\" src=\"http:\/\/1.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0exaPADRI\/AAAAAAAAADc\/k9Wl7SbmOC8\/s800\/emuledep.PNG\" alt=\"\" width=\"610\" height=\"313\" border=\"0\" \/><\/a><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">Let\u2019s see if the project is highly coupled with MFC , for that we can ask CppDepend which classes use the MFC classes and here\u2019s the result:<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><a style=\"color: #999999;\" href=\"http:\/\/2.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0gbHpqMqI\/AAAAAAAAADk\/l7K-wK0b4q0\/s1600-h\/Mfcused.PNG\"><img loading=\"lazy\" decoding=\"async\" id=\"BLOGGER_PHOTO_ID_5353971182295724706\" src=\"http:\/\/2.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0gbHpqMqI\/AAAAAAAAADk\/l7K-wK0b4q0\/s800\/Mfcused.PNG\" alt=\"\" width=\"643\" height=\"184\" border=\"0\" \/><\/a><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">We observe that almost all the methods use the \u00a0MFC framework which makes the emule code base highly coupled with it.<\/span><\/p>\n<p><span style=\"color: #333333;\">We can also search for the \u00a0mostly used MFC classes:<\/span><\/p>\n<div style=\"color: #333333;\"><a style=\"color: #999999;\" href=\"http:\/\/4.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0hL-np_fI\/AAAAAAAAADs\/slZ7Re8GCN0\/s1600-h\/mfctypes.PNG\"><img decoding=\"async\" id=\"BLOGGER_PHOTO_ID_5353972021684993522\" src=\"http:\/\/4.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0hL-np_fI\/AAAAAAAAADs\/slZ7Re8GCN0\/s800\/mfctypes.PNG\" alt=\"\" border=\"0\" \/><\/a><\/div>\n<p><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">MFC is used for the\u00a0Gui, Internet, Archive and Containers. This high coupling\u00a0makes the task difficult to<\/span><span style=\"color: #333333;\">\u00a0use the emule algorithm in other projects and using other frameworks.\u00a0<\/span><span style=\"color: #333333;\">If the algorithm was isolated into different namespace or maybe in another module it can be reused in many other projects that needs the same behavior.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">What about ATL ?<\/span><\/p>\n<div style=\"color: #333333;\"><a style=\"color: #999999;\" href=\"http:\/\/4.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0h_Y-PFiI\/AAAAAAAAAD0\/KsL1cmeIeoA\/s1600-h\/atlused.PNG\"><img decoding=\"async\" id=\"BLOGGER_PHOTO_ID_5353972904932349474\" src=\"http:\/\/4.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0h_Y-PFiI\/AAAAAAAAAD0\/KsL1cmeIeoA\/s800\/atlused.PNG\" alt=\"\" border=\"0\" \/><\/a><\/div>\n<p><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">Emule use only some ATL classes, essentialy CString.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">We can conclude that any developer who want to integrate the emule project must master the MFC library.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"font-weight: bold; color: #3333ff;\">Case II: OpenSTA project (http:\/\/sourceforge.net\/projects\/opensta\/)<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><a style=\"color: #999999;\" href=\"http:\/\/2.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0kQXNRkxI\/AAAAAAAAAD8\/yz7cp4g905Q\/s1600-h\/opensta.PNG\"><img loading=\"lazy\" decoding=\"async\" id=\"BLOGGER_PHOTO_ID_5353975395539587858\" src=\"http:\/\/2.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0kQXNRkxI\/AAAAAAAAAD8\/yz7cp4g905Q\/s800\/opensta.PNG\" alt=\"\" width=\"660\" height=\"221\" border=\"0\" \/><\/a><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">OpenSTA is divided into multiple projects and here&#8217;s some project dependencies:<\/span><\/p>\n<div style=\"color: #333333;\"><a style=\"color: #999999;\" href=\"http:\/\/4.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0lphDOuQI\/AAAAAAAAAEE\/v1d7MZqnmFo\/s1600-h\/dependency.PNG\"><img decoding=\"async\" id=\"BLOGGER_PHOTO_ID_5353976927190169858\" src=\"http:\/\/4.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0lphDOuQI\/AAAAAAAAAEE\/v1d7MZqnmFo\/s800\/dependency.PNG\" alt=\"\" border=\"0\" \/><\/a><\/div>\n<p><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">Divide the project into diffierent modules can be very advantageous, it&#8217;s better to isolate the functionalities, we can use them in other projects and it simplify the complexity of the project.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">Which projects use MFC?<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><a style=\"color: #999999;\" href=\"http:\/\/3.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0nFGp_jdI\/AAAAAAAAAEU\/7JJTGTDlBnE\/s1600-h\/openmfcused.PNG\"><img decoding=\"async\" id=\"BLOGGER_PHOTO_ID_5353978500652961234\" src=\"http:\/\/3.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0nFGp_jdI\/AAAAAAAAAEU\/7JJTGTDlBnE\/s800\/openmfcused.PNG\" alt=\"\" border=\"0\" \/><\/a><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">We observe that not all projects use MFC and the big ones do\u00a0not\u00a0use it.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">Which MFC classses are used?<\/span><\/p>\n<div style=\"color: #333333;\"><a style=\"color: #999999;\" href=\"http:\/\/3.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0mZFvvCbI\/AAAAAAAAAEM\/CG0wJPQ2mxY\/s1600-h\/openmfc.PNG\"><img decoding=\"async\" id=\"BLOGGER_PHOTO_ID_5353977744494365106\" src=\"http:\/\/3.bp.blogspot.com\/_tWDA5bNBNHI\/Sk0mZFvvCbI\/AAAAAAAAAEM\/CG0wJPQ2mxY\/s800\/openmfc.PNG\" alt=\"\" border=\"0\" \/><\/a><\/div>\n<p><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">Many MFC classes are used, specially the OLE classes.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">For the OpenSTA project a C++ developer who not master MFC can integrate the project.<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"font-weight: bold; color: #3333ff;\">Summary:<\/span><br style=\"color: #333333;\" \/><br style=\"color: #333333;\" \/><span style=\"color: #333333;\">Isolating the using of the external frameworks can be very advantageous for many project actors, so keep it simple and avoid any unecessary coupling especialy for business layer.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using frameworks accelerate the development of your projects, currently and for each language there \u00a0are many thousands of frameworks and libraries, each one of them has its advantages and its inconvenients and almost every project use at least one external framework. However make your project highly dependent to \u00a0an\u00a0external framework comes with a price. Let\u2019s &hellip; <a href=\"https:\/\/codergears.com\/Blog\/?p=2224\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The hidden cost of a high coupling with external frameworks.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2224","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/2224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2224"}],"version-history":[{"count":16,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/2224\/revisions"}],"predecessor-version":[{"id":2257,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/2224\/revisions\/2257"}],"wp:attachment":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}