{"id":8527,"date":"2014-03-06T12:56:04","date_gmt":"2014-03-06T17:56:04","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=8527"},"modified":"2014-03-07T15:39:05","modified_gmt":"2014-03-07T20:39:05","slug":"brents-persistence-layer","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/03\/06\/brents-persistence-layer\/","title":{"rendered":"Brent&rsquo;s Persistence Layer"},"content":{"rendered":"<p><a href=\"http:\/\/inessential.com\/2014\/03\/05\/starting_over\">Brent Simmons<\/a>:<\/p>\n<blockquote cite=\"http:\/\/inessential.com\/2014\/03\/05\/starting_over\"><p>Model objects live on the main thread. This makes it easy to use VSNote, VSTag, and so on in view controllers and in syncing.<\/p>\n<p>There is one exception: you can create a &ldquo;detached&rdquo; copy of a model object to use with API calls. A detached model object exists on one thread of execution only, is short-lived, and is disconnected from the database. Detached objects aren&rsquo;t a factor when it comes to concurrency.<\/p>\n<p>When a model object is added, changed, or deleted, updates to the database are placed in a background serial queue.<\/p><\/blockquote>\n<p>Update (2014-03-07): <a href=\"http:\/\/waffle.wootest.net\/2014\/03\/07\/hard-core\/\">Jesper<\/a>:<\/p>\n<blockquote cite=\"http:\/\/waffle.wootest.net\/2014\/03\/07\/hard-core\/\">\n<p>Of Apple&rsquo;s fixes&rsquo; own admission, Core Data sync didn&rsquo;t work because it was a black box with no ability to debug it. It would be unfair to zing Core Data at large with that epithet. But if it&rsquo;s something that seems true about Apple&rsquo;s frameworks, love them mostly as I do, it&rsquo;s that they&rsquo;re constructed as if to impress on their user how privileged they should feel because of the difficulty of the bar that they set to solve the problem at, and the complexity of implementation they have used to convincingly solve the problem.<\/p>\n<p>[&#8230;]<\/p>\n<p>Basic features are still painful for people that have been successful Cocoa coders for ten years. They&rsquo;re not sufficiently saved by the ripening of frameworks as much as by their own accumulated ingenuity. Cocoa is still being developed, features are added, but rarely does something hard get easier.<\/p><\/blockquote>\n<p><a href=\"http:\/\/inessential.com\/2014\/03\/06\/hard_core\">Brent Simmons<\/a>:<\/p>\n<blockquote cite=\"http:\/\/inessential.com\/2014\/03\/06\/hard_core\"><p>The second reason has to do with my enduring love of plain-ol&rsquo; Cocoa. I like regular Cocoa objects. I like being able to implement <code>NSCoding<\/code>, override <code>isEqual:<\/code> and <code>hash<\/code>, and design objects that can be created with a simple <code>init<\/code> (when possible and sensible). I <em>especially<\/em> like being able to do those things with model objects. (Which totally makes sense.)<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Brent Simmons: Model objects live on the main thread. This makes it easy to use VSNote, VSTag, and so on in view controllers and in syncing. There is one exception: you can create a &ldquo;detached&rdquo; copy of a model object to use with API calls. A detached model object exists on one thread of execution [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[109,594,31,71,425],"class_list":["post-8527","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-coredata","tag-fmdb","tag-ios","tag-programming","tag-sqlite"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=8527"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8527\/revisions"}],"predecessor-version":[{"id":8534,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8527\/revisions\/8534"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=8527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=8527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=8527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}