{"id":148,"date":"2023-05-17T00:02:55","date_gmt":"2023-05-16T16:02:55","guid":{"rendered":"http:\/\/ones.software\/blog\/?p=148"},"modified":"2023-07-26T17:46:57","modified_gmt":"2023-07-26T09:46:57","slug":"clean-architecture-001","status":"publish","type":"post","link":"https:\/\/ones.software\/code\/zh\/clean-architecture-001\/","title":{"rendered":"\u8edf\u4ef6\u5169\u7a2e\u50f9\u503c\u7684\u722d\u6301"},"content":{"rendered":"\n\t\t\t\t\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u8edf\u4ef6\u5de5\u7a0b\u5e2b\u61c9\u8a72\u5805\u5b88\u7684\u50f9\u503c<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/cdn-images-1.medium.com\/max\/1800\/0*SnA9QtVIdebZxY22\" alt=\"\"\/><figcaption>Photo by <a href=\"https:\/\/unsplash.com\/@austindistel?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Austin Distel<\/a> on&nbsp;<a href=\"https:\/\/unsplash.com?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u300c<a href=\"https:\/\/medium.com\/ones-publication\/software-development-001-923b28d858ed\" rel=\"noreferrer noopener\" target=\"_blank\">Code \u5beb\u5f97\u597d\u5c0d\u516c\u53f8\u6709\u7528\u55ce\uff1f<\/a>\u300d\u9019\u4e00\u7bc7\u6211\u5011\u8ac7\u5230Martin Fowler\u5982\u4f55\u5206\u6790\u8edf\u4ef6\u8cea\u7d20\u548c\u958b\u767c\u6642\u9593\u7684\u5169\u96e3\uff0c\u9019\u6b21\u5c31\u8b93\u6211\u5011\u770b\u770bRobert C. Martin \u5728\u5176\u8fd1\u4f5c\u300aClean Architecture: A Craftsman\u2019s Guide to Software Structure and Design\u300b\u5c0d\u65bc\u8edf\u4ef6\u958b\u767c\u6642\uff0c\u8edf\u4ef6\u5de5\u7a0b\u5e2b\u6240\u9762\u5c0d\u7684\u96e3\u984c\u3002<\/p>\n\n\n\n<p>\u9084\u539f\u57fa\u672c\u6b65\uff0c\u8edf\u4ef6\u672c\u8eab\u7a76\u7adf\u5c0d\u65bc\u8edf\u4ef6\u7684\u6301\u4efd\u8005\u6709\u4f55\u50f9\u503c\uff1fRobert C. Martin\u8a8d\u70ba\u4e3b\u8981\u6709\u5169\u7a2e\uff1a\u884c\u70ba\u50f9\u503c\uff08Behavior\uff09\u548c\u7d50\u69cb\u50f9\u503c\uff08Structure\uff09\u3002<\/p>\n\n\n\n<p>\u884c\u70ba\u50f9\u503c\uff0c\u610f\u601d\u5373\u662f\u8edf\u4ef6\u672c\u8eab\u7684\u7528\u9014\u3002\u9996\u5148\u8edf\u4ef6\u6703\u88ab\u8a2d\u8a08\u6210\u4f7f\u5f97\u67d0\u500b\u6a5f\u5668\u4ee5\u6307\u5b9a\u7684\u65b9\u5f0f\u904b\u4f5c\uff0c\u4e26\u56e0\u800c\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u65b9\u5275\u9020\u6216\u63d0\u9ad8\u5229\u6f64\u3002\u800c\u8edf\u4ef6\u5de5\u7a0b\u5e2b\u5247\u662f\u8ca0\u8cac\u5e6b\u52a9\u7cfb\u7d71\u7684\u4f7f\u7528\u8005\u5efa\u7acb\u4e00\u5957\u5c0d\u65bc\u9019\u500b\u8edf\u4ef6\u7cfb\u7d71\u7684\u529f\u80fd\u5b9a\u7fa9\uff08functional specification\uff09\uff0c\u6216\u8005\u662f\u5176\u9700\u6c42\u6587\u6a94\uff08requirements document\uff09\uff0c\u7136\u5f8c\u7de8\u5beb\u76f8\u61c9\u7684\u7a0b\u5f0f\u4f7f\u5f97\u6a5f\u5668\u80fd\u5920\u7b26\u5408\u9019\u4e9b\u8981\u6c42\u3001\u5b9a\u7fa9\u3002\u800c\u7576\u7a0b\u5f0f\u7684\u904b\u4f5c\u4e0d\u7b26\u8981\u6c42\uff0c\u8edf\u4ef6\u5de5\u7a0b\u5e2b\u5c31\u8981\u8ca0\u8cac\u9664\u932f\uff0c\u4e26\u89e3\u6c7a\u554f\u984c\u3002<\/p>\n\n\n\n<p>\u7d50\u69cb\u50f9\u503c\uff0c\u610f\u601d\u5373\u662f\u8edf\u4ef6\u7684\u9748\u6d3b\u5ea6\u3002\u8edf\u4ef6\u4e4b\u6240\u70ba\u300c\u8edf\u300d\u4ef6\uff0c\u7686\u56e0\u5176\u67d4\u8edf\uff0c\u4fdd\u6301\u9748\u6d3b\uff0c\u5bb9\u6613\u88ab\u6539\u8b8a\uff0c\u5426\u5247\u5c31\u548c\u786c\u4ef6\u7121\u7570\u3002\u8edf\u4ef6\u672c\u8eab\u7528\u610f\u5728\u65bc\u80fd\u5920\u901a\u904e\u4e00\u7a2e\u65b9\u5f0f\uff0c\u8f15\u6613\u8f49\u8b8a\u6a5f\u5668\u7684\u884c\u70ba\u3002<\/p>\n\n\n\n<h4>\u6539\u8b8a\u7684\u5be6\u884c<\/h4>\n\n\n\n<p>\u5f88\u591a\u6642\u8edf\u4ef6\u5de5\u7a0b\u5e2b\u4ee5\u70ba\u81ea\u5df1\u53ea\u9700\u8981\u61c9\u4ed8\u884c\u70ba\u50f9\u503c\uff0c\u6309\u7167\u9700\u6c42\u7de8\u5beb\u7a0b\u5f0f\uff0c\u4e26\u6301\u7e8c\u6539\u932f\u624d\u53ef\u4ee5\uff0c\u4f46\u73fe\u5be6\u4e26\u975e\u5982\u6b64\u3002<\/p>\n\n\n\n<p>\u5c0d\u65bc\u8edf\u4ef6\u7684\u6301\u4efd\u8005\u4f86\u8aaa\uff0c\u4ed6\u5011\u6240\u63d0\u51fa\u7684\u4e00\u7cfb\u5217\u6539\u8b8a\u7684\u7bc4\u570d\u90fd\u662f\u5927\u6982\u985e\u4f3c\u7684\u3002\u4f46\u5728\u8edf\u4ef6\u5de5\u7a0b\u5e2b\u4f86\u8aaa\uff0c\u8655\u7406\u6301\u4efd\u8005\u7684\u6539\u8b8a\u5c31\u5982\u8981\u6301\u7e8c\u5c07\u4e00\u5806\u62fc\u5716\u584a\uff0c\u62fc\u5230\u540c\u4e00\u500b\u6108\u8b8a\u8907\u96dc\u7684\u62fc\u5716\u88cf\u3002Robert C. Martin\u6bd4\u55bb\u70ba\u5c07\u65b9\u5f62\u7684\u87ba\u7d72\u64f0\u9032\u5713\u5f62\u7684\u87ba\u7d72\u5b54\u88cf\uff0c\u56e0\u70ba\u73fe\u6709\u7684\u7cfb\u7d71\u7684\u300c\u5f62\u72c0\u300d\uff08shape\uff09\u4e0d\u6703\u548c\u8981\u6c42\u7684\u300c\u5f62\u72c0\u300d\u76f8\u540c\u3002<\/p>\n\n\n\n<p>\u6539\u8b8a\u7684\u7bc4\u570d\u548c\u300c\u5f62\u72c0\u300d\u4e4b\u9593\u7684\u5206\u5225\uff0c\u5f88\u591a\u6642\u5c31\u6210\u70ba\u5f71\u97ff\u8edf\u4ef6\u6210\u672c\u7684\u95dc\u9375\u3002\u6709\u6642\u6539\u8b8a\u7684\u6210\u672c\u6bd4\u4f8b\u6703\u9060\u9060\u5927\u65bc\u6240\u9700\u6539\u8b8a\u7684\u5927\u5c0f\uff0c\u4ea6\u4ee4\u958b\u767c\u6210\u672c\u5e74\u5e74\u905e\u589e\u3002<\/p>\n\n\n\n<p>\u6539\u8b8a\u7684\u96e3\u5ea6\u7406\u61c9\u53ea\u8207\u6539\u8b8a\u7684\u7bc4\u570d\uff08scope\uff09\u6709\u95dc\uff0c\u800c\u975e\u8207\u6539\u8b8a\u7684\u300c\u5f62\u72c0\u300d\u6709\u95dc\uff0c\u800c\u9019\u727d\u6d89\u5230\u7cfb\u7d71\u7684\u67b6\u69cb\u8a2d\u8a08\u3002\u56e0\u70ba\u53ea\u8981\u67b6\u69cb\u8a2d\u8a08\u50be\u5411\u4e00\u7a2e\u300c\u5f62\u72c0\u300d\uff0c\u90a3\u9ebc\u65b0\u7684\u8981\u6c42\u5c31\u66f4\u96e3\u5f97\u4ee5\u5be6\u65bd\u3002<\/p>\n\n\n\n<h4>\u5169\u7a2e\u50f9\u503c\u7684\u722d\u6301<\/h4>\n\n\n\n<p>\u90a3\u9ebc\uff0c\u9019\u5169\u7a2e\u50f9\u503c\u5982\u4f55\u53d6\u6368\uff1f\u7cfb\u7d71\u80fd\u5920\u904b\u4f5c\u91cd\u8981\uff0c\u9084\u662f\u7cfb\u7d71\u80fd\u5920\u8f15\u6613\u6539\u8b8a\u91cd\u8981\uff1f<\/p>\n\n\n\n<p>\u5982\u679c\u554f\u4e00\u500b\u696d\u52d9\u90e8\u7d93\u7406\uff0c\u7b54\u6848\u81ea\u4e0d\u7136\u662f\u524d\u8005\uff0c\u4e26\u8a8d\u70ba\u73fe\u6642\u7684\u529f\u80fd\u6bd4\u8d77\u5f80\u5f8c\u7684\u9748\u6d3b\u5ea6\u91cd\u8981\uff0c\u800c\u4e0d\u5c11\u958b\u767c\u8005\u4ea6\u6703\u8ddf\u96a8\u9019\u7a2e\u8aaa\u6cd5\u3002\u4e0d\u904e\uff0cRobert C. Martin\u8a8d\u70ba\u5f8c\u8005\u6bd4\u524d\u8005\u4f86\u5f97\u91cd\u8981\uff0c\u4ed6\u8209\u4f8b\u8aaa\uff1a<\/p>\n\n\n\n<ol><li>\u5982\u679c\u4e00\u500b\u7a0b\u5f0f\u80fd\u5920\u6b63\u5e38\u904b\u4f5c\uff0c\u4f46\u5b8c\u5168\u7121\u6cd5\u6539\u8b8a\u7684\u8a71\uff0c\u90a3\u9ebc\u7576\u9700\u6c42\u6539\u8b8a\uff0c\u7a0b\u5f0f\u5c31\u4e0d\u80fd\u5920\u904b\u4f5c\uff0c\u800c\u958b\u767c\u8005\u4ea6\u7121\u5f9e\u5c07\u4e4b\u6539\u8b8a\u3002\u7a0b\u5f0f\u5c31\u7b49\u540c\u5783\u573e\u3002<\/li><li>\u5982\u679c\u4e00\u500b\u7a0b\u5f0f\u76ee\u524d\u672a\u80fd\u6b63\u5e38\u904b\u4f5c\uff0c\u4f46\u5bb9\u6613\u6539\u8b8a\u7684\u8a71\uff0c\u958b\u767c\u8005\u5c31\u80fd\u4f7f\u5176\u904b\u4f5c\u6b63\u5e38\uff0c\u4fbf\u53ef\u4ee5\u96a8\u8457\u9700\u6c42\u6539\u8b8a\u52a0\u4ee5\u4fee\u6539\u3002\u7a0b\u5f0f\u5c31\u80fd\u5920\u6301\u7e8c\u6709\u7528\u3002<\/li><\/ol>\n\n\n\n<p>\u7576\u7136\uff0c\u6709\u4e9b\u7cfb\u7d71\u56e0\u70ba\u4e00\u4e9b\u529f\u80fd\u3001\u5b9a\u7fa9\uff0c\u7684\u78ba\u7121\u6cd5\u6539\u8b8a\uff0c\u56e0\u70ba\u5176\u6539\u8b8a\u7684\u6210\u672c\u8d85\u51fa\u6539\u8b8a\u6240\u5e36\u4f86\u7684\u5229\u6f64\u3002\u800c\u9019\u6642\uff0c\u696d\u52d9\u90e8\u7d93\u7406\u5c31\u6703\u56e0\u70ba\u4f60\u4efb\u7531\u8a72\u7cfb\u7d71\u5230\u9054\u4e00\u500b\u7121\u6cd5\u6539\u8b8a\u7684\u7a0b\u5ea6\u61a4\u800c\u5927\u6012\u3002<\/p>\n\n\n\n<h4>\u7dca\u6025\u548c\u91cd\u8981\u7684\u5206\u6b67<\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/cdn-images-1.medium.com\/max\/1200\/0*9REo5RtCKmftOED3.png\" alt=\"\"\/><figcaption>The Eisenhower Matrix<\/figcaption><\/figure>\n\n\n\n<p>Robert C. Martin \u63d0\u5230\u4e00\u500b\u5206\u6790\u96e3\u984c\u7684\u65b9\u6cd5\uff1a The Eisenhower Matrix\u3002<\/p>\n\n\n\n<p>\u96e3\u984c\u901a\u5e38\u6709\u5169\u7a2e\uff0c\u7dca\u6025\u7684\u548c\u91cd\u8981\u7684\u3002\u901a\u5e38\u7dca\u6025\u7684\u90fd\u4e0d\u7279\u5225\u91cd\u8981\uff0c\u800c\u91cd\u8981\u7684\u90fd\u4e0d\u7279\u5225\u7dca\u6025\u3002\u800c\u7cfb\u7d71\u7684\u529f\u80fd\u5c31\u662f\u524d\u8005\uff0c\u800c\u7cfb\u7d71\u7684\u67b6\u69cb\u5c31\u843d\u5165\u5f8c\u8005\u3002\u800c\u5728The Eisenhower Matrix\u88e1\u982d\uff0c\u5c31\u5206\u70ba\u56db\u7a2e\uff1a<\/p>\n\n\n\n<ol><li>\u7dca\u6025\u800c\u91cd\u8981\u7684\uff1b<\/li><li>\u4e0d\u7dca\u6025\u4f46\u91cd\u8981\u7684\uff1b<\/li><li>\u7dca\u6025\u4f46\u4e0d\u91cd\u8981\u7684\uff1b<\/li><li>\u4e0d\u7dca\u6025\u53c8\u4e0d\u91cd\u8981\u7684\uff1b<\/li><\/ol>\n\n\n\n<p>\u696d\u52d9\u90e8\u9580\u548c\u958b\u767c\u8005\u901a\u5e38\u5c31\u662f\u5c07\u7dca\u6025\u4f46\u4e0d\u91cd\u8981\u7684\u4e8b\uff0c\u512a\u5148\u65bc\u7dca\u6025\u800c\u91cd\u8981\u7684\u3002\u4ed6\u5011\u6c92\u6709\u5c07\u91cd\u8981\u7684\u548c\u4e0d\u91cd\u8981\u7684\u5206\u958b\uff0c\u800c\u5c0e\u81f4\u771f\u6b63\u91cd\u8981\u7684\u4e8b\u60c5\u88ab\u5ffd\u7565\uff0c\u91cd\u8981\u7684\u7cfb\u7d71\u67b6\u69cb\u5c31\u88ab\u4e0d\u91cd\u8981\u7684\u529f\u80fd\u6240\u8986\u84cb\u3002<\/p>\n\n\n\n<p>Robert C. Martin\u6307\u51fa\uff0c\u5206\u6790\u4e8b\u60c5\u91cd\u4e0d\u91cd\u8981\uff0c\u8cac\u4efb\u4e0d\u5728\u696d\u52d9\u90e8\u9580\uff0c\u56e0\u70ba\u4ed6\u5011\u6c92\u6709\u80fd\u529b\u53bb\u5206\u5225\u3002\u6240\u4ee5\u958b\u767c\u8005\u70ba\u4e86\u516c\u53f8\u9577\u9060\u5229\u76ca\uff0c\u61c9\u8a72\u6709\u8cac\u4efb\u53bb\u6307\u51fa\u4e8b\u60c5\u7684\u512a\u6b21\u70ba\u4f55\uff0c\u800c\u548c\u5404\u90e8\u9580\u7684\u4f5c\u51fa\u6301\u7e8c\u6399\u624e\uff0c\u5176\u4ed6\u7684\u90e8\u9580\u4ea6\u61c9\u5982\u6b64\u3002<\/p>\n\n\n\n<p>\u958b\u767c\u8005\u4f5c\u70ba\u958b\u767c\u8edf\u4ef6\u7684\u4e00\u54e1\uff0c\u61c9\u8a72\u6e05\u695a\u9019\u7a2e\u548c\u5404\u90e8\u9580\u4e4b\u9593\u6399\u624e\uff0c\u5805\u6301\u7cfb\u7d71\u7684\u9748\u6d3b\u5ea6\uff0c\u4ee5\u7dad\u8b77\u7cfb\u7d71\u67b6\u69cb\uff0c\u9019\u4e5f\u662f\u8077\u8cac\u7684\u4e00\u90e8\u5206\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p> <br>Website:  <a href=\"https:\/\/ones.software\/\">https:\/\/ones.software\/<\/a><br> Email: hello@ones.software<br> Tel: (+852) 5538 3410 <\/p>\n\n\n\n<p>\u66f4\u591a\u8cc7\u8a0a\u53ef\u4ee5\u7559\u610f <a rel=\"noreferrer noopener\" href=\"https:\/\/ones.software\/blog\/\" target=\"_blank\">ONES Publication<\/a> \u5b9a\u671f\u767c\u4f48\u7684\u6587\u7ae0\uff0c\u4ea6\u53ef\u4ee5\u806f\u7d61\u6211\u5011\uff0c\u6211\u5011\u7684\u7db2\u5740\u662f\uff1a <a rel=\"noreferrer noopener\" href=\"https:\/\/ones.software\/\" target=\"_blank\">https:\/\/ones.software<\/a><\/p>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\t\t\t\t\u300cCode \u5beb\u5f97\u597d\u5c0d\u516c\u53f8\u6709\u7528\u55ce\uff1f\u300d\u9019\u4e00\u7bc7\u6211\u5011\u8ac7\u5230Martin Fowler\u5982\u4f55\u5206\u6790\u8edf\u4ef6\u8cea\u7d20\u548c\u958b\u767c\u6642\u9593\u7684\u5169\u96e3\uff0c\u9019\u6b21\u5c31\u8b93\u6211\u5011\u770b\u770bRobert C. Martin \u5728\u5176\u8fd1\u4f5c\u300aClean Architecture: A Craftsman\u2019s Guide to Software Structure and Design\u300b\u5c0d\u65bc\u8edf\u4ef6\u958b\u767c\u6642\uff0c\u8edf\u4ef6\u5de5\u7a0b\u5e2b\u6240\u9762\u5c0d\u7684\u96e3\u984c\u3002\t\t<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[15,16],"tags":[29,77,91],"_links":{"self":[{"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/posts\/148"}],"collection":[{"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/comments?post=148"}],"version-history":[{"count":1,"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":608,"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/posts\/148\/revisions\/608"}],"wp:attachment":[{"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/media?parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/categories?post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ones.software\/code\/zh\/wp-json\/wp\/v2\/tags?post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}