{"id":2478,"date":"2010-05-25T21:44:50","date_gmt":"2010-05-26T01:44:50","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=2478"},"modified":"2010-05-25T21:44:54","modified_gmt":"2010-05-26T01:44:54","slug":"testability-and-functional-programming","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2010\/05\/25\/testability-and-functional-programming\/","title":{"rendered":"Testability and Functional Programming"},"content":{"rendered":"<p><a href=\"http:\/\/www.erlang.org\/pipermail\/erlang-questions\/2009-February\/041969.html\">Christian Sunesson<\/a> (via <a href=\"http:\/\/delicious.com\/rentzsch\">Jonathan Rentzsch<\/a>):<\/p>\n<blockquote cite=\"http:\/\/www.erlang.org\/pipermail\/erlang-questions\/2009-February\/041969.html\"><p>The funny thing is that the OOP world have found one way to manage the complexity and the code-bases that grow ugly: They are using unit tests, and practice the art of writing testable code. [&#8230;] What they are doing is that they are making as much of their code as possible to be side-effect free and placing all that code in one method so it can be called from a unit test. They are concentrating side-effects to well-defined places, carefully avoiding mixing side-effects and testable\/test-worthy logic. What they are doing is that they're reinventing functional programming.<\/p><\/blockquote>\n<p>I think he&rsquo;s right. To a first approximation, code that&rsquo;s more functional is easier to get right, easier to test, and easier to maintain.<\/p>","protected":false},"excerpt":{"rendered":"<p>Christian Sunesson (via Jonathan Rentzsch): The funny thing is that the OOP world have found one way to manage the complexity and the code-bases that grow ugly: They are using unit tests, and practice the art of writing testable code. [&#8230;] What they are doing is that they are making as much of their code [&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":[],"class_list":["post-2478","post","type-post","status-publish","format-standard","hentry","category-programming-category"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/2478","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=2478"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/2478\/revisions"}],"predecessor-version":[{"id":2479,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/2478\/revisions\/2479"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=2478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=2478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=2478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}