{"id":31952,"date":"2021-03-22T15:49:13","date_gmt":"2021-03-22T19:49:13","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=31952"},"modified":"2021-03-22T15:49:13","modified_gmt":"2021-03-22T19:49:13","slug":"how-netnewswire-handles-threading","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/03\/22\/how-netnewswire-handles-threading\/","title":{"rendered":"How NetNewsWire Handles Threading"},"content":{"rendered":"<p><a href=\"https:\/\/inessential.com\/2021\/03\/20\/how_netnewswire_handles_threading\">Brent Simmons<\/a> (<a href=\"https:\/\/news.ycombinator.com\/item?id=26536423\">Hacker News<\/a>):<\/p>\n<blockquote cite=\"https:\/\/inessential.com\/2021\/03\/20\/how_netnewswire_handles_threading\"><p>Every notification and every callback happens on the main thread.<\/p>\n<p>Though a given object (or small system) may use a serial queue internally, it never, ever lets that fact leak out beyond its own boundaries.<\/p>\n<p>[&#8230;]<\/p>\n<p>Some developers I&rsquo;ve known seem to think that being good at concurrency makes them badass. Others seem to think that senior developers must be great at concurrency, and so they should be too.<\/p>\n<p>But what senior developers are good at is eliminating concurrency as much as possible by developing a simple, easy, consistent model to follow for the app and its components.<\/p>\n<p>[&#8230;]<\/p>\n<p>I know you&rsquo;re worried about blocking the main thread. But consider this: it&rsquo;s way easier to fix a main-thread-blocker than it is to fix a weird, intermittent bug or crash due to threading.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/inessential.com\/2021\/03\/21\/benefits_of_netnewswires_threading_model\">Brent Simmons<\/a>:<\/p>\n<blockquote cite=\"https:\/\/inessential.com\/2021\/03\/21\/benefits_of_netnewswires_threading_model\"><p>It also improves the experience of our developers, who can concentrate on the feature they&rsquo;re working on instead of on how the feature can live safely in a multithreaded universe.<\/p>\n\n<p>Best of all: nobody is spending time tracking down a maddening threading bug that never happens on their machine, and then implementing a speculative fix &mdash; only to find later that it&rsquo;s <em>not<\/em> the fix but now, actually, there&rsquo;s a new crashing bug, which might have been triggered by that &ldquo;fix&rdquo;&#8230; and so on, forever.<\/p>\n\n<p>Developer morale is important!<\/p>\n<\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/03\/16\/underused-and-overused-gcd-patterns\/\">Underused and Overused GCD Patterns<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2014\/03\/10\/api-design-the-main-thread-and-queues\/\">API Design, the Main Thread, and Queues<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Brent Simmons (Hacker News): Every notification and every callback happens on the main thread. Though a given object (or small system) may use a serial queue internally, it never, ever lets that fact leak out beyond its own boundaries. [&#8230;] Some developers I&rsquo;ve known seem to think that being good at concurrency makes them badass. [&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":"2021-03-22T19:49:17Z","apple_news_api_id":"03c39600-61a6-45d6-8fcc-1035b27b1ce2","apple_news_api_modified_at":"2021-03-22T19:49:17Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AA8OWAGGmRdaPzBA1snsc4g","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":[800,27,880,30,1891,392,71],"class_list":["post-31952","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-concurrency","tag-craft","tag-grand-central-dispatch-gcd","tag-mac","tag-macos-11-0","tag-netnewswire","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31952","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=31952"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31952\/revisions"}],"predecessor-version":[{"id":31953,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31952\/revisions\/31953"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=31952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=31952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=31952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}