{"action":"created","issue":{"url":"https://api.github.com/repos/johnpapa/angular-styleguide/issues/456","labels_url":"https://api.github.com/repos/johnpapa/angular-styleguide/issues/456/labels{/name}","comments_url":"https://api.github.com/repos/johnpapa/angular-styleguide/issues/456/comments","events_url":"https://api.github.com/repos/johnpapa/angular-styleguide/issues/456/events","html_url":"https://github.com/johnpapa/angular-styleguide/issues/456","id":97716323,"number":456,"title":"Single Responsibility of Services","user":{"login":"robrothedev","id":311788,"avatar_url":"https://avatars.githubusercontent.com/u/311788?v=3","gravatar_id":"","url":"https://api.github.com/users/robrothedev","html_url":"https://github.com/robrothedev","followers_url":"https://api.github.com/users/robrothedev/followers","following_url":"https://api.github.com/users/robrothedev/following{/other_user}","gists_url":"https://api.github.com/users/robrothedev/gists{/gist_id}","starred_url":"https://api.github.com/users/robrothedev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robrothedev/subscriptions","organizations_url":"https://api.github.com/users/robrothedev/orgs","repos_url":"https://api.github.com/users/robrothedev/repos","events_url":"https://api.github.com/users/robrothedev/events{/privacy}","received_events_url":"https://api.github.com/users/robrothedev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/johnpapa/angular-styleguide/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-28T14:10:25Z","updated_at":"2015-08-05T13:16:00Z","closed_at":"2015-08-05T12:32:29Z","body":"Very good information in this style guide.  I did have a question on services and single responsibility and how granular this needs to be.  For instance, I have video app with crud capabilities.  Initially my service structure is as follows:\r\n\r\n```javascript\r\n\r\n// videos.service.js\r\n(function() {\r\n\t\r\n\t'use strict';\r\n\r\n\tfunction Videos($http) {\r\n\t\tvar service = {\r\n\t\t\tgetVideos: getVideos,\r\n\t\t\tgetVideo: getVideo,\r\n\t\t\tsaveVideo: saveVideo,\r\n\t\t\tdeleteVideo: deleteVideo\r\n\t\t}\r\n\r\n\t\treturn service;\r\n\r\n\t\tfunction getVideos() {\r\n\t\t\t// return video list\r\n\t\t}\r\n\r\n\t\tfunction getVideo() {\r\n\t\t\t// return video by id\r\n\t\t}\r\n\r\n\t\tfunction saveVideo() {\r\n\t\t\t// add/edit video\r\n\t\t}\r\n\r\n\t\tfunction deleteVideo() {\r\n\t\t\t// delete video\r\n\t\t}\r\n\t}\r\n\r\n})();\r\n\r\n```\r\n\r\nWould it be better to separate out the functionality like this?\r\n\r\n```javascript\r\n\r\n// videos.service.js\r\n(function() {\r\n\t\r\n\t'use strict';\r\n\r\n\tfunction Videos($http) {\r\n\t\tvar service = {\r\n\t\t\tgetVideos: getVideos,\r\n\t\t\tgetVideo: getVideo\r\n\t\t}\r\n\r\n\t\treturn service;\r\n\r\n\t\tfunction getVideos() {\r\n\t\t\t// return video list\r\n\t\t}\r\n\r\n\t\tfunction getVideo() {\r\n\t\t\t// return video by id\r\n\t\t}\r\n\t}\r\n\r\n})();\r\n\r\n// videos_crud.service.js\r\n(function() {\r\n\t\r\n\t'use strict';\r\n\r\n\tfunction VideosCrud($http) {\r\n\t\tvar service = {\r\n\t\t\tsaveVideo: saveVideo,\r\n\t\t\tdeleteVideo: deleteVideo\r\n\t\t}\r\n\r\n\t\treturn service;\r\n\r\n\t\tfunction saveVideo() {\r\n\t\t\t// add/edit video\r\n\t\t}\r\n\r\n\t\tfunction deleteVideo() {\r\n\t\t\t// delete video\r\n\t\t}\r\n\t}\r\n\r\n})();\r\n```\r\n\r\nThis might come down to personal preference but thought I would get any insight someone might have regarding this.\r\n\r\nThanks for any suggestions."},"comment":{"url":"https://api.github.com/repos/johnpapa/angular-styleguide/issues/comments/127994164","html_url":"https://github.com/johnpapa/angular-styleguide/issues/456#issuecomment-127994164","issue_url":"https://api.github.com/repos/johnpapa/angular-styleguide/issues/456","id":127994164,"user":{"login":"robrothedev","id":311788,"avatar_url":"https://avatars.githubusercontent.com/u/311788?v=3","gravatar_id":"","url":"https://api.github.com/users/robrothedev","html_url":"https://github.com/robrothedev","followers_url":"https://api.github.com/users/robrothedev/followers","following_url":"https://api.github.com/users/robrothedev/following{/other_user}","gists_url":"https://api.github.com/users/robrothedev/gists{/gist_id}","starred_url":"https://api.github.com/users/robrothedev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robrothedev/subscriptions","organizations_url":"https://api.github.com/users/robrothedev/orgs","repos_url":"https://api.github.com/users/robrothedev/repos","events_url":"https://api.github.com/users/robrothedev/events{/privacy}","received_events_url":"https://api.github.com/users/robrothedev/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T13:15:59Z","updated_at":"2015-08-05T13:15:59Z","body":"@johnpapa Thanks for the input.  Got the clarification I needed."}}