{"action":"created","issue":{"url":"https://api.github.com/repos/PileProject/drive/issues/59","repository_url":"https://api.github.com/repos/PileProject/drive","labels_url":"https://api.github.com/repos/PileProject/drive/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/PileProject/drive/issues/59/comments","events_url":"https://api.github.com/repos/PileProject/drive/issues/59/events","html_url":"https://github.com/PileProject/drive/pull/59","id":192196112,"number":59,"title":"Standardize controllers","user":{"login":"tiwanari","id":2739915,"avatar_url":"https://avatars.githubusercontent.com/u/2739915?v=3","gravatar_id":"","url":"https://api.github.com/users/tiwanari","html_url":"https://github.com/tiwanari","followers_url":"https://api.github.com/users/tiwanari/followers","following_url":"https://api.github.com/users/tiwanari/following{/other_user}","gists_url":"https://api.github.com/users/tiwanari/gists{/gist_id}","starred_url":"https://api.github.com/users/tiwanari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiwanari/subscriptions","organizations_url":"https://api.github.com/users/tiwanari/orgs","repos_url":"https://api.github.com/users/tiwanari/repos","events_url":"https://api.github.com/users/tiwanari/events{/privacy}","received_events_url":"https://api.github.com/users/tiwanari/received_events","type":"User","site_admin":false},"labels":[{"id":246556874,"url":"https://api.github.com/repos/PileProject/drive/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":490730611,"url":"https://api.github.com/repos/PileProject/drive/labels/ready%20for%20review","name":"ready for review","color":"d93f0b","default":false}],"state":"open","locked":false,"assignee":{"login":"tiwanari","id":2739915,"avatar_url":"https://avatars.githubusercontent.com/u/2739915?v=3","gravatar_id":"","url":"https://api.github.com/users/tiwanari","html_url":"https://github.com/tiwanari","followers_url":"https://api.github.com/users/tiwanari/followers","following_url":"https://api.github.com/users/tiwanari/following{/other_user}","gists_url":"https://api.github.com/users/tiwanari/gists{/gist_id}","starred_url":"https://api.github.com/users/tiwanari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiwanari/subscriptions","organizations_url":"https://api.github.com/users/tiwanari/orgs","repos_url":"https://api.github.com/users/tiwanari/repos","events_url":"https://api.github.com/users/tiwanari/events{/privacy}","received_events_url":"https://api.github.com/users/tiwanari/received_events","type":"User","site_admin":false},"assignees":[{"login":"tiwanari","id":2739915,"avatar_url":"https://avatars.githubusercontent.com/u/2739915?v=3","gravatar_id":"","url":"https://api.github.com/users/tiwanari","html_url":"https://github.com/tiwanari","followers_url":"https://api.github.com/users/tiwanari/followers","following_url":"https://api.github.com/users/tiwanari/following{/other_user}","gists_url":"https://api.github.com/users/tiwanari/gists{/gist_id}","starred_url":"https://api.github.com/users/tiwanari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiwanari/subscriptions","organizations_url":"https://api.github.com/users/tiwanari/orgs","repos_url":"https://api.github.com/users/tiwanari/repos","events_url":"https://api.github.com/users/tiwanari/events{/privacy}","received_events_url":"https://api.github.com/users/tiwanari/received_events","type":"User","site_admin":false},{"login":"amiq11","id":3426676,"avatar_url":"https://avatars.githubusercontent.com/u/3426676?v=3","gravatar_id":"","url":"https://api.github.com/users/amiq11","html_url":"https://github.com/amiq11","followers_url":"https://api.github.com/users/amiq11/followers","following_url":"https://api.github.com/users/amiq11/following{/other_user}","gists_url":"https://api.github.com/users/amiq11/gists{/gist_id}","starred_url":"https://api.github.com/users/amiq11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amiq11/subscriptions","organizations_url":"https://api.github.com/users/amiq11/orgs","repos_url":"https://api.github.com/users/amiq11/repos","events_url":"https://api.github.com/users/amiq11/events{/privacy}","received_events_url":"https://api.github.com/users/amiq11/received_events","type":"User","site_admin":false},{"login":"myusak","id":5147779,"avatar_url":"https://avatars.githubusercontent.com/u/5147779?v=3","gravatar_id":"","url":"https://api.github.com/users/myusak","html_url":"https://github.com/myusak","followers_url":"https://api.github.com/users/myusak/followers","following_url":"https://api.github.com/users/myusak/following{/other_user}","gists_url":"https://api.github.com/users/myusak/gists{/gist_id}","starred_url":"https://api.github.com/users/myusak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myusak/subscriptions","organizations_url":"https://api.github.com/users/myusak/orgs","repos_url":"https://api.github.com/users/myusak/repos","events_url":"https://api.github.com/users/myusak/events{/privacy}","received_events_url":"https://api.github.com/users/myusak/received_events","type":"User","site_admin":false}],"milestone":null,"comments":10,"created_at":"2016-11-29T06:09:04Z","updated_at":"2016-12-18T13:48:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/PileProject/drive/pulls/59","html_url":"https://github.com/PileProject/drive/pull/59","diff_url":"https://github.com/PileProject/drive/pull/59.diff","patch_url":"https://github.com/PileProject/drive/pull/59.patch"},"body":"This PR standardizes the `MachineController` to make it has the union of its children's methods.\r\n\r\n## Background\r\nWe talked over the design of controllers again and again offline, and we had two options;\r\n\r\n- Make controllers for each machine (Nxt, Ev3, Pile, etc.) so that they have their specific methods (e.g., Pile Robot doesn't have `ColorSensor`, thus it doesn't have `getColorSensorValue` or something like that) and keep the `MachineController` as it is.\r\n- Make the common `MachineController` that has the union of methods of these controllers.\r\n\r\nThey actually have pros & cons and our opinions conflicted. But finally, at present, we decided to choose the latter.\r\n\r\n### Pros & Cons of the former\r\n#### Pros\r\n- Straightforward way and thus readable. This is very important for developers.\r\n- They can be easily tested.\r\n\r\n#### Cons\r\n- There will be many duplications of codes because these controllers use [our library](https://github.com/PileProject/drivecommand)'s `MachineBase` that provides the same interface to control machines (so, we will have very similar codes in blocks like [ForwardSecBlock](https://github.com/PileProject/drive/blob/develop/app/src/nxt/java/com/pileproject/drive/programming/visual/block/sequence/ForwardSecBlock.java) in each build variant) but we currently can't make the most of it because of the design.\r\n- It doesn't follow the design of [our library](https://github.com/PileProject/drivecommand). **But we can fix that of our library easily.**\r\n\r\n\r\n### Pros & Cons of the latter\r\n#### Pros\r\n- It follows the design of [our library](https://github.com/PileProject/drivecommand).\r\n- It commonizes the blocks through `MachineController` interface. Thus, it reduces the duplicated codes not only `*.java` but also `*.xml`. \r\n- Easy to maintain because the codes are unified. \r\n\r\n#### Cons\r\n- It is difficult to test each variant.\r\n- Not straightforward way. \r\n- Users can't know what kinds of methods each controller has, and make it worse, calling wrong methods lead to `RuntimeError` not `CompileError`.\r\n- Poor extensibility. We should add/remove a method to/from `MachineController` itself if new machines with new methods. So, maybe we should make an another layer for other machines something like `MachineController` -> `CarController`, `DroneController` (i.e., not use the `MachineController` as the current `NxtController`'s parent).\r\n\r\n## Why we chose the latter\r\nThis was a very difficult problem for us but we took the pros of the latter. Maintaining duplicated codes `*.java` and `*.xml` is very annoying and we can easily change our mind when a new type of machine comes if we keep the unified codes clean."},"comment":{"url":"https://api.github.com/repos/PileProject/drive/issues/comments/267822149","html_url":"https://github.com/PileProject/drive/pull/59#issuecomment-267822149","issue_url":"https://api.github.com/repos/PileProject/drive/issues/59","id":267822149,"user":{"login":"tiwanari","id":2739915,"avatar_url":"https://avatars.githubusercontent.com/u/2739915?v=3","gravatar_id":"","url":"https://api.github.com/users/tiwanari","html_url":"https://github.com/tiwanari","followers_url":"https://api.github.com/users/tiwanari/followers","following_url":"https://api.github.com/users/tiwanari/following{/other_user}","gists_url":"https://api.github.com/users/tiwanari/gists{/gist_id}","starred_url":"https://api.github.com/users/tiwanari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiwanari/subscriptions","organizations_url":"https://api.github.com/users/tiwanari/orgs","repos_url":"https://api.github.com/users/tiwanari/repos","events_url":"https://api.github.com/users/tiwanari/events{/privacy}","received_events_url":"https://api.github.com/users/tiwanari/received_events","type":"User","site_admin":false},"created_at":"2016-12-18T13:48:23Z","updated_at":"2016-12-18T13:48:23Z","body":"I applied your comments and fix a little. "}}
{"actor":{"display_login":"tiwanari"}}