anchor.diff:  .l-main-section
   :marked
     ### T-DRY (Try to be DRY)
  -  ### T-DRY （尝试遵循不重复自己DRY的公约）
  +  ### T-DRY（尝试遵循不重复自己DRY的约定）
     <a id="04-05"></a>
     #### Style 04-05
     #### 风格04-05
  
positive.code:   :marked
      **Do** refactor logic for making data operations and interacting with data to a service.
      
      **坚持** 把数据操作和数据互动重构到服务里。
  
  .s-rule.do
    :marked
      **Do** make data services responsible for XHR calls, local storage, stashing in memory, or any other data operations.
      
      **坚持** 让数据服务来负责XHR调用、本地储存、内存储存或者其他数据操作。
  
  .s-why
    :marked
      **Why?** The component's responsibility is for the presentation and gathering of information for the view.  It should not care how it gets the data, just that it knows who to ask for it. Separating the data services moves the logic on how to get it to the data service, and lets the component be simpler and more focused on the view.
      
      **为何？** 组件的职责是为视图展示或收集信息。它应该不用理会如何得到数据，它只知道向谁要数据。把如何取得数据的逻辑移动到数据服务里，简化了组件，让其聚焦到视图。
  
  .s-why
    :marked
      **Why?** This makes it easier to test (mock or real) the data calls when testing a component that uses a data service.
      
      **为何？** 在测试使用数据服务的组件时，可以让数据调用更容易被测试（模仿或者真实）。
  
  .s-why.s-why-last
    :marked
      **Why?** Data service implementation may have very specific code to handle the data repository. This may include headers, how to talk to the data, or other services such as `Http`. Separating the logic into a data service encapsulates this logic in a single place hiding the implementation from the outside consumers (perhaps a component), also making it easier to change the implementation.
      
      **为何？** 数据服务的实施可能有非常特定的代码来处理数据仓库，包括数据头（headers）、如何与数据交谈或者其他服务（比如`Http`)。把逻辑分离到数据服务可以把该逻辑封装到一个地方，对外部使用者（比如组件）隐藏具体的实施细节。
  
  a(href="#toc") Back to top
  
  
negative.code:   ### 小函数
    <a id="01-02"></a>
    #### Style 01-02
    #### 风格01-02
  .s-rule.do
    :marked
      **Do** define small functions
      
      **坚持**定义小函数
  
  .s-rule.consider
    :marked
      **Consider** limiting to no more than 75 lines.
      
      **考虑**限制在75行之内
  .s-why
    :marked
      **Why?** Small functions are easier to test, especially when they do one thing and serve one purpose.
      
      **为何？**小函数更易于测试，特别是当它们只做一件事，只为一个目的服务的时候。
  
  .s-why
    :marked
      **Why?** Small functions promote reuse.
      
      **为何？**小函数促进了代码的重用。
  
  .s-why
    :marked
      **Why?** Small functions are easier to read.
      
      **为何？**小函数更加易于阅读。
  
  .s-why
    :marked
      **Why?** Small functions are easier to maintain.
      
      **为何？**小函数更加易于维护。
  
  .s-why.s-why-last
    :marked
      **Why?** Small functions help avoid hidden bugs that come with large functions that share variables with external scope, create unwanted closures, or unwanted coupling with dependencies.
      
      **为何？**小函数帮助避免一些大函数容易产生的那些与外界共享变量、创建意外的闭包或与依赖之间产生意外耦合等隐蔽的错误。
  
  a(href="#toc") Back to top
  
  