<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>奚金鑫的博客 | 人人分享，从我做起</title>
  
  
  <link href="http://localhost:4000/atom.xml" rel="self"/>
  
  <link href="http://localhost:4000/"/>
  <updated>2022-04-05T08:20:34.117Z</updated>
  <id>http://localhost:4000/</id>
  
  <author>
    <name>奚金鑫</name>
    
  </author>
  
  <generator uri="https://hexo.io/">Hexo</generator>
  
  <entry>
    <title>Contract Testing between FE &amp; BE</title>
    <link href="http://localhost:4000/2016/06/09/Contract-Testing-between-FE-BE/"/>
    <id>http://localhost:4000/2016/06/09/Contract-Testing-between-FE-BE/</id>
    <published>2016-06-09T02:44:23.000Z</published>
    <updated>2022-04-05T08:20:34.117Z</updated>
    
    <content type="html"><![CDATA[<p><a href="https://blog.risingstack.com/swagger-nodejs/">Swagger &amp; Node JS</a><br><a href="https://github.com/hapijs/hapi">Hapi JS</a><br><a href="https://github.com/swagger-api/swagger-node">Swagger Node</a></p><ul><li>Use Swagger Editor to define Rest APIs, generate JSON</li><li>Write Controller Code in Node.js</li><li>Run the server</li></ul>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;&lt;a href=&quot;https://blog.risingstack.com/swagger-nodejs/&quot;&gt;Swagger &amp;amp; Node JS&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;https://github.com/hapijs/hapi&quot;&gt;Hapi JS&lt;/a&gt;&lt;</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>Testing React Components</title>
    <link href="http://localhost:4000/2016/05/21/Testing-React-Components/"/>
    <id>http://localhost:4000/2016/05/21/Testing-React-Components/</id>
    <published>2016-05-21T02:44:23.000Z</published>
    <updated>2022-04-05T08:24:54.584Z</updated>
    
    <content type="html"><![CDATA[<h3 id="Why-we-need-test"><a href="#Why-we-need-test" class="headerlink" title="Why we need test"></a>Why we need test</h3><p>Please see <a href="/2016/05/16/Why-We-need-Front-End-Test/">this</a> article</p><span id="more"></span><h3 id="Test-Goals"><a href="#Test-Goals" class="headerlink" title="Test Goals"></a>Test Goals</h3><ul><li>The test suite should be fast, to encourage us to write more tests and save us time;</li><li>We should be able to test our React components effectively;</li><li>The test suite should play well with ES6 syntax and our webpack setup;</li><li>The test suite must be integrated alongside our current integration tests on CircleCI</li></ul><h3 id="Why-not-Jest"><a href="#Why-not-Jest" class="headerlink" title="Why not Jest"></a>Why not Jest</h3><ol><li>Slow<br>Test suite of about 60 test cases 10 seconds vs 200ms (Karma)</li><li>I don’t like the module mocking that makes things look like black boxes</li><li>I never actually wanted&#x2F;needed black boxing</li><li>The documentation was lacking</li><li>I had to come up with a hacky way to call it from Node</li><li>I didn’t really know how to debug my tests other than by the really long stack traces</li><li>it didn’t run in a real browser.</li></ol><h3 id="How-do-test"><a href="#How-do-test" class="headerlink" title="How do test"></a>How do test</h3><h3 id="Test-points"><a href="#Test-points" class="headerlink" title="Test points"></a>Test points</h3><ul><li>End to End test</li><li>Dumb React components</li><li>Smart React components</li><li>Redux Store (action&#x2F;reducers)</li></ul><h4 id="3rd-libraries"><a href="#3rd-libraries" class="headerlink" title="3rd libraries"></a>3rd libraries</h4><ul><li>Karama</li><li>Mocha</li><li>Sinon</li><li>Chai</li><li>JSDOM</li></ul><h3 id="Issues"><a href="#Issues" class="headerlink" title="Issues"></a>Issues</h3><p>issue: framework “sinon” is not defined<br>fix:  npm install -g karma-cli<br><a href="https://github.com/karma-runner/karma/issues/1488">Github issue</a></p><h3 id="Sites-choosing-FE-Test-techniques"><a href="#Sites-choosing-FE-Test-techniques" class="headerlink" title="Sites choosing FE Test techniques"></a>Sites choosing FE Test techniques</h3><p><a href="https://medium.com/about-codecademy/testing-with-reactjs-at-codecademy-2aec88cc4e36#.358gmmnl1">testing-with-reactjs-at-codecademy</a></p>]]></content>
    
    
    <summary type="html">&lt;h3 id=&quot;Why-we-need-test&quot;&gt;&lt;a href=&quot;#Why-we-need-test&quot; class=&quot;headerlink&quot; title=&quot;Why we need test&quot;&gt;&lt;/a&gt;Why we need test&lt;/h3&gt;&lt;p&gt;Please see &lt;a href=&quot;/2016/05/16/Why-We-need-Front-End-Test/&quot;&gt;this&lt;/a&gt; article&lt;/p&gt;</summary>
    
    
    
    
  </entry>
  
  <entry>
    <title>Why We need Front End Test</title>
    <link href="http://localhost:4000/2016/05/16/Why-We-need-Front-End-Test/"/>
    <id>http://localhost:4000/2016/05/16/Why-We-need-Front-End-Test/</id>
    <published>2016-05-16T02:44:23.000Z</published>
    <updated>2022-04-05T08:24:49.406Z</updated>
    
    <content type="html"><![CDATA[<p>First of all, let’s begin this question.</p><h3 id="Why-do-we-need-test"><a href="#Why-do-we-need-test" class="headerlink" title="Why do we need test?"></a>Why do we need test?</h3><p>Let’s take a look at Kent Beck’s speech <a href="https://www.infoq.com/presentations/self-image">Ease at Work</a> at Agile Singapore 2013 Confluence.<br>In his speech, he addressed these questions.</p><ul><li>Why are programmers so often ill at ease with themselves?<br>Difficulty, great effort, or hard work.<br>Worry, pain.</li><li>What can we do to become comfortable in our own skins?<br>Writing Test to ensure that what we code does what it’s supposed to do.</li></ul><span id="more"></span><h3 id="Test-Benifits"><a href="#Test-Benifits" class="headerlink" title="Test Benifits"></a>Test Benifits</h3><p>Tests aim to:</p><ul><li>Verify functionality</li><li>Verify bug fix</li><li>Verify browser&#x2F;device compability<br>The benefit of writing test is just simple, <strong>CONFIDENCE</strong>.<br>Test cases are just like your life insurance, with this insurance, you’ll have confidence when you do code re-factoring, bug fix etcs.</li></ul><p>And as times goes by, when the number of test cases grows, it can increase</p><ul><li>Work Efficiency (Increase extendability&#x2F;maintainbility)</li><li>Less Regression</li><li>Fun of Coding<br>And for those headache listed above:</li><li>Worry, pain?<br>Gone, I have the test cases, I have the confidence, coding is fun!</li><li>Difficulty, great effort, or hard work?<br>Gone, with test case, code is easy to maintain&#x2F;extend&#x2F;re-factoring, less regression, life would be much easier.</li></ul><p><em><strong>That’s the reason why we need test.</strong></em></p><p><em><strong>Furthurmore</strong></em></p><h3 id="Why-do-we-need-TDD"><a href="#Why-do-we-need-TDD" class="headerlink" title="Why do we need TDD?"></a>Why do we need TDD?</h3><p>Here’s three rules of TDD from Uncle Bob</p><ol><li>You are not allowed to write any production code unless it is to make a failing unit test pass.</li><li>You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.</li><li>You are not allowed to write any more production code than is sufficient to pass the one failing unit test.</li></ol><p>Most programmers, when they heard these three rules, they would say.</p><ul><li>This is stupid.</li><li>It’s going to slow me down, it’s a waste of time and effort, It will keep me from thinking, it will keep me from designing, it will just break my flow.</li></ul><p>However, think about what would happen if you walked in a room full of people working this way. Pick any random person at any random time.<br><em><strong>A minute ago, all their code worked.</strong></em><br><em><strong>A minute ago, all their code worked.</strong></em><br><em><strong>A minute ago, all their code worked.</strong></em><br>And it doesn’t matter who you pick, and it doesn’t matter when you pick. A minute ago all their code worked!</p><h3 id="TDD-Benifits"><a href="#TDD-Benifits" class="headerlink" title="TDD Benifits"></a>TDD Benifits</h3><ul><li><p>Work Efficiency<br>If all your code works every minute, how often will you use a debugger?<br>And if you aren’t debugging very much, how much time will you be saving?<br>How much time do you spend debugging now?<br>How much time do you spend fixing bugs once you’ve debugged them?</p></li><li><p>Confidence<br>Why don’t we clean up code that we know is messy? We’re afraid we’ll break it. But if we have the tests, we can be reasonably sure that the code is not broken, or that we’ll detect the breakage immediately.<br>If we have the tests we become fearless about making changes.<br>If we see messy code, or an unclean structure, we can clean it without fear.</p></li><li><p>Readbility(Tests are documents, examples)<br>If you want to know how to call a certain API, there is a test that does it.<br>If you want to know how to create a certain object, there is a test that does it.<br>Anything you want to know about the existing system, there is a test that demonstrates it.<br>The tests are like little design documents, little coding examples, that describe how the system works and how to use it. hey are the most useful part of the documentation. They are the living examples of how to use the code. They are design documents that are hideously detailed, utterly unambiguous, so formal that they execute, and they cannot get out of sync with the production code.T</p></li><li><p>Decoupling<br>When you follow the three rules of TDD, all your code will be testable by definition! And another word for “testable” is “decoupled”. In order to test a module in isolation, you must decouple it. So TDD forces you to decouple modules. Indeed, if you follow the three rules, you will find yourself doing much more decoupling than you may be used to. This forces you to create better, less coupled, designs.</p></li><li><p>Tests grows, quality grows.<br>But the benefit goes far beyond that. If you work this way, then every hour you are producing several tests. Every day dozens of tests. Every month hundreds of tests. Over the course of a year you will write thousands of tests. You can keep all these tests and run them any time you like! When would you run them? All the time! Any time you made any kind of change at all!</p></li></ul><p>Follow the three rules, the development workflow would be as below</p><div class="figure nocaption" style="width:;"><a class="fancybox" href="tdd_flow.png" title="" data-caption="" data-fancybox="travel"><img class="fig-img" src="tdd_flow.png" alt=""></a></div><p>References</p><ul><li><a href="http://www.te52.com/testtalk/2014/08/07/5-reasons-we-need-software-testing/">5-reasons-we-need-software-testing</a></li><li><a href="http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd">TheThreeRulesOfTdd</a></li><li><a href="https://www.codementor.io/reactjs/tutorial/redux-unit-test-mocha-mocking">redux-unit-test-mocha-mocking</a></li></ul>]]></content>
    
    
    <summary type="html">&lt;p&gt;First of all, let’s begin this question.&lt;/p&gt;
&lt;h3 id=&quot;Why-do-we-need-test&quot;&gt;&lt;a href=&quot;#Why-do-we-need-test&quot; class=&quot;headerlink&quot; title=&quot;Why do we need test?&quot;&gt;&lt;/a&gt;Why do we need test?&lt;/h3&gt;&lt;p&gt;Let’s take a look at Kent Beck’s speech &lt;a href=&quot;https://www.infoq.com/presentations/self-image&quot;&gt;Ease at Work&lt;/a&gt; at Agile Singapore 2013 Confluence.&lt;br&gt;In his speech, he addressed these questions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why are programmers so often ill at ease with themselves?&lt;br&gt;Difficulty, great effort, or hard work.&lt;br&gt;Worry, pain.&lt;/li&gt;
&lt;li&gt;What can we do to become comfortable in our own skins?&lt;br&gt;Writing Test to ensure that what we code does what it’s supposed to do.&lt;/li&gt;
&lt;/ul&gt;</summary>
    
    
    
    
  </entry>
  
  <entry>
    <title>Software versioning</title>
    <link href="http://localhost:4000/2016/05/01/Software-versioning/"/>
    <id>http://localhost:4000/2016/05/01/Software-versioning/</id>
    <published>2016-05-01T02:44:23.000Z</published>
    <updated>2022-04-05T08:21:55.210Z</updated>
    
    <content type="html"><![CDATA[<p><a href="http://semver.org/">DOC</a><br><a href="https://en.wikipedia.org/wiki/Software_versioning">wiki</a><br>1.0.0-alpha &lt; 1.0.0-alpha.1 &lt; 1.0.0-alpha.beta &lt; 1.0.0-beta &lt; 1.0.0-beta.2 &lt; 1.0.0-beta.11 &lt; 1.0.0-rc.1 &lt; 1.0.0.</p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;&lt;a href=&quot;http://semver.org/&quot;&gt;DOC&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Software_versioning&quot;&gt;wiki&lt;/a&gt;&lt;br&gt;1.0.0-alpha &amp;lt; 1.0.0-al</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>FE Team Responsibility</title>
    <link href="http://localhost:4000/2016/04/01/FE-Team-Responsibility/"/>
    <id>http://localhost:4000/2016/04/01/FE-Team-Responsibility/</id>
    <published>2016-04-01T02:44:23.000Z</published>
    <updated>2022-04-05T08:21:18.012Z</updated>
    
    <content type="html"><![CDATA[<ul><li>UX是指用户体验，简单点来说，是对用户负责的，目标是让用户用的开心、体验好。</li><li>UI的话，就是用户界面，UX工程师是将用户界面设计的更漂亮，但还是需要前端工程师，来将这些页面做出来</li><li>前端小组不仅要将这些页面做出来，还需要将页面上的元素做封装，将一些常见的或复杂的组件做成核心组件，后期业务小组会直接使用这些组件，提高页面生产效率。</li><li>前端小组还得在架构方面有所涉及，新技术的架构，老技术的架构，新老技术融合的架构。</li></ul>]]></content>
    
    
      
      
    <summary type="html">&lt;ul&gt;
&lt;li&gt;UX是指用户体验，简单点来说，是对用户负责的，目标是让用户用的开心、体验好。&lt;/li&gt;
&lt;li&gt;UI的话，就是用户界面，UX工程师是将用户界面设计的更漂亮，但还是需要前端工程师，来将这些页面做出来&lt;/li&gt;
&lt;li&gt;前端小组不仅要将这些页面做出来，还需要将页面上</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>五子棋Git源码</title>
    <link href="http://localhost:4000/2015/10/09/%E4%BA%94%E5%AD%90%E6%A3%8BGit%E6%BA%90%E7%A0%81/"/>
    <id>http://localhost:4000/2015/10/09/%E4%BA%94%E5%AD%90%E6%A3%8BGit%E6%BA%90%E7%A0%81/</id>
    <published>2015-10-09T02:44:23.000Z</published>
    <updated>2022-04-05T08:25:42.714Z</updated>
    
    <content type="html"><![CDATA[<p>终于把java改成js版本了，<a href="https://github.com/shinxi/gomoku">Git地址</a></p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;终于把java改成js版本了，&lt;a href=&quot;https://github.com/shinxi/gomoku&quot;&gt;Git地址&lt;/a&gt;&lt;/p&gt;
</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>ETS Programming Competition Champion!</title>
    <link href="http://localhost:4000/2015/08/09/ETS-Programming-Competition-Champion/"/>
    <id>http://localhost:4000/2015/08/09/ETS-Programming-Competition-Champion/</id>
    <published>2015-08-09T02:44:23.000Z</published>
    <updated>2022-04-05T09:27:20.837Z</updated>
    
    <content type="html"><![CDATA[<p>这个礼拜五，正式进行ETS五子棋编程比赛，万万没想到，本想打个酱油，可是无心插柳柳成荫，即使在优化还未做好的情况下，还是得了个第一。。。<br>奖品是2k rmb，大白，以及奖杯。哈哈哈！</p><span id="more"></span><p>奖杯<br><img src="/2015/08/09/ETS-Programming-Competition-Champion/champion2.jpeg" alt="奖杯"><br>最终成绩表<br><img src="/2015/08/09/ETS-Programming-Competition-Champion/scoreTable.jpeg" alt="最终成绩表"><br>大白及RMB<br><img src="/2015/08/09/ETS-Programming-Competition-Champion/dabai.jpeg" alt="大白及RMB"></p><p>稍后会把这次五子棋的源码放出。</p>]]></content>
    
    
    <summary type="html">&lt;p&gt;这个礼拜五，正式进行ETS五子棋编程比赛，万万没想到，本想打个酱油，可是无心插柳柳成荫，即使在优化还未做好的情况下，还是得了个第一。。。&lt;br&gt;奖品是2k rmb，大白，以及奖杯。哈哈哈！&lt;/p&gt;</summary>
    
    
    
    
  </entry>
  
  <entry>
    <title>最大最小搜索算法、Alpha-beta剪枝算法 </title>
    <link href="http://localhost:4000/2015/07/13/%E6%9C%80%E5%A4%A7%E6%9C%80%E5%B0%8F%E6%90%9C%E7%B4%A2%E7%AE%97%E6%B3%95%E3%80%81Alpha-beta%E5%89%AA%E6%9E%9D%E7%AE%97%E6%B3%95/"/>
    <id>http://localhost:4000/2015/07/13/%E6%9C%80%E5%A4%A7%E6%9C%80%E5%B0%8F%E6%90%9C%E7%B4%A2%E7%AE%97%E6%B3%95%E3%80%81Alpha-beta%E5%89%AA%E6%9E%9D%E7%AE%97%E6%B3%95/</id>
    <published>2015-07-13T02:44:23.000Z</published>
    <updated>2022-04-05T08:26:57.862Z</updated>
    
    <content type="html"><![CDATA[<p>因为公司最近有五子棋比赛，这周开始恶补最大最小、Alpha-beta算法。。。</p><span id="more"></span><p><a href="http://www.xqbase.com/computer/search_minimax.htm">最大最小搜索算法</a><br><a href="http://www.xqbase.com/computer/search_alphabeta.htm">Alpha-beta剪枝算法</a></p><p>相关博客</p><ul><li><a href="http://www.cnblogs.com/IThaitian/p/3616550.html">http://www.cnblogs.com/IThaitian/p/3616550.html</a></li><li><a href="http://www.cnblogs.com/speeding/archive/2012/09/20/2694704.html">http://www.cnblogs.com/speeding/archive/2012/09/20/2694704.html</a></li><li><a href="http://www.cnblogs.com/pangxiaodong/archive/2011/05/26/2058864.html">http://www.cnblogs.com/pangxiaodong/archive/2011/05/26/2058864.html</a></li><li><a href="http://blog.csdn.net/handsomesunshineboy/article/details/6175106">http://blog.csdn.net/handsomesunshineboy/article/details/6175106</a></li></ul>]]></content>
    
    
    <summary type="html">&lt;p&gt;因为公司最近有五子棋比赛，这周开始恶补最大最小、Alpha-beta算法。。。&lt;/p&gt;</summary>
    
    
    
    
  </entry>
  
</feed>
