{"id":245,"date":"2018-11-08T13:21:27","date_gmt":"2018-11-08T13:21:27","guid":{"rendered":"http:\/\/fip.r-a-w.org\/?p=245"},"modified":"2018-11-08T13:21:27","modified_gmt":"2018-11-08T13:21:27","slug":"refactoring-single-responsibility-principle-srp-applied-to-jobman","status":"publish","type":"post","link":"https:\/\/fip.r-a-w.org\/?p=245","title":{"rendered":"Refactoring &#8211; Single Responsibility Principle (SRP) applied to JobMan"},"content":{"rendered":"<p>The MainJob Class stores the data regarding a Job but also issues subjob numbers. Similarly the JobDatabase issues the MainJob Numbers. The Job numbers follow a particular scheme. So the scheme could be injected into the JobDatabase removing the responsibility from the MainJob class.\u00a0 This will also impact on JobComparator class which will also have to move to a dependency injection.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman8-11-18.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"249\" data-permalink=\"https:\/\/fip.r-a-w.org\/?attachment_id=249\" data-orig-file=\"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman8-11-18.png?fit=1035%2C1002&amp;ssl=1\" data-orig-size=\"1035,1002\" 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=\"jobman8-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\/jobman8-11-18.png?fit=700%2C677&amp;ssl=1\" class=\"alignnone size-large wp-image-249\" src=\"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman8-11-18.png?resize=700%2C677&#038;ssl=1\" alt=\"\" width=\"700\" height=\"677\" srcset=\"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman8-11-18.png?resize=1024%2C991&amp;ssl=1 1024w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman8-11-18.png?resize=300%2C290&amp;ssl=1 300w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman8-11-18.png?resize=768%2C744&amp;ssl=1 768w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman8-11-18.png?resize=700%2C678&amp;ssl=1 700w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman8-11-18.png?resize=413%2C400&amp;ssl=1 413w, https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/jobman8-11-18.png?w=1035&amp;ssl=1 1035w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>The trick will be ensuring the proper comparator with the numbering scheme, or at least instances where the comparitor uses the numbering scheme. The JobNumberingInterface could specify its own comparitor via injection with the method: public String getComparator().<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The MainJob Class stores the data regarding a Job but also issues subjob numbers. Similarly the JobDatabase issues the MainJob Numbers. The Job numbers follow a particular scheme. So the scheme could be injected into the JobDatabase removing the responsibility from the MainJob class.\u00a0 This will also impact on JobComparator class which will also have &hellip; <a href=\"https:\/\/fip.r-a-w.org\/?p=245\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Refactoring &#8211; Single Responsibility Principle (SRP) applied to JobMan<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":237,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_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}},"categories":[1],"tags":[],"class_list":["post-245","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/fip.r-a-w.org\/wp-content\/uploads\/2018\/11\/ANMC0003.jpg?fit=960%2C1200&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9NvWe-3X","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/posts\/245","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=245"}],"version-history":[{"count":4,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/posts\/245\/revisions"}],"predecessor-version":[{"id":254,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/posts\/245\/revisions\/254"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/media\/237"}],"wp:attachment":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}