{"id":279,"date":"2018-11-22T15:06:39","date_gmt":"2018-11-22T15:06:39","guid":{"rendered":"http:\/\/fip.r-a-w.org\/?p=279"},"modified":"2018-11-22T15:06:39","modified_gmt":"2018-11-22T15:06:39","slug":"refactoring-other-design-principles-jobman","status":"publish","type":"post","link":"https:\/\/fip.r-a-w.org\/?p=279","title":{"rendered":"Refactoring  &#8211; Other Design Principles &#8211; JobMan"},"content":{"rendered":"<h2>Encapsulate what changes<\/h2>\n<div>A factory pattern could be used to encapsulates job creation. The factory could be for each specific interface -e.g SpawnableJobs. The structure now takes the following form.<\/div>\n<div><\/div>\n<div><\/div>\n<div><a href=\"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"283\" data-permalink=\"https:\/\/fip.r-a-w.org\/?attachment_id=283\" data-orig-file=\"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?fit=2533%2C1229&amp;ssl=1\" data-orig-size=\"2533,1229\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"jobman21-11-18\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?fit=700%2C340&amp;ssl=1\" class=\"alignnone size-large wp-image-283\" src=\"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?resize=700%2C340&#038;ssl=1\" alt=\"\" width=\"700\" height=\"340\" srcset=\"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?resize=1024%2C497&amp;ssl=1 1024w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?resize=300%2C146&amp;ssl=1 300w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?resize=768%2C373&amp;ssl=1 768w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?resize=700%2C340&amp;ssl=1 700w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?resize=2000%2C970&amp;ssl=1 2000w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?resize=824%2C400&amp;ssl=1 824w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?w=1400&amp;ssl=1 1400w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman21-11-18.png?w=2100&amp;ssl=1 2100w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/div>\n<div><\/div>\n<h2>Don\u2019t Repeat Yourself (DRY)<\/h2>\n<div>After applying the other principles &#8211; I cannot see any duplication of functionality at this time.<\/div>\n<div><\/div>\n<h2>Don\u2019t look for things. Ask for things. (Dependency Injection)<\/h2>\n<div>This is already achieved by the implantation of the factory method for creating Jobs. It is also done via injecting the numbering scheme at database creation.<\/div>\n<div><\/div>\n<h2>Favor Composition over Inheritance<\/h2>\n<div>Composition has already been used for the implementation of SpawnableJob.<\/div>\n<div><\/div>\n<h2>Program to the Interface not to the Implementation &amp; Delegation Principles<\/h2>\n<p>This was covered when jobman was reviewed for Single Responsibility Prinicple and Interface Segregation Principle.<\/p>\n<p>&nbsp;<\/p>\n<h2>Conclusions<\/h2>\n<p>This was a useful exercise and will allow some of the work I did on JobMan to be reused in other projects. I will move the GUI code to a separate\u00a0 repository which will be placed on the Sourceforge page and the projects page of this website.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Encapsulate what changes A factory pattern could be used to encapsulates job creation. The factory could be for each specific interface -e.g SpawnableJobs. The structure now takes the following form. Don\u2019t Repeat Yourself (DRY) After applying the other principles &#8211; I cannot see any duplication of functionality at this time. Don\u2019t look for things. Ask &hellip; <a href=\"https:\/\/fip.r-a-w.org\/?p=279\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Refactoring  &#8211; Other Design Principles &#8211; JobMan<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-279","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9NvWe-4v","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/posts\/279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=279"}],"version-history":[{"count":6,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/posts\/279\/revisions"}],"predecessor-version":[{"id":286,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/posts\/279\/revisions\/286"}],"wp:attachment":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}