{"action":"created","comment":{"url":"https://api.github.com/repos/clouway-incubator/testing/pulls/comments/74013601","id":74013601,"diff_hunk":"@@ -0,0 +1,40 @@\n+package task2;\n+\n+import java.util.Arrays;\n+\n+public class ArrayCiltivator {\n+\n+    public int getMinElement(int[] arr) {\n+        int min = arr[0];\n+        for (int i = 0; i < arr.length; i++) {\n+            if (min > arr[i]) {\n+                min = arr[i];\n+            }\n+        }\n+        return min;\n+    }\n+\n+    public int getSum(int[] arr) {\n+        int sum = 0;\n+        for (int i = 0; i < arr.length; i++) {\n+            sum += arr[i];\n+        }\n+        return sum;\n+    }\n+\n+    public void printArrayElements(int[] arr) {\n+        System.out.print(Arrays.toString(arr));\n+\n+\n+    }\n+\n+    public int[] reverseArray(int[] arr) {","path":"src/task2/ArrayCiltivator.java","position":31,"original_position":31,"commit_id":"a88805ac19541bf53f642088466416f8160754fa","original_commit_id":"a88805ac19541bf53f642088466416f8160754fa","user":{"login":"EmilGeorgiev","id":5961191,"avatar_url":"https://avatars.githubusercontent.com/u/5961191?v=3","gravatar_id":"","url":"https://api.github.com/users/EmilGeorgiev","html_url":"https://github.com/EmilGeorgiev","followers_url":"https://api.github.com/users/EmilGeorgiev/followers","following_url":"https://api.github.com/users/EmilGeorgiev/following{/other_user}","gists_url":"https://api.github.com/users/EmilGeorgiev/gists{/gist_id}","starred_url":"https://api.github.com/users/EmilGeorgiev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmilGeorgiev/subscriptions","organizations_url":"https://api.github.com/users/EmilGeorgiev/orgs","repos_url":"https://api.github.com/users/EmilGeorgiev/repos","events_url":"https://api.github.com/users/EmilGeorgiev/events{/privacy}","received_events_url":"https://api.github.com/users/EmilGeorgiev/received_events","type":"User","site_admin":false},"body":"There is a rule named \"rule of three\", which states: \r\n```\r\nRule of three is a code refactoring rule of thumb to decide when a replicated piece of code \r\nshould be replaced by a new procedure. It states that the code can be copied once, but that \r\nwhen the same code is used three times, it should be extracted into a new procedure. The rule \r\nwas introduced by Martin Fowler in Refactoring[1] and attributed to Don Roberts.\r\n```\r\nhttps://en.wikipedia.org/wiki/Rule_of_three_(computer_programming)\r\n\r\n\r\nSo in your case the duplicated pattern is looking like:\r\n```\r\npublic class A {\r\n   public void a(int[] array); \r\n   public void b(int[] array);\r\n   public void c(int[] array); \r\n}\r\n```\r\nAs you can see, all methods are accepting array which is duplicated. You can remove this duplication by moving the method dependency to a constructor dependency and your code will like: \r\n\r\n```java\r\npublic class Array {\r\n  private final int[] array;\r\n  public Array(int[] array) {\r\n      this.array = array;\r\n  }\r\n\r\n  public int getMinElement() {\r\n    ...\r\n  }\r\n  public int getSum() {\r\n    ...\r\n  }\r\n}\r\n```","created_at":"2016-08-09T07:57:02Z","updated_at":"2016-08-09T07:57:02Z","html_url":"https://github.com/clouway-incubator/testing/pull/13#discussion_r74013601","pull_request_url":"https://api.github.com/repos/clouway-incubator/testing/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/clouway-incubator/testing/pulls/comments/74013601"},"html":{"href":"https://github.com/clouway-incubator/testing/pull/13#discussion_r74013601"},"pull_request":{"href":"https://api.github.com/repos/clouway-incubator/testing/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/clouway-incubator/testing/pulls/13","id":79145225,"html_url":"https://github.com/clouway-incubator/testing/pull/13","diff_url":"https://github.com/clouway-incubator/testing/pull/13.diff","patch_url":"https://github.com/clouway-incubator/testing/pull/13.patch","issue_url":"https://api.github.com/repos/clouway-incubator/testing/issues/13","number":13,"state":"open","locked":false,"title":"Second task form testing:  test arrays cultivator","user":{"login":"qnislavnachev","id":20161493,"avatar_url":"https://avatars.githubusercontent.com/u/20161493?v=3","gravatar_id":"","url":"https://api.github.com/users/qnislavnachev","html_url":"https://github.com/qnislavnachev","followers_url":"https://api.github.com/users/qnislavnachev/followers","following_url":"https://api.github.com/users/qnislavnachev/following{/other_user}","gists_url":"https://api.github.com/users/qnislavnachev/gists{/gist_id}","starred_url":"https://api.github.com/users/qnislavnachev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qnislavnachev/subscriptions","organizations_url":"https://api.github.com/users/qnislavnachev/orgs","repos_url":"https://api.github.com/users/qnislavnachev/repos","events_url":"https://api.github.com/users/qnislavnachev/events{/privacy}","received_events_url":"https://api.github.com/users/qnislavnachev/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-28T06:52:31Z","updated_at":"2016-08-09T07:57:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3a9818a66e406dc9661b73b74bace4737be4c027","assignee":{"login":"EmilGeorgiev","id":5961191,"avatar_url":"https://avatars.githubusercontent.com/u/5961191?v=3","gravatar_id":"","url":"https://api.github.com/users/EmilGeorgiev","html_url":"https://github.com/EmilGeorgiev","followers_url":"https://api.github.com/users/EmilGeorgiev/followers","following_url":"https://api.github.com/users/EmilGeorgiev/following{/other_user}","gists_url":"https://api.github.com/users/EmilGeorgiev/gists{/gist_id}","starred_url":"https://api.github.com/users/EmilGeorgiev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmilGeorgiev/subscriptions","organizations_url":"https://api.github.com/users/EmilGeorgiev/orgs","repos_url":"https://api.github.com/users/EmilGeorgiev/repos","events_url":"https://api.github.com/users/EmilGeorgiev/events{/privacy}","received_events_url":"https://api.github.com/users/EmilGeorgiev/received_events","type":"User","site_admin":false},"assignees":[{"login":"EmilGeorgiev","id":5961191,"avatar_url":"https://avatars.githubusercontent.com/u/5961191?v=3","gravatar_id":"","url":"https://api.github.com/users/EmilGeorgiev","html_url":"https://github.com/EmilGeorgiev","followers_url":"https://api.github.com/users/EmilGeorgiev/followers","following_url":"https://api.github.com/users/EmilGeorgiev/following{/other_user}","gists_url":"https://api.github.com/users/EmilGeorgiev/gists{/gist_id}","starred_url":"https://api.github.com/users/EmilGeorgiev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmilGeorgiev/subscriptions","organizations_url":"https://api.github.com/users/EmilGeorgiev/orgs","repos_url":"https://api.github.com/users/EmilGeorgiev/repos","events_url":"https://api.github.com/users/EmilGeorgiev/events{/privacy}","received_events_url":"https://api.github.com/users/EmilGeorgiev/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/clouway-incubator/testing/pulls/13/commits","review_comments_url":"https://api.github.com/repos/clouway-incubator/testing/pulls/13/comments","review_comment_url":"https://api.github.com/repos/clouway-incubator/testing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clouway-incubator/testing/issues/13/comments","statuses_url":"https://api.github.com/repos/clouway-incubator/testing/statuses/a88805ac19541bf53f642088466416f8160754fa","head":{"label":"qnislavnachev:test2","ref":"test2","sha":"a88805ac19541bf53f642088466416f8160754fa","user":{"login":"qnislavnachev","id":20161493,"avatar_url":"https://avatars.githubusercontent.com/u/20161493?v=3","gravatar_id":"","url":"https://api.github.com/users/qnislavnachev","html_url":"https://github.com/qnislavnachev","followers_url":"https://api.github.com/users/qnislavnachev/followers","following_url":"https://api.github.com/users/qnislavnachev/following{/other_user}","gists_url":"https://api.github.com/users/qnislavnachev/gists{/gist_id}","starred_url":"https://api.github.com/users/qnislavnachev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qnislavnachev/subscriptions","organizations_url":"https://api.github.com/users/qnislavnachev/orgs","repos_url":"https://api.github.com/users/qnislavnachev/repos","events_url":"https://api.github.com/users/qnislavnachev/events{/privacy}","received_events_url":"https://api.github.com/users/qnislavnachev/received_events","type":"User","site_admin":false},"repo":{"id":64111425,"name":"testing","full_name":"qnislavnachev/testing","owner":{"login":"qnislavnachev","id":20161493,"avatar_url":"https://avatars.githubusercontent.com/u/20161493?v=3","gravatar_id":"","url":"https://api.github.com/users/qnislavnachev","html_url":"https://github.com/qnislavnachev","followers_url":"https://api.github.com/users/qnislavnachev/followers","following_url":"https://api.github.com/users/qnislavnachev/following{/other_user}","gists_url":"https://api.github.com/users/qnislavnachev/gists{/gist_id}","starred_url":"https://api.github.com/users/qnislavnachev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qnislavnachev/subscriptions","organizations_url":"https://api.github.com/users/qnislavnachev/orgs","repos_url":"https://api.github.com/users/qnislavnachev/repos","events_url":"https://api.github.com/users/qnislavnachev/events{/privacy}","received_events_url":"https://api.github.com/users/qnislavnachev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/qnislavnachev/testing","description":null,"fork":true,"url":"https://api.github.com/repos/qnislavnachev/testing","forks_url":"https://api.github.com/repos/qnislavnachev/testing/forks","keys_url":"https://api.github.com/repos/qnislavnachev/testing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qnislavnachev/testing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qnislavnachev/testing/teams","hooks_url":"https://api.github.com/repos/qnislavnachev/testing/hooks","issue_events_url":"https://api.github.com/repos/qnislavnachev/testing/issues/events{/number}","events_url":"https://api.github.com/repos/qnislavnachev/testing/events","assignees_url":"https://api.github.com/repos/qnislavnachev/testing/assignees{/user}","branches_url":"https://api.github.com/repos/qnislavnachev/testing/branches{/branch}","tags_url":"https://api.github.com/repos/qnislavnachev/testing/tags","blobs_url":"https://api.github.com/repos/qnislavnachev/testing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qnislavnachev/testing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qnislavnachev/testing/git/refs{/sha}","trees_url":"https://api.github.com/repos/qnislavnachev/testing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qnislavnachev/testing/statuses/{sha}","languages_url":"https://api.github.com/repos/qnislavnachev/testing/languages","stargazers_url":"https://api.github.com/repos/qnislavnachev/testing/stargazers","contributors_url":"https://api.github.com/repos/qnislavnachev/testing/contributors","subscribers_url":"https://api.github.com/repos/qnislavnachev/testing/subscribers","subscription_url":"https://api.github.com/repos/qnislavnachev/testing/subscription","commits_url":"https://api.github.com/repos/qnislavnachev/testing/commits{/sha}","git_commits_url":"https://api.github.com/repos/qnislavnachev/testing/git/commits{/sha}","comments_url":"https://api.github.com/repos/qnislavnachev/testing/comments{/number}","issue_comment_url":"https://api.github.com/repos/qnislavnachev/testing/issues/comments{/number}","contents_url":"https://api.github.com/repos/qnislavnachev/testing/contents/{+path}","compare_url":"https://api.github.com/repos/qnislavnachev/testing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qnislavnachev/testing/merges","archive_url":"https://api.github.com/repos/qnislavnachev/testing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qnislavnachev/testing/downloads","issues_url":"https://api.github.com/repos/qnislavnachev/testing/issues{/number}","pulls_url":"https://api.github.com/repos/qnislavnachev/testing/pulls{/number}","milestones_url":"https://api.github.com/repos/qnislavnachev/testing/milestones{/number}","notifications_url":"https://api.github.com/repos/qnislavnachev/testing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qnislavnachev/testing/labels{/name}","releases_url":"https://api.github.com/repos/qnislavnachev/testing/releases{/id}","deployments_url":"https://api.github.com/repos/qnislavnachev/testing/deployments","created_at":"2016-07-25T07:02:44Z","updated_at":"2016-04-13T13:22:26Z","pushed_at":"2016-08-08T12:16:17Z","git_url":"git://github.com/qnislavnachev/testing.git","ssh_url":"git@github.com:qnislavnachev/testing.git","clone_url":"https://github.com/qnislavnachev/testing.git","svn_url":"https://github.com/qnislavnachev/testing","homepage":null,"size":18,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"clouway-incubator:master","ref":"master","sha":"9cec8bb9217bb6641ccf7514be6e2621e03ee4d4","user":{"login":"clouway-incubator","id":10173098,"avatar_url":"https://avatars.githubusercontent.com/u/10173098?v=3","gravatar_id":"","url":"https://api.github.com/users/clouway-incubator","html_url":"https://github.com/clouway-incubator","followers_url":"https://api.github.com/users/clouway-incubator/followers","following_url":"https://api.github.com/users/clouway-incubator/following{/other_user}","gists_url":"https://api.github.com/users/clouway-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/clouway-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clouway-incubator/subscriptions","organizations_url":"https://api.github.com/users/clouway-incubator/orgs","repos_url":"https://api.github.com/users/clouway-incubator/repos","events_url":"https://api.github.com/users/clouway-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/clouway-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":56153702,"name":"testing","full_name":"clouway-incubator/testing","owner":{"login":"clouway-incubator","id":10173098,"avatar_url":"https://avatars.githubusercontent.com/u/10173098?v=3","gravatar_id":"","url":"https://api.github.com/users/clouway-incubator","html_url":"https://github.com/clouway-incubator","followers_url":"https://api.github.com/users/clouway-incubator/followers","following_url":"https://api.github.com/users/clouway-incubator/following{/other_user}","gists_url":"https://api.github.com/users/clouway-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/clouway-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clouway-incubator/subscriptions","organizations_url":"https://api.github.com/users/clouway-incubator/orgs","repos_url":"https://api.github.com/users/clouway-incubator/repos","events_url":"https://api.github.com/users/clouway-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/clouway-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/clouway-incubator/testing","description":"","fork":false,"url":"https://api.github.com/repos/clouway-incubator/testing","forks_url":"https://api.github.com/repos/clouway-incubator/testing/forks","keys_url":"https://api.github.com/repos/clouway-incubator/testing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clouway-incubator/testing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clouway-incubator/testing/teams","hooks_url":"https://api.github.com/repos/clouway-incubator/testing/hooks","issue_events_url":"https://api.github.com/repos/clouway-incubator/testing/issues/events{/number}","events_url":"https://api.github.com/repos/clouway-incubator/testing/events","assignees_url":"https://api.github.com/repos/clouway-incubator/testing/assignees{/user}","branches_url":"https://api.github.com/repos/clouway-incubator/testing/branches{/branch}","tags_url":"https://api.github.com/repos/clouway-incubator/testing/tags","blobs_url":"https://api.github.com/repos/clouway-incubator/testing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clouway-incubator/testing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clouway-incubator/testing/git/refs{/sha}","trees_url":"https://api.github.com/repos/clouway-incubator/testing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clouway-incubator/testing/statuses/{sha}","languages_url":"https://api.github.com/repos/clouway-incubator/testing/languages","stargazers_url":"https://api.github.com/repos/clouway-incubator/testing/stargazers","contributors_url":"https://api.github.com/repos/clouway-incubator/testing/contributors","subscribers_url":"https://api.github.com/repos/clouway-incubator/testing/subscribers","subscription_url":"https://api.github.com/repos/clouway-incubator/testing/subscription","commits_url":"https://api.github.com/repos/clouway-incubator/testing/commits{/sha}","git_commits_url":"https://api.github.com/repos/clouway-incubator/testing/git/commits{/sha}","comments_url":"https://api.github.com/repos/clouway-incubator/testing/comments{/number}","issue_comment_url":"https://api.github.com/repos/clouway-incubator/testing/issues/comments{/number}","contents_url":"https://api.github.com/repos/clouway-incubator/testing/contents/{+path}","compare_url":"https://api.github.com/repos/clouway-incubator/testing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clouway-incubator/testing/merges","archive_url":"https://api.github.com/repos/clouway-incubator/testing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clouway-incubator/testing/downloads","issues_url":"https://api.github.com/repos/clouway-incubator/testing/issues{/number}","pulls_url":"https://api.github.com/repos/clouway-incubator/testing/pulls{/number}","milestones_url":"https://api.github.com/repos/clouway-incubator/testing/milestones{/number}","notifications_url":"https://api.github.com/repos/clouway-incubator/testing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clouway-incubator/testing/labels{/name}","releases_url":"https://api.github.com/repos/clouway-incubator/testing/releases{/id}","deployments_url":"https://api.github.com/repos/clouway-incubator/testing/deployments","created_at":"2016-04-13T13:22:26Z","updated_at":"2016-04-13T13:22:26Z","pushed_at":"2016-08-08T14:28:30Z","git_url":"git://github.com/clouway-incubator/testing.git","ssh_url":"git@github.com:clouway-incubator/testing.git","clone_url":"https://github.com/clouway-incubator/testing.git","svn_url":"https://github.com/clouway-incubator/testing","homepage":null,"size":136,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":4,"forks":7,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clouway-incubator/testing/pulls/13"},"html":{"href":"https://github.com/clouway-incubator/testing/pull/13"},"issue":{"href":"https://api.github.com/repos/clouway-incubator/testing/issues/13"},"comments":{"href":"https://api.github.com/repos/clouway-incubator/testing/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/clouway-incubator/testing/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/clouway-incubator/testing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clouway-incubator/testing/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/clouway-incubator/testing/statuses/a88805ac19541bf53f642088466416f8160754fa"}}}}
{"actor":{"display_login":"EmilGeorgiev"}}