{"action":"closed","number":89,"pull_request":{"url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls/89","id":90038299,"html_url":"https://github.com/CS2103AUG2016-W11-C1/main/pull/89","diff_url":"https://github.com/CS2103AUG2016-W11-C1/main/pull/89.diff","patch_url":"https://github.com/CS2103AUG2016-W11-C1/main/pull/89.patch","issue_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues/89","number":89,"state":"closed","locked":false,"title":"Refactor model classes","user":{"login":"yihangho","id":4226956,"avatar_url":"https://avatars.githubusercontent.com/u/4226956?v=3","gravatar_id":"","url":"https://api.github.com/users/yihangho","html_url":"https://github.com/yihangho","followers_url":"https://api.github.com/users/yihangho/followers","following_url":"https://api.github.com/users/yihangho/following{/other_user}","gists_url":"https://api.github.com/users/yihangho/gists{/gist_id}","starred_url":"https://api.github.com/users/yihangho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yihangho/subscriptions","organizations_url":"https://api.github.com/users/yihangho/orgs","repos_url":"https://api.github.com/users/yihangho/repos","events_url":"https://api.github.com/users/yihangho/events{/privacy}","received_events_url":"https://api.github.com/users/yihangho/received_events","type":"User","site_admin":false},"body":"Made some changes to the model classes:\r\n\r\n1. Since all our model classes are immutable, they should not have (public) mutable methods. I've updated all the mutation methods to return a new instance instead of mutating the properties in-place. For example, take a look at [`Task#markAsDone`](https://github.com/CS2103AUG2016-W11-C1/main/blob/d7425bce02f458b85412061d8b39e43c1d88253f/src/main/java/linenux/model/Task.java#L158-L162).\r\n\r\n2. Initially I said that we need to make deep copies of everything. I notice that this is actually not true. Since all model objects are immutable, there is no difference between a deep or shallow copy.\r\n\r\n3. Instead of implementing `copy*` method (for e.g., the [`Task#copyTask`](https://github.com/CS2103AUG2016-W11-C1/main/blob/d7425bce02f458b85412061d8b39e43c1d88253f/src/main/java/linenux/model/Task.java#L87-L98) method), I'm using copy constructors instead (for e.g., in [`Task`](https://github.com/CS2103AUG2016-W11-C1/main/blob/d7425bce02f458b85412061d8b39e43c1d88253f/src/main/java/linenux/model/Task.java#L87-L98)), which I think is more idiomatic.\r\n\r\n4. Instead of exposing several variations of task mutation methods (for e.g., [`Schedule#doneTask`](https://github.com/CS2103AUG2016-W11-C1/main/blob/2fe880fae625639c8421f7ab6db826bd88d0d84b/src/main/java/linenux/model/Schedule.java#L55-L62) and [`Schedule#addReminder`](https://github.com/CS2103AUG2016-W11-C1/main/blob/2fe880fae625639c8421f7ab6db826bd88d0d84b/src/main/java/linenux/model/Schedule.java#L64-L69)) on the `Schedule` and `State` tasks, I'm exposing exactly three mutation methods: [`addTask`](https://github.com/CS2103AUG2016-W11-C1/main/blob/d7425bce02f458b85412061d8b39e43c1d88253f/src/main/java/linenux/model/Schedule.java#L22-L27), [`updateTask`](https://github.com/CS2103AUG2016-W11-C1/main/blob/d7425bce02f458b85412061d8b39e43c1d88253f/src/main/java/linenux/model/Schedule.java#L29-L36), and [`deleteTask`](https://github.com/CS2103AUG2016-W11-C1/main/blob/d7425bce02f458b85412061d8b39e43c1d88253f/src/main/java/linenux/model/Schedule.java#L38-L45). Most of the previous mutation methods can be achieved using the `updateTask` method. For example, instead of calling `schedule.doneTask(task)`, now we call `schedule.updateTask(task, task.markAsDone())`. The benefit of doing this is twofold:\r\n\r\n    - The previous way of doing things is unscalable and repetitive. The reason is that for every possible mutation that we want to perform on the task object, we need to implement the corresponding method for `Schedule` and `State`.\r\n    - The previous API can become complicated and inscrutable very quickly. For example, when we implement the edit reminder command, we will need something like `schedule.editReminder(task, oldReminder, newReminder)`. Instead, I think it is clearer to do `schedule.updateTask(task, task.updateReminder(oldReminder, newReminder))`.\r\n\r\ntl;dr\r\n\r\n- Model objects should be immutable. All mutations should return a new instance and leaving the old one untouched.\r\n- We now have a standardized API for `Schedule` to perform mutation, which is the `updateTask` method. `updateTask` should be sufficient for all mutations, hence, do not implement other mutation methods on `Schedule` unless absolutely necessary.\r\n\r\n/cc @cadmusthefounder @Kaiiiii @Roahhh ","created_at":"2016-10-19T15:51:54Z","updated_at":"2016-10-20T04:03:51Z","closed_at":"2016-10-20T04:03:51Z","merged_at":"2016-10-20T04:03:51Z","merge_commit_sha":"b9f9e3e099df12940992bd47040d995c5c041335","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls/89/commits","review_comments_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls/89/comments","review_comment_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues/89/comments","statuses_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/statuses/d7425bce02f458b85412061d8b39e43c1d88253f","head":{"label":"CS2103AUG2016-W11-C1:refactor-model","ref":"refactor-model","sha":"d7425bce02f458b85412061d8b39e43c1d88253f","user":{"login":"CS2103AUG2016-W11-C1","id":22228691,"avatar_url":"https://avatars.githubusercontent.com/u/22228691?v=3","gravatar_id":"","url":"https://api.github.com/users/CS2103AUG2016-W11-C1","html_url":"https://github.com/CS2103AUG2016-W11-C1","followers_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/followers","following_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/following{/other_user}","gists_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/gists{/gist_id}","starred_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/subscriptions","organizations_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/orgs","repos_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/repos","events_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/events{/privacy}","received_events_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/received_events","type":"Organization","site_admin":false},"repo":{"id":68343033,"name":"main","full_name":"CS2103AUG2016-W11-C1/main","owner":{"login":"CS2103AUG2016-W11-C1","id":22228691,"avatar_url":"https://avatars.githubusercontent.com/u/22228691?v=3","gravatar_id":"","url":"https://api.github.com/users/CS2103AUG2016-W11-C1","html_url":"https://github.com/CS2103AUG2016-W11-C1","followers_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/followers","following_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/following{/other_user}","gists_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/gists{/gist_id}","starred_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/subscriptions","organizations_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/orgs","repos_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/repos","events_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/events{/privacy}","received_events_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CS2103AUG2016-W11-C1/main","description":"CS2103 project team W11-C1","fork":false,"url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main","forks_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/forks","keys_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/teams","hooks_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/hooks","issue_events_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues/events{/number}","events_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/events","assignees_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/assignees{/user}","branches_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/branches{/branch}","tags_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/tags","blobs_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/refs{/sha}","trees_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/statuses/{sha}","languages_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/languages","stargazers_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/stargazers","contributors_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/contributors","subscribers_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/subscribers","subscription_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/subscription","commits_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/commits{/sha}","git_commits_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/commits{/sha}","comments_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/comments{/number}","issue_comment_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues/comments{/number}","contents_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/contents/{+path}","compare_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/merges","archive_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/downloads","issues_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues{/number}","pulls_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls{/number}","milestones_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/milestones{/number}","notifications_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/labels{/name}","releases_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/releases{/id}","deployments_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/deployments","created_at":"2016-09-16T00:55:16Z","updated_at":"2016-10-12T04:32:15Z","pushed_at":"2016-10-20T04:03:51Z","git_url":"git://github.com/CS2103AUG2016-W11-C1/main.git","ssh_url":"git@github.com:CS2103AUG2016-W11-C1/main.git","clone_url":"https://github.com/CS2103AUG2016-W11-C1/main.git","svn_url":"https://github.com/CS2103AUG2016-W11-C1/main","homepage":null,"size":2112,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":31,"forks":1,"open_issues":31,"watchers":1,"default_branch":"master"}},"base":{"label":"CS2103AUG2016-W11-C1:master","ref":"master","sha":"2fe880fae625639c8421f7ab6db826bd88d0d84b","user":{"login":"CS2103AUG2016-W11-C1","id":22228691,"avatar_url":"https://avatars.githubusercontent.com/u/22228691?v=3","gravatar_id":"","url":"https://api.github.com/users/CS2103AUG2016-W11-C1","html_url":"https://github.com/CS2103AUG2016-W11-C1","followers_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/followers","following_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/following{/other_user}","gists_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/gists{/gist_id}","starred_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/subscriptions","organizations_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/orgs","repos_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/repos","events_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/events{/privacy}","received_events_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/received_events","type":"Organization","site_admin":false},"repo":{"id":68343033,"name":"main","full_name":"CS2103AUG2016-W11-C1/main","owner":{"login":"CS2103AUG2016-W11-C1","id":22228691,"avatar_url":"https://avatars.githubusercontent.com/u/22228691?v=3","gravatar_id":"","url":"https://api.github.com/users/CS2103AUG2016-W11-C1","html_url":"https://github.com/CS2103AUG2016-W11-C1","followers_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/followers","following_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/following{/other_user}","gists_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/gists{/gist_id}","starred_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/subscriptions","organizations_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/orgs","repos_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/repos","events_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/events{/privacy}","received_events_url":"https://api.github.com/users/CS2103AUG2016-W11-C1/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CS2103AUG2016-W11-C1/main","description":"CS2103 project team W11-C1","fork":false,"url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main","forks_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/forks","keys_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/teams","hooks_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/hooks","issue_events_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues/events{/number}","events_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/events","assignees_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/assignees{/user}","branches_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/branches{/branch}","tags_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/tags","blobs_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/refs{/sha}","trees_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/statuses/{sha}","languages_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/languages","stargazers_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/stargazers","contributors_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/contributors","subscribers_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/subscribers","subscription_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/subscription","commits_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/commits{/sha}","git_commits_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/git/commits{/sha}","comments_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/comments{/number}","issue_comment_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues/comments{/number}","contents_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/contents/{+path}","compare_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/merges","archive_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/downloads","issues_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues{/number}","pulls_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls{/number}","milestones_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/milestones{/number}","notifications_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/labels{/name}","releases_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/releases{/id}","deployments_url":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/deployments","created_at":"2016-09-16T00:55:16Z","updated_at":"2016-10-12T04:32:15Z","pushed_at":"2016-10-20T04:03:51Z","git_url":"git://github.com/CS2103AUG2016-W11-C1/main.git","ssh_url":"git@github.com:CS2103AUG2016-W11-C1/main.git","clone_url":"https://github.com/CS2103AUG2016-W11-C1/main.git","svn_url":"https://github.com/CS2103AUG2016-W11-C1/main","homepage":null,"size":2112,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":31,"forks":1,"open_issues":31,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls/89"},"html":{"href":"https://github.com/CS2103AUG2016-W11-C1/main/pull/89"},"issue":{"href":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues/89"},"comments":{"href":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/issues/89/comments"},"review_comments":{"href":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls/89/comments"},"review_comment":{"href":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/pulls/89/commits"},"statuses":{"href":"https://api.github.com/repos/CS2103AUG2016-W11-C1/main/statuses/d7425bce02f458b85412061d8b39e43c1d88253f"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"cadmusthefounder","id":13522866,"avatar_url":"https://avatars.githubusercontent.com/u/13522866?v=3","gravatar_id":"","url":"https://api.github.com/users/cadmusthefounder","html_url":"https://github.com/cadmusthefounder","followers_url":"https://api.github.com/users/cadmusthefounder/followers","following_url":"https://api.github.com/users/cadmusthefounder/following{/other_user}","gists_url":"https://api.github.com/users/cadmusthefounder/gists{/gist_id}","starred_url":"https://api.github.com/users/cadmusthefounder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cadmusthefounder/subscriptions","organizations_url":"https://api.github.com/users/cadmusthefounder/orgs","repos_url":"https://api.github.com/users/cadmusthefounder/repos","events_url":"https://api.github.com/users/cadmusthefounder/events{/privacy}","received_events_url":"https://api.github.com/users/cadmusthefounder/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":5,"additions":58,"deletions":135,"changed_files":8}}
{"actor":{"display_login":"cadmusthefounder"}}