{"id":2424,"date":"2010-05-14T08:50:24","date_gmt":"2010-05-14T00:50:24","guid":{"rendered":"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/http\/coolshell.cn\/?p=2424"},"modified":"2010-05-14T01:58:05","modified_gmt":"2010-05-13T17:58:05","slug":"%e4%b8%80%e4%ba%9b%e5%be%88%e4%b8%8d%e9%94%99%e7%9a%84%e7%bc%96%e7%a8%8b%e8%a7%82%e7%82%b9","status":"publish","type":"post","link":"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/https\/coolshell.cn\/articles\/2424.html","title":{"rendered":"\u5341\u6761\u4e0d\u9519\u7684\u7f16\u7a0b\u89c2\u70b9"},"content":{"rendered":"<p>\u5728<a href=\"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/http\/stackoverflow.com\/\" target=\"_blank\">Stack Overflow<\/a>\u4e0a\u6709\u8fd9\u6837\u7684\u4e00\u4e2a\u8d34\u5b50\u300a<a href=\"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/http\/stackoverflow.com\/questions\/406760\/whats-your-most-controversial-programming-opinion\" target=\"_blank\">What\u2019s  your most controversial programming opinion?<\/a>\u300b\uff0c\u7ffb\u8bd1\u6210\u4e2d\u6587\u5c31\u662f\u201c<span style=\"color: #333333;\">\u4f60\u8ba4\u4e3a\u6700\u6709\u4e89\u8bae\u7684\u7f16\u7a0b\u89c2\u70b9\u662f\u4ec0\u4e48\uff1f<\/span>\u201d\uff0c\u4e0d\u8fc7\uff0c\u5728400\u591a\u4e2a\u4e3b\u56de\u8d34\uff0c\u4ee5\u53ca\u5343\u628a\u4e2a\u5b50\u56de\u8d34\u4e2d\uff0c\u597d\u50cf\u5e76\u4e0d\u662f\u5f88\u6709\u4e89\u8bae\uff0c\u800c\u662f\u4ee4\u4eba\u76f8\u5f53\u7684\u8305\u585e\u987f\u5f00\uff0c\u4e0b\u9762\u7f57\u5217\u4e00\u4e9b\uff0c\u5e76\u901a\u8fc7\u6211\u81ea\u5df1\u7684\u7ecf\u5386\u548c\u7406\u89e3\u53d1\u6325\u4e86\u4e00\u4e9b\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u5e2e\u52a9\u3002<\/p>\n<p><strong>1\uff09 The only &#8220;best practice&#8221; you should be using all the time is &#8220;Use Your  Brain&#8221;.<\/strong><\/p>\n<p>\u552f\u4e00\u7684\u201cBest Practice\u201d\u5e76\u4e0d\u662f\u4f7f\u7528\u5404\u79cd\u5404\u6837\u88ab\u524d\u4eba\u603b\u7ed3\u8fc7\u7684\u5404\u79cd\u8bbe\u8ba1\u65b9\u6cd5\u3001\u6a21\u5f0f\uff0c\u6846\u67b6\uff0c\u90a3\u4e9b\u8457\u540d\u7684\u65b9\u6cd5\u3001\u6a21\u5f0f\u3001\u6846\u67b6\u53ea\u4ee3\u7801\u8d5e\u540c\u4ed6\u4eec\u7684\u4eba\u591a\uff0c\u5e76\u4e0d\u4ee3\u8868\u4ed6\u4eec\u9002\u5408\u4f60\uff0c\u4f60\u5e94\u8be5\u66f4\u591a\u7684\u53bb\u4f7f\u7528\u4f60\u7684\u5927\u8111\uff0c\u72ec\u7acb\u5730\u601d\u8003\u90a3\u4e9b\u65b9\u6cd5\u3001\u6a21\u5f0f\u3001\u6846\u67b6\u51fa\u73b0\u7684\u539f\u56e0\u548c\u5176\u80cc\u540e\u7684\u60f3\u6cd5\u548c\u601d\u60f3\uff0c\u90a3\u624d\u662f\u201cbest practice\u201d\u3002\u4e8b\u5b9e\u4e0a\u6765\u8bf4\uff0c\u90a3\u4e9b\u6240\u8c13\u7684\u201cBest Practice\u201d\u53ea\u4e0d\u8fc7\u662f\u9650\u5236\u90a3\u4e9b<a href=\"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/https\/coolshell.cn\/articles\/1081.html\" target=\"_blank\">\u7cdf\u7cd5\u7684\u7a0b\u5e8f\u5458\u4eec<\/a>\u7684\u7834\u574f\u529b\u3002<\/p>\n<p><strong>2\uff09Programmers who don&#8217;t code in their spare time for fun will never  become as good as those that do.<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u5bf9\u7f16\u7a0b\u6ca1\u6709\u611f\u5230\u4e00\u79cd\u5feb\u4e50\uff0c\u6ca1\u6709\u5728\u4f60\u7a7a\u95f2\u7684\u65f6\u5019\u53bb\u4ee5\u4e00\u79cd\u7684\u5a31\u4e50\u65b9\u5f0f\u53bb\u751f\u6d3b\uff0c\u65e0\u8bba\u662f\u7f16\u7a0b\uff0c\u8fd8\u662f\u8fd0\u52a8\uff0c\u8fd8\u662f\u53bb\u65c5\u6e38\uff0c\u90a3\u4e48\u4f60\u53ea\u4e0d\u8fc7\u662f\u5728\u5e94\u4ed8\u4f60\u7684\u5de5\u4f5c\uff0c\u65e0\u65f6\u65e0\u523b\u4e0d\u624e\u5728\u7a0b\u5e8f\u5806\u4e2d\uff0c\u8fd9\u6837\u4e0b\u6765\uff0c\u5c31\u7b97\u662f\u4f60\u662f\u4e00\u4e2a\u975e\u5e38\u806a\u660e\uff0c\u975e\u5e38\u6709\u624d\u534e\u7684\u4eba\uff0c\u4f60\u4e5f\u4e0d\u4f1a\u6210\u4e3a\u4e00\u4e2a\u4f18\u79c0\u7684\u7f16\u7a0b\u5458\uff0c\u8981\u4e48\u53ea\u4f1a\u5e73\u5e73\u51e1\u51e1\uff0c\u8981\u4e48\u53ea\u4f1a\u6574\u5929\u624e\u5728\u6280\u672f\u4e2d\u6210\u4e3a\u4e66\u5446\u5b50\u3002\u5f53\u7136\uff0c\u8fd9\u4e2a\u89c2\u70b9\u662f\u6709\u4e89\u8bae\uff0c\u70ed\u60c5\u548c\u80fd\u529b\u7684\u5dee\u8ddd\u4e5f\u662f\u5f88\u5927\u7684\u3002\u4e0d\u8fc7\u6211\u4eec\u53ef\u4ee5\u4ece\u4e2d\u6c72\u53d6\u5176\u6b63\u9762\u7684\u89c2\u70b9\u3002<\/p>\n<p><strong>3\uff09M<\/strong><strong>ost comments in code are in fact a pernicious form of code  duplication.<\/strong><\/p>\n<p>\u6ce8\u91ca\u5e94\u8be5\u662f\u6ce8\u91caWhy\uff0c\u800c\u4e0d\u662fHow\u548cWhat\uff0c\u53c2\u770b\u300a<a rel=\"bookmark\" href=\"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/https\/coolshell.cn\/articles\/340.html\" target=\"_blank\">\u60f9\u607c\u7a0b\u5e8f\u5458\u7684\u5341\u4ef6\u4e8b<\/a>\u300b\uff0c\u4ee3\u7801\u544a\u8bc9\u4f60How\uff0c\u800c\u6ce8\u91ca\u5e94\u8be5\u544a\u8bc9\u4f60Why\u3002\u4f46\u5927\u591a\u6570\u7684\u7a0b\u5e8f\u5e76\u4e0d\u77e5\u9053\u4ec0\u4e48\u662f\u597d\u7684\u6ce8\u91ca\uff0c\u90a3\u4e9b\u6ce8\u91ca\u5176\u5b9e\u548ccode\u662f\u91cd\u590d\u7684\uff0c\u6beb\u65e0\u610f\u4e49\u3002<\/p>\n<p><!--more--><\/p>\n<p><strong>4\uff09XML is highly overrated<\/strong><\/p>\n<p>XML\u53ef\u80fd\u88ab\u9ad8\u4f30\u4e86\u3002XML\u5bf9\u4e8eWeb\u4e0a\u7684\u5e94\u7528\u662f\u4e0d\u9519\u7684\uff0c\u4f46\u662f\u6211\u4eec\u628a\u5176\u7528\u5230\u4e86\u5404\u79cd\u5730\u65b9\uff0c\u597d\u50cf\u6ca1\u6709XML\uff0c\u6211\u4eec\u90fd\u4e0d\u4f1a\u7f16\u7a0b\u4e86\u3002<\/p>\n<p><strong>5\uff09Not all programmers are created equal<\/strong><\/p>\n<p>\u8fd9\u662f\u90a3\u4e9bjunior\u7ecf\u7406\u6216\u662f\u6d41\u7a0b\u7231\u72af\u7684\u9519\uff0c\u4ed6\u4eec\u603b\u662f\u8ba4\u4e3a\uff0cDeveloperA == DeveloperB\uff0c\u53ea\u8981\u4ed6\u4eec\u7684title\u4e00\u6837\uff0c\u4ed6\u4eec\u4ee5\u4e3a\u4ed6\u4eec\u7684\u80fd\u529b\u3001\u5de5\u4f5c\u901f\u5ea6\u3001\u89e3\u51b3\u95ee\u9898\u7684\u65b9\u6cd5\uff0c\u638c\u63e1\u7684\u6280\u80fd\u7b49\u7b49\u90fd\u662f\u4e00\u6837\u7684\u3002\u5475\u5475\u3002\u66f4\u626f\u7684\u662f\uff0c\u5728\u67d0\u4e9b\u65f6\u5019\uff0c\u5c31\u7b97\u662f\u6700\u5dee\u7684\u7a0b\u5e8f\u5458\uff0c\u4ed6\u4eec\u4e5f\u4f1a\u8ba4\u4e3a\u5176\u6bd4\u522b\u4eba\u5f3a\u5341\u500d\uff0c\u8fd9\u5c31\u662f\u73b0\u4ee3\u7684SB\u7ba1\u7406\u3002<\/p>\n<p><strong>6\uff09&#8221;Googling it&#8221; is okay!<\/strong><\/p>\n<p>Google\u53ea\u4f1a\u7ed9\u4f60\u77e5\u8bc6\uff0c\u5e76\u4e0d\u4f1a\u6559\u7ed9\u4f60\u6280\u80fd\u3002\u90a3\u91cc\u53ea\u6709\u201c\u9c7c\u201d\uff0c\u6ca1\u6709\u201c\u6e14\u201d\uff0c\u8fc7\u5ea6\u7684\u4f7f\u7528Google\uff0c\u53ea\u4f1a\u8ba9\u4f60\u8d8a\u6765\u8d8a\u79bb\u4e0d\u5f00\u4ed6\uff0c\u4f60\u8d8a\u6765\u8d8a\u53bb\u8981\u53bb\u7acb\u9a6c\u544a\u8bc9\u4f60\u7b54\u6848\uff0c\u800c\u4f60\u8d8a\u6765\u8d8a\u4e0d\u4f1a\u81ea\u5df1\u53bb\u601d\u8003\uff0c\u81ea\u5df1\u53bb\u63a2\u7d22\uff0c\u53bb\u4e13\u7814\u3002\u5982\u679cKFC\u5feb\u9910\u662f\u5783\u573e\u98df\u54c1\u5bf9\u6211\u4eec\u7684\u8eab\u4f53\u6ca1\u6709\u597d\u5904\uff0c\u90a3\u4e48\u4f7f\u7528Google\u4e5f\u4e00\u79cd\u5feb\u9910\u6587\u5316\u5bf9\u6211\u4eec\u7684\u667a\u529b\u53d1\u5c55\u5927\u5927\u7684\u6ca1\u6709\u597d\u5904\u3002<\/p>\n<p><strong>7\uff09<\/strong><strong>If you only know one language, no matter how well you know it, you&#8217;re not a  great programmer.<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u53ea\u61c2\u4e00\u79cd\u8bed\u8a00\uff0c\u51c6\u786e\u7684\u8bf4\uff0c\u5982\u679c\u4f60\u53ea\u61c2\u4e00\u7c7b\u8bed\u7c7b\uff0c\u5982\uff1aJava\u548cC#\uff0cPHP\u548cPerl\uff0c\u90a3\u4e48\uff0c\u4f60\u5c06\u4f1a\u88ab\u5c40\u9650\u8d77\u6765\uff0c\u53ea\u6709\u4e86\u89e3\u4e86\u5404\u79cd\u5404\u6837\u7684\u8bed\u8a00\uff0c\u4e86\u89e3\u4e86\u4e0d\u540c\u8bed\u8a00\u7684\u4e0d\u540c\u65b9\u6cd5 \uff0c\u4f60\u624d\u4f1a\u6709\u6bd4\u8f83\uff0c\u53ea\u6709\u4e86\u6bd4\u8f83\uff0c\u4f60\u624d\u4f1a\u660e\u767d\u5404\u79cd\u8bed\u8a00\u7684\u957f\u5904\u548c\u77ed\u5904\uff0c\u624d\u4f1a\u8ba9\u4f60\u6709\u66f4\u4e3a\u6210\u719f\u7684\u89c2\u70b9\uff0c\u800c\u4e14\u4e0d\u6574\u5929\u548c\u522b\u7684\u7a0b\u5e8f\u5728\u7f51\u4e0a\u6597\u5634\u4e89\u8bba\u662fWindows\u597d\u8fd8\u662fUnix\u597d\uff0c\u662fC\u597d\u8fd8\u662fC++\u597d\uff0c\u6709\u8fd9\u70b9\u5de5\u592b\u80fd\u5e72\u597d\u591a\u4e8b\u4e86\u3002\u4e16\u754c\u56e0\u4e3a\u4e0d\u540c\u800c\u7cbe\u5f69\uff0c\u53ea\u77e5\u9053\u4e8b\u7269\u7684\u4e00\u9762\u662f\u6709\u5bb3\u7684\u3002<\/p>\n<p><strong>8\uff09Your job is to put yourself out of work.<\/strong><\/p>\n<p>\u4f60\u7684\u5de5\u4f5c\u4e0d\u662f\u4fdd\u5b88\uff0c\u90a3\u79cd\u6559\u4f1a\u5f92\u5f1f\uff0c\u997f\u6b7b\u5e08\u7236\u7684\u60f3\u6cd5\uff0c\u4e0d\u4f46\u662f\u76f8\u5f53\u77ed\u6d45\u7684\uff0c\u800c\u4e14\u8fd8\u662f\u76f8\u5f53\u8111\u6b8b\u7684\u3002\u56e0\u4e3a\uff0c\u5728\u8ba1\u7b97\u673a\u4e16\u754c\u91cc\uff0c\u4f60\u638c\u63e1\u7684\u8001\u6280\u672f\u8d8a\u591a\uff0c\u4f60\u5c31\u8d8a\u6ca1\u7528\uff0c\u56e0\u4e3a\u6280\u672f\u66f4\u65b0\u7684\u592a\u5feb\u3002\u4f60\u5bf9\u5de5\u4f5c\u8d8a\u4fdd\u5b88\uff0c\u8fd9\u4e2a\u5de5\u4f5c\u5c31\u8d8a\u6765\u8d8a\u79bb\u4e0d\u5f00\u4f60\uff0c\u4f60\u5c31\u8d8a\u4e0d\u8d8a\u4e0d\u80fd\u62bd\u8eab\u53bb\u5b66\u65b0\u7684\u4e1c\u897f\uff0c\u4f60\u4e5f\u5c31\u8d8a\u6765\u8d8aOUT\u4e86\u3002\u8bb0\u4f4f\uff1aIf you can&#8217;t be replaced then you can&#8217;t be promoted!<\/p>\n<p><strong>9\uff09<strong>Design patterns are hurting good design more than they&#8217;re helping  it.<\/strong><\/strong><\/p>\n<p>\u5f88\u591a\u7a0b\u5e8f\u5458\u628a\u8bbe\u8ba1\u6a21\u5f0f\u5949\u4e3a\u5929\u795e\uff0c\u4ed6\u4eec\u8fc7\u5ea6\u7684\u8ffd\u6c42\u8bbe\u8ba1\u6a21\u5f0f\u4ee5\u81f3\u90fd\u90fd\u5fd8\u4e86\u9700\u6c42\u662f\u4ec0\u4e48\uff0c\u7ed3\u679c\u6574\u4e2a\u7cfb\u7edf\u8bbe\u8ba1\u88ab\u8bbe\u8ba1\u6a21\u5f0f\u641e\u5f97\u4e71\u4e03\u516b\u7cdf\uff0c\u6211\u4eec\u53eb\u8fd9\u79cd\u7f16\u7a0b\u4e3a\u201c<a href=\"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/https\/coolshell.cn\/articles\/2058.html\" target=\"_blank\">\u8bbe\u8ba1\u6a21\u5f0f\u9a71\u52a8\u7f16\u7a0b<\/a>\u201d\uff0c\u6b63\u5982\u7b2c\u4e00\u70b9\u6240\u8bf4\uff0c\u5982\u679c\u4f60\u4e0d\u61c2\u5f97\u7528\u81ea\u5df1\u7684\u5927\u8111\u601d\u8003\u7684\u8bdd\uff0c\u77e5\u5176\u7136\uff0c\u4e0d\u77e5\u6240\u4ee5\u7136\u7684\u8bdd\uff0c\u90a3\u4e48\u4f60\u4e0d\u4f46\u5f97\u4e0d\u5230\u5176\u597d\u5904\uff0c\u53cd\u800c\u53d7\u5176\u6240\u7d2f\u3002<\/p>\n<p><strong>10\uff09<\/strong><strong>Unit Testing won&#8217;t help you write good code<\/strong><\/p>\n<p>\u51c6\u786e\u5730\u8bf4\uff0c\u6211\u4eec\u53ef\u4ee5\u8ba4\u4e3a\u8fd9\u662fTest-Driven\u5f00\u53d1\uff0c\u5176\u5b9e\uff0c\u8fd9\u79cd\u5f00\u53d1\u5c31\u662f\u5148\u5199unit test case\uff0c\u8fd9\u6837\u7684\u5f00\u53d1\u65b9\u5f0f\u7684\u4e3b\u8981\u76ee\u7684\u662f\uff0c\u4e3a\u4e86\u9632\u6b62\u4f60\u4e0d\u4f1a\u56e0\u4e3a\u4e00\u4e2a\u6539\u52a8\u800c\u5f15\u5165Bug\uff0c\u4f46\u8fd9\u5e76\u4e0d\u4f1a\u8ba9\u4f60\u80fd\u5199\u51fa\u66f4\u597d\u7684\u4ee3\u7801\u3002\u8fd9\u53ea\u4f1a\u8ba9\u4f60\u5199\u51fa\u4e0d\u4f1a\u51fa\u9519\u7684\u4ee3\u7801\u3002\u540c\u7b2c\u4e00\u70b9\uff0c\u8fd9\u6837\u7684\u65b9\u6cd5\uff0c\u53ea\u4e0d\u8fc7\u662f\u9632\u6b62<a href=\"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/https\/coolshell.cn\/articles\/1081.html\" target=\"_blank\">\u7cdf\u7cd5\u7684\u7a0b\u5e8f\u5458<\/a>\uff0c\u800c\u5e76\u4e0d\u662f\u8ba9\u7a0b\u5e8f\u5458\u6216\u4ee3\u7801\u8d28\u91cf\u66f4\u6709\u957f\u8fdb\u3002\u53cd\u800c\uff0c\u901a\u8fc7Unit Test\u4f1a\u4e3a\u7a0b\u5e8f\u5458\u7684\u4e3a\u81ea\u5df1\u4ee3\u7801\u505a\u8fa9\u89e3\u7684\u4e00\u79cd\u6258\u8f9e\u3002<\/p>\n<p>\u6700\u540e\uff0c\u987a\u4fbf\u8bf4\u4e00\u4e0b\uff0c\u4ee5\u524d\u53bb\u90a3\u4e2a\u654f\u6377\u7684\u516c\u53f8\u9762\u8bd5\uff0c\u53d1\u73b0\u90a3\u4e2a\u516c\u53f8\u7684\u67d0\u4e9b\u6280\u672f\u4eba\u5458\u4e2d\u6bd2\u4e0d\u6d45\uff0c\u5177\u4f53\u8868\u73b0\u5728\u4e0a\u8ff0\u76841\uff099\uff0910\uff09\u89c2\u70b9\u4e0a\u3002<\/p>\n<p><strong>\uff08\u8f6c\u8f7d\u672c\u6587\u8bf7\u6ce8\u660e\u4f5c\u8005\u548c\u51fa\u5904\uff0c\u8bf7\u52ff\u7528\u4e8e\u5546\u4e1a\u7528\u9014\uff09<\/strong><\/p>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u5728Stack Overflow\u4e0a\u6709\u8fd9\u6837\u7684\u4e00\u4e2a\u8d34\u5b50\u300aWhat\u2019s your most controversial programming opinion?\u300b\uff0c\u7ffb\u8bd1&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/https\/coolshell.cn\/articles\/2424.html\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,15,23],"tags":[70,58],"series":[],"aioseo_notices":[],"views":85771,"post_thumbnail_image":"","content_first_image":"","post_medium_image_300":"","post_thumbnail_image_624":"","post_frist_image":"","post_medium_image":"","post_large_image":"","post_full_image":"","post_all_images":[],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":5,"total_comments":89,"category_name":"\u6280\u672f\u8bfb\u7269","post_date":"2010-05-14","like_count":"0","praiseWord":"\u9f13\u52b1","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/blue-sea-697d.quartiers047.workers.dev:443\/http\/coolshell.cn\/wp-content\/uploads\/2016\/09\/coolshell-360x200.jpg","avatarurls":[],"related_posts":[],"pageviews":85772,"pageviews_wl":28594,"ratings_average":4,"ratings_total":234,"ratings_users":52,"next_post_id":2428,"next_post_title":"\u5982\u4f55\u7ba1\u7406\u5e76\u8bbe\u8ba1\u4f60\u7684\u53e3\u4ee4","previous_post_id":2420,"previous_post_title":"\u8001\u624b\u662f\u8fd9\u6837\u6559\u65b0\u624b\u7f16\u7a0b\u7684"}