{"action":"created","issue":{"url":"https://api.github.com/repos/freddyz/computerscare-vcv-modules/issues/2","repository_url":"https://api.github.com/repos/freddyz/computerscare-vcv-modules","labels_url":"https://api.github.com/repos/freddyz/computerscare-vcv-modules/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/freddyz/computerscare-vcv-modules/issues/2/comments","events_url":"https://api.github.com/repos/freddyz/computerscare-vcv-modules/issues/2/events","html_url":"https://github.com/freddyz/computerscare-vcv-modules/issues/2","id":361183788,"node_id":"MDU6SXNzdWUzNjExODM3ODg=","number":2,"title":"Code review","user":{"login":"david-c14","id":10398567,"node_id":"MDQ6VXNlcjEwMzk4NTY3","avatar_url":"https://avatars0.githubusercontent.com/u/10398567?v=4","gravatar_id":"","url":"https://api.github.com/users/david-c14","html_url":"https://github.com/david-c14","followers_url":"https://api.github.com/users/david-c14/followers","following_url":"https://api.github.com/users/david-c14/following{/other_user}","gists_url":"https://api.github.com/users/david-c14/gists{/gist_id}","starred_url":"https://api.github.com/users/david-c14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-c14/subscriptions","organizations_url":"https://api.github.com/users/david-c14/orgs","repos_url":"https://api.github.com/users/david-c14/repos","events_url":"https://api.github.com/users/david-c14/events{/privacy}","received_events_url":"https://api.github.com/users/david-c14/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-18T08:08:12Z","updated_at":"2018-09-18T23:10:37Z","closed_at":null,"author_association":"NONE","body":"Hi,  you asked for someone to look over your code and I said I would.\r\n\r\nIt all looks good to me in terms of efficiency and process.  I only have minor comments, one is inefficient but the rest are purely stylistic if you don't mind me mentioning them.\r\n\r\n1. In the PatchSequencer::step function you evaluate this \r\n\r\n```(int) clamp(roundf(params[STEPS_PARAM].value), 1.0f, 16.0f);```\r\n\r\nthree times. As far as I can see, you could do it just once, or you could use a SnapKnob to let the UI handle the rounding for you. \r\n\r\n2. You have a huge initialization section in the PatchSequencer module. You could keep that simpler; in c++ an initializer with insufficient items to fill the array causes the compiler to initialize any remaining values to defaults. In the case of bools and floats that would be zero. so you could do:\r\n\r\n``` bool switch_states[16][10][10] = {}; ```\r\n\r\nand that should be sufficient. If you don't provide any initializer at all, then the array will be uninitialized.\r\n\r\n3. In the PatchSequencer enums you have a mix of idioms. Some have the ENUMS macro to account for multiple items, and some have a more explicit x = y + 10 sort of thing.  Personally I would try to stick to one for clarity.\r\n\r\n4. Again the PatchSequencer has a huge number of occurrences of 10 and 16 as 'Magic Numbers'. General good practice would be to factor these out. There at least 3 approaches.\r\n\r\nMacros are generally simple, but these days frowned upon in c++ because their scope is uncontrolled.\r\n\r\nConst declarations would work here, and can be scoped to the ComputerscarePatchSequencer class.\r\n\r\nIf there is a possibility that you might want to make another patch sequencer with different dimensions, then you could consider using a template class. This is what I have done in my modules. There is a simple example of a templated module at [NG1.cpp](https://github.com/david-c14/SubmarineFree/blob/master/src/NG1.cpp). And a more complex example of a multi-dimensional device with templates for both the module and the moduleWidget at [AO1.cpp](https://github.com/david-c14/SubmarineFree/blob/master/src/AO1.cpp)\r\n  \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/freddyz/computerscare-vcv-modules/issues/comments/422588826","html_url":"https://github.com/freddyz/computerscare-vcv-modules/issues/2#issuecomment-422588826","issue_url":"https://api.github.com/repos/freddyz/computerscare-vcv-modules/issues/2","id":422588826,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjU4ODgyNg==","user":{"login":"freddyz","id":1319733,"node_id":"MDQ6VXNlcjEzMTk3MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/1319733?v=4","gravatar_id":"","url":"https://api.github.com/users/freddyz","html_url":"https://github.com/freddyz","followers_url":"https://api.github.com/users/freddyz/followers","following_url":"https://api.github.com/users/freddyz/following{/other_user}","gists_url":"https://api.github.com/users/freddyz/gists{/gist_id}","starred_url":"https://api.github.com/users/freddyz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freddyz/subscriptions","organizations_url":"https://api.github.com/users/freddyz/orgs","repos_url":"https://api.github.com/users/freddyz/repos","events_url":"https://api.github.com/users/freddyz/events{/privacy}","received_events_url":"https://api.github.com/users/freddyz/received_events","type":"User","site_admin":false},"created_at":"2018-09-18T23:10:37Z","updated_at":"2018-09-18T23:10:37Z","author_association":"OWNER","body":"@david-c14 thanks a lot for the suggestions and thorough explanations!  I really appreciate it!"}}
{"actor":{"display_login":"freddyz"}}