{"action":"created","comment":{"url":"https://api.github.com/repos/artsy/artsy.github.io/pulls/comments/38831130","id":38831130,"diff_hunk":"@@ -0,0 +1,146 @@\n+---\n+layout: post\n+title: 'Cocoa Architecture: Dropped Design Patterns'\n+date: 2015-09-01T00:00:00.000Z\n+comments: false\n+categories:\n+  - ios\n+  - mobile\n+  - architecture\n+  - eigen\n+  - energy\n+author: Orta Therox\n+github-url: 'https://www.github.com/orta'\n+twitter-url: 'http://twitter.com/orta'\n+blog-url: 'http://orta.io'\n+---\n+\n+As a part of going through the design patterns we've found in the creation of the Artsy iOS apps, I'd like to talk a bit about some of the patterns that we've had and migrated away from. This is not 100% comprehensive, as there has been a lot of time, and a lot of people involved. Instead I'm going to try and give a birds eye view, and zoom in on some things that feel more important overall. \n+\n+It's important to preface that I don't believe in perfect code, or am I a fan of big re-writes. We can spot a bad pattern, but not do anything about it. We do have apps to ship, not a codebase to make perfect for the sake of technical purity.\n+\n+<!-- more -->\n+--------------------------------------------------------------------------------\n+\n+## NSNotifications as a decoupling method\n+\n+A lot of the initial codebase for eigen relied on using NSNotifications as a way of passing messages throughout the application. There were notifications for user settings changes, download status updates, anything related to authentication and the corresponding different error states and a few app features. These relied on sending global notifications with very little attempts at scoping the relationship between objects.\n+\n+NSNotificationCenter notifications are an implementation of the [Observer Pattern](https://en.wikipedia.org/wiki/Observer_pattern) in Cocoa. They are a beginner to intermediate programmers design paradigm dream. It offers a way to have objects send messages to each other without having to go through any real coupling. As someone just starting on iOS ( I had mostly been a OS X programmer before starting at Artsy ) it was an easy choice to adapt.","path":"_posts/2015-09-01-Cocoa-Architecture:-Dropped-Design-Patterns.markdown","position":29,"original_position":29,"commit_id":"2844904f3927610940367551657a825155ae13b2","original_commit_id":"2844904f3927610940367551657a825155ae13b2","user":{"login":"ashfurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=3","gravatar_id":"","url":"https://api.github.com/users/ashfurrow","html_url":"https://github.com/ashfurrow","followers_url":"https://api.github.com/users/ashfurrow/followers","following_url":"https://api.github.com/users/ashfurrow/following{/other_user}","gists_url":"https://api.github.com/users/ashfurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/ashfurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashfurrow/subscriptions","organizations_url":"https://api.github.com/users/ashfurrow/orgs","repos_url":"https://api.github.com/users/ashfurrow/repos","events_url":"https://api.github.com/users/ashfurrow/events{/privacy}","received_events_url":"https://api.github.com/users/ashfurrow/received_events","type":"User","site_admin":false},"body":"I had never considered NSNotificationCenter an implementation of the observer pattern, but I suppose you're right.\r\n\r\n\"intermediate programmers design\" -> \"intermediate programmer**'**s design\"","created_at":"2015-09-07T02:59:23Z","updated_at":"2015-09-07T02:59:23Z","html_url":"https://github.com/artsy/artsy.github.io/pull/150#discussion_r38831130","pull_request_url":"https://api.github.com/repos/artsy/artsy.github.io/pulls/150","_links":{"self":{"href":"https://api.github.com/repos/artsy/artsy.github.io/pulls/comments/38831130"},"html":{"href":"https://github.com/artsy/artsy.github.io/pull/150#discussion_r38831130"},"pull_request":{"href":"https://api.github.com/repos/artsy/artsy.github.io/pulls/150"}}},"pull_request":{"url":"https://api.github.com/repos/artsy/artsy.github.io/pulls/150","id":44315028,"html_url":"https://github.com/artsy/artsy.github.io/pull/150","diff_url":"https://github.com/artsy/artsy.github.io/pull/150.diff","patch_url":"https://github.com/artsy/artsy.github.io/pull/150.patch","issue_url":"https://api.github.com/repos/artsy/artsy.github.io/issues/150","number":150,"state":"open","locked":false,"title":"@ashfurrow => Cocoa arch dropped designs","user":{"login":"orta","id":49038,"avatar_url":"https://avatars.githubusercontent.com/u/49038?v=3","gravatar_id":"","url":"https://api.github.com/users/orta","html_url":"https://github.com/orta","followers_url":"https://api.github.com/users/orta/followers","following_url":"https://api.github.com/users/orta/following{/other_user}","gists_url":"https://api.github.com/users/orta/gists{/gist_id}","starred_url":"https://api.github.com/users/orta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orta/subscriptions","organizations_url":"https://api.github.com/users/orta/orgs","repos_url":"https://api.github.com/users/orta/repos","events_url":"https://api.github.com/users/orta/events{/privacy}","received_events_url":"https://api.github.com/users/orta/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/artsy/mobile/issues/50\r\n\r\nCovers some of the patterns we've moved away from over time.\r\n\r\n/cc @alloy if you want `@weakfiy` / `@strongify` in here, drop me some thoughts\r\n/cc @jorystiefel / @sarahscott for review too ","created_at":"2015-09-07T02:06:06Z","updated_at":"2015-09-07T02:59:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e954192f3c0a2960854d30a19ce208443ea0b57","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/artsy/artsy.github.io/pulls/150/commits","review_comments_url":"https://api.github.com/repos/artsy/artsy.github.io/pulls/150/comments","review_comment_url":"https://api.github.com/repos/artsy/artsy.github.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/artsy/artsy.github.io/issues/150/comments","statuses_url":"https://api.github.com/repos/artsy/artsy.github.io/statuses/2844904f3927610940367551657a825155ae13b2","head":{"label":"artsy:cocoa_arch_dropped_designs","ref":"cocoa_arch_dropped_designs","sha":"2844904f3927610940367551657a825155ae13b2","user":{"login":"artsy","id":546231,"avatar_url":"https://avatars.githubusercontent.com/u/546231?v=3","gravatar_id":"","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"repo":{"id":3114581,"name":"artsy.github.io","full_name":"artsy/artsy.github.io","owner":{"login":"artsy","id":546231,"avatar_url":"https://avatars.githubusercontent.com/u/546231?v=3","gravatar_id":"","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/artsy/artsy.github.io","description":"The Artsy Engineering Open-Source Developers Blog","fork":false,"url":"https://api.github.com/repos/artsy/artsy.github.io","forks_url":"https://api.github.com/repos/artsy/artsy.github.io/forks","keys_url":"https://api.github.com/repos/artsy/artsy.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/artsy/artsy.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/artsy/artsy.github.io/teams","hooks_url":"https://api.github.com/repos/artsy/artsy.github.io/hooks","issue_events_url":"https://api.github.com/repos/artsy/artsy.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/artsy/artsy.github.io/events","assignees_url":"https://api.github.com/repos/artsy/artsy.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/artsy/artsy.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/artsy/artsy.github.io/tags","blobs_url":"https://api.github.com/repos/artsy/artsy.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/artsy/artsy.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/artsy/artsy.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/artsy/artsy.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/artsy/artsy.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/artsy/artsy.github.io/languages","stargazers_url":"https://api.github.com/repos/artsy/artsy.github.io/stargazers","contributors_url":"https://api.github.com/repos/artsy/artsy.github.io/contributors","subscribers_url":"https://api.github.com/repos/artsy/artsy.github.io/subscribers","subscription_url":"https://api.github.com/repos/artsy/artsy.github.io/subscription","commits_url":"https://api.github.com/repos/artsy/artsy.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/artsy/artsy.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/artsy/artsy.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/artsy/artsy.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/artsy/artsy.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/artsy/artsy.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/artsy/artsy.github.io/merges","archive_url":"https://api.github.com/repos/artsy/artsy.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/artsy/artsy.github.io/downloads","issues_url":"https://api.github.com/repos/artsy/artsy.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/artsy/artsy.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/artsy/artsy.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/artsy/artsy.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/artsy/artsy.github.io/labels{/name}","releases_url":"https://api.github.com/repos/artsy/artsy.github.io/releases{/id}","created_at":"2012-01-06T00:31:22Z","updated_at":"2015-08-28T08:22:57Z","pushed_at":"2015-09-07T02:06:08Z","git_url":"git://github.com/artsy/artsy.github.io.git","ssh_url":"git@github.com:artsy/artsy.github.io.git","clone_url":"https://github.com/artsy/artsy.github.io.git","svn_url":"https://github.com/artsy/artsy.github.io","homepage":"http://artsy.github.io","size":41721,"stargazers_count":72,"watchers_count":72,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":47,"mirror_url":null,"open_issues_count":23,"forks":47,"open_issues":23,"watchers":72,"default_branch":"source"}},"base":{"label":"artsy:source","ref":"source","sha":"59fcbc22bea04c3646b3d4a1b4c97d9d9d81a5f6","user":{"login":"artsy","id":546231,"avatar_url":"https://avatars.githubusercontent.com/u/546231?v=3","gravatar_id":"","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"repo":{"id":3114581,"name":"artsy.github.io","full_name":"artsy/artsy.github.io","owner":{"login":"artsy","id":546231,"avatar_url":"https://avatars.githubusercontent.com/u/546231?v=3","gravatar_id":"","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/artsy/artsy.github.io","description":"The Artsy Engineering Open-Source Developers Blog","fork":false,"url":"https://api.github.com/repos/artsy/artsy.github.io","forks_url":"https://api.github.com/repos/artsy/artsy.github.io/forks","keys_url":"https://api.github.com/repos/artsy/artsy.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/artsy/artsy.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/artsy/artsy.github.io/teams","hooks_url":"https://api.github.com/repos/artsy/artsy.github.io/hooks","issue_events_url":"https://api.github.com/repos/artsy/artsy.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/artsy/artsy.github.io/events","assignees_url":"https://api.github.com/repos/artsy/artsy.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/artsy/artsy.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/artsy/artsy.github.io/tags","blobs_url":"https://api.github.com/repos/artsy/artsy.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/artsy/artsy.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/artsy/artsy.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/artsy/artsy.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/artsy/artsy.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/artsy/artsy.github.io/languages","stargazers_url":"https://api.github.com/repos/artsy/artsy.github.io/stargazers","contributors_url":"https://api.github.com/repos/artsy/artsy.github.io/contributors","subscribers_url":"https://api.github.com/repos/artsy/artsy.github.io/subscribers","subscription_url":"https://api.github.com/repos/artsy/artsy.github.io/subscription","commits_url":"https://api.github.com/repos/artsy/artsy.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/artsy/artsy.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/artsy/artsy.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/artsy/artsy.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/artsy/artsy.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/artsy/artsy.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/artsy/artsy.github.io/merges","archive_url":"https://api.github.com/repos/artsy/artsy.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/artsy/artsy.github.io/downloads","issues_url":"https://api.github.com/repos/artsy/artsy.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/artsy/artsy.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/artsy/artsy.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/artsy/artsy.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/artsy/artsy.github.io/labels{/name}","releases_url":"https://api.github.com/repos/artsy/artsy.github.io/releases{/id}","created_at":"2012-01-06T00:31:22Z","updated_at":"2015-08-28T08:22:57Z","pushed_at":"2015-09-07T02:06:08Z","git_url":"git://github.com/artsy/artsy.github.io.git","ssh_url":"git@github.com:artsy/artsy.github.io.git","clone_url":"https://github.com/artsy/artsy.github.io.git","svn_url":"https://github.com/artsy/artsy.github.io","homepage":"http://artsy.github.io","size":41721,"stargazers_count":72,"watchers_count":72,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":47,"mirror_url":null,"open_issues_count":23,"forks":47,"open_issues":23,"watchers":72,"default_branch":"source"}},"_links":{"self":{"href":"https://api.github.com/repos/artsy/artsy.github.io/pulls/150"},"html":{"href":"https://github.com/artsy/artsy.github.io/pull/150"},"issue":{"href":"https://api.github.com/repos/artsy/artsy.github.io/issues/150"},"comments":{"href":"https://api.github.com/repos/artsy/artsy.github.io/issues/150/comments"},"review_comments":{"href":"https://api.github.com/repos/artsy/artsy.github.io/pulls/150/comments"},"review_comment":{"href":"https://api.github.com/repos/artsy/artsy.github.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/artsy/artsy.github.io/pulls/150/commits"},"statuses":{"href":"https://api.github.com/repos/artsy/artsy.github.io/statuses/2844904f3927610940367551657a825155ae13b2"}}}}