{"id":1945,"date":"2016-11-23T14:37:26","date_gmt":"2016-11-23T14:37:26","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1945"},"modified":"2016-11-23T14:37:26","modified_gmt":"2016-11-23T14:37:26","slug":"interface-or-implementation-which-comes-first","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/interface-or-implementation-which-comes-first\/","title":{"rendered":"interface or Implementation Which comes First"},"content":{"rendered":"<p><strong>Scenario 1<\/strong>:<br \/>\nIf you have a clear analysis and Design in UML then you can start with the interface.<\/p>\n<p><strong>Scenario 2<\/strong>:<br \/>\nThe interface shows up when you need to refactor common features out of several classes.Until you have multiple classes with common features, it&#8217;s hard to foresee what the interface should be.<\/p>\n<p><em>Write a class and extract interface later. Usually the reason for extracting an interface is the need for a second implementation of that interface (often as a mock for unit testing)<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scenario 1: If you have a clear analysis and Design in UML then you can start with the interface. Scenario 2: The interface shows up when you need to refactor common features out of several classes.Until you have multiple classes with common features, it&#8217;s hard to foresee what the interface should be. Write a class&hellip; <a href=\"https:\/\/codethataint.com\/blog\/interface-or-implementation-which-comes-first\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[162],"tags":[],"class_list":["post-1945","post","type-post","status-publish","format-standard","hentry","category-java-pearls"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=1945"}],"version-history":[{"count":1,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1945\/revisions"}],"predecessor-version":[{"id":1946,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1945\/revisions\/1946"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}