{"action":"created","issue":{"url":"https://api.github.com/repos/e-conomic/swift-course/issues/66","labels_url":"https://api.github.com/repos/e-conomic/swift-course/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/e-conomic/swift-course/issues/66/comments","events_url":"https://api.github.com/repos/e-conomic/swift-course/issues/66/events","html_url":"https://github.com/e-conomic/swift-course/pull/66","id":110899373,"number":66,"title":"Assignment 2 - late ","user":{"login":"opolo","id":13970882,"avatar_url":"https://avatars.githubusercontent.com/u/13970882?v=3","gravatar_id":"","url":"https://api.github.com/users/opolo","html_url":"https://github.com/opolo","followers_url":"https://api.github.com/users/opolo/followers","following_url":"https://api.github.com/users/opolo/following{/other_user}","gists_url":"https://api.github.com/users/opolo/gists{/gist_id}","starred_url":"https://api.github.com/users/opolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opolo/subscriptions","organizations_url":"https://api.github.com/users/opolo/orgs","repos_url":"https://api.github.com/users/opolo/repos","events_url":"https://api.github.com/users/opolo/events{/privacy}","received_events_url":"https://api.github.com/users/opolo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-12T02:26:01Z","updated_at":"2015-10-12T10:20:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/e-conomic/swift-course/pulls/66","html_url":"https://github.com/e-conomic/swift-course/pull/66","diff_url":"https://github.com/e-conomic/swift-course/pull/66.diff","patch_url":"https://github.com/e-conomic/swift-course/pull/66.patch"},"body":"My humble suggestion for an answer at assignment 2! I am sorry with the late hand-in, and I am totally cool if you do not check it and give feedback - after all, you have a time schedule to adhere to as well. To not go too deep into excuses: I have been busy with another project at university that I couldn't avoid really taking all my time, sorry. \r\n(To go more wordy into the excuse, because I want to cry/whine: I have taken a course, advanced digital electronics, without having had the beginner, novice or expert course prior to that course.. I have only 15 ECTS this semester, so I thought I had room for a challenge, and was pretty cocky.... Oooh how I have gotten my punishment for that... ) \r\n\r\n\r\nRegarding the assignment: I don't really have much to comment on in this one, it was pretty straightforward... There are a few things worth commenting on though never the less, so here goes:\r\n\r\n- I admit, it was a biit cheesy way of handling parentheses. The parentheses work, and there is far less spamming of them than if no caution against them was taking, but the spamming of unneeded parentheses is not completely filtered out. What I did was that I added a filter, so now there are only parentheses around the \"-\" and \"+\" binary operations, and not around \"*\" and \"/\". The reason for this is that the operators \"*\" and \"/\" has the highest precedence of the operators in my, so there are natural parentheses around them. Again, its cheesy as its not perfect, but for one line of code, it was a pretty good result.\r\n\r\n- When I added my variable storing/loading buttons (i.e. M and ->M), ->M did not update my display to begin with. The reason for this is that I update my display every time something is changed in the stack of calculations via event notifications. ->M provided a loophole there, as it did not change my queued calculations, yet could still change the result of the calculations that was queued. It was pretty easy to fix - I only had to call the calculatorbrain’s function \"evaluate\" and assign the value to the display, whenever I pushed that button. This could be done in one line of code. However, I was thinking another way of doing it, could have been by adding a new event, which was triggered each time a variables value was changed, and then observe for that event (in other words, I could with do VariableValues what I had done already with the opStack). However, I actually did not like doing it. My issue with it is: I do not really know the stance in MVC/Swift on event/notifications, and how often they are used. I know that in MVC, the model should know nothing about the controller (as its GUI independent). Therefore if the model changes something that is relevant for the controller, one way of communicating it could be via notifications to “unknown” observers. However I feel that if I follow that approach, I might end up making notifications for every single little thing in the model, which the controller can then listen for, and then the model ends up being cluttered anyway. Is the general idea to use as little event/notifications as possible then, or is it just how changes in the model are usually communicated to the controller? (of course in our calculator, I knew when the state of the model would change, so I could avoid notifications there). I hope you get what I’m wondering - It was a bit hard to put into words.   \r\n\r\n\r\nI guess that was about it! :) See you next tuesday! \r\n"},"comment":{"url":"https://api.github.com/repos/e-conomic/swift-course/issues/comments/147358875","html_url":"https://github.com/e-conomic/swift-course/pull/66#issuecomment-147358875","issue_url":"https://api.github.com/repos/e-conomic/swift-course/issues/66","id":147358875,"user":{"login":"AndersHqst","id":499290,"avatar_url":"https://avatars.githubusercontent.com/u/499290?v=3","gravatar_id":"","url":"https://api.github.com/users/AndersHqst","html_url":"https://github.com/AndersHqst","followers_url":"https://api.github.com/users/AndersHqst/followers","following_url":"https://api.github.com/users/AndersHqst/following{/other_user}","gists_url":"https://api.github.com/users/AndersHqst/gists{/gist_id}","starred_url":"https://api.github.com/users/AndersHqst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndersHqst/subscriptions","organizations_url":"https://api.github.com/users/AndersHqst/orgs","repos_url":"https://api.github.com/users/AndersHqst/repos","events_url":"https://api.github.com/users/AndersHqst/events{/privacy}","received_events_url":"https://api.github.com/users/AndersHqst/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T10:20:54Z","updated_at":"2015-10-12T10:20:54Z","body":"@sualitu @ssnielsen any of you who has time to take a look at this before tomorrow?"}}