{"id":16710,"date":"2016-12-22T13:37:48","date_gmt":"2016-12-22T18:37:48","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=16710"},"modified":"2019-01-22T15:44:50","modified_gmt":"2019-01-22T20:44:50","slug":"cwlsignal-and-reactive-programming","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2016\/12\/22\/cwlsignal-and-reactive-programming\/","title":{"rendered":"CwlSignal and Reactive Programming"},"content":{"rendered":"<p><a href=\"https:\/\/www.cocoawithlove.com\/blog\/cwlsignal.html\">Matt Gallagher<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.cocoawithlove.com\/blog\/cwlsignal.html\"><p>The careful separation of &ldquo;input&rdquo; and &ldquo;output&rdquo; and the modelling of reactive programming as a channel is a distinguishing feature of CwlSignal. Other common implementations treat reactive programming as an implementation of the &ldquo;Observer&rdquo; pattern but this leads them to hide the input end of their channels or confusingly use types that are both input and output, when only an input interface is desired.<\/p>\n<p>[&#8230;]<\/p>\n<p>Unlike functional programming inspired transformation functions (e.g. <code>map<\/code>, <code>flatMap<\/code>), the fundamental <code>transform<\/code> in CwlSignal does not <em>return<\/em> its result but <code>send<\/code>s it into the <code>SignalNext<\/code> (interface equivalent to <code>SignalInput<\/code> for sending to the next <code>Signal<\/code> in the chain). This design allows you to emit any number of values or an error.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/www.cocoawithlove.com\/blog\/reactive-programming-what-and-why.html\">Matt Gallagher<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.cocoawithlove.com\/blog\/reactive-programming-what-and-why.html\">\n<p>In this article, I&rsquo;ll explain why I consider reactive programming to be one of the most important design patterns for application programming by looking at three scenarios that are common in application development, yet are a drain on development time, lead to frequent bugs and make design and refactoring hard. I&rsquo;ll show how reactive programming addresses the verbosity, eliminates the unsafety and restructures the code to aid maintainability.<\/p>\n<p>[&#8230;]<\/p>\n<p>The biggest advantage comes when you realize that in applying a solution to just one of these problems, you&rsquo;ve gained a solution to the other three for free.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Matt Gallagher: The careful separation of &ldquo;input&rdquo; and &ldquo;output&rdquo; and the modelling of reactive programming as a channel is a distinguishing feature of CwlSignal. Other common implementations treat reactive programming as an implementation of the &ldquo;Observer&rdquo; pattern but this leads them to hide the input end of their channels or confusingly use types that are [&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":"2019-01-22T20:44:52Z","apple_news_api_id":"9b31a102-dfaa-41fa-98e2-c78246c5c69e","apple_news_api_modified_at":"2019-01-22T20:44:55Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AmzGhAt-qQfqY4seCRsXGng","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":[69,31,30,74,71,341,816,901],"class_list":["post-16710","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-ios","tag-mac","tag-opensource","tag-programming","tag-reactivecocoa","tag-refactoring","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16710","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=16710"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16710\/revisions"}],"predecessor-version":[{"id":16711,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16710\/revisions\/16711"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=16710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=16710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=16710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}