Giter Site home page Giter Site logo

js-refactor's Introduction

#JavaScript Refactor

只有SkilltreeDeveloper学习路线图 是远远不够的。

说明: 在构建EchoesWorks的时候用到了这个库,这是一个用于生成Markdown的Micro Markdown库。

由于对代码重构的最大难题是没有测试,在这里我们提供了尽可能高的测试覆盖率。至于功能见测试用例,测试用例是最好的文档

注意: 这里并没有说原来的代码写得不好,只是在这里可以让我们学习重构。

你要面对的挑战有:

  • 注释 (Comments) (ps: 合理的函数名、变量名可以取代注释)
  • 重复代码 (Duplicated Code)
  • 过大的类 (Large Class)
  • 多层嵌套
  • 。。。

可以参考的模式:

  • Decorator (装饰)
  • Composite (组成)

或者当时我想用的

  • Pipes and Filters

可以参考的书籍:

《重构与模式》

《重构: 改善既有代码的设计》

测试代码质量:

CodeClimate

相关文章: 用code climate来clean code与重构

##Setup

1.Install

npm install

2.Test

npm test

ps: 在ThoughtWorks,写出功能代码只是走了一半的路,->绿->重构

Enjoy it!

##订阅

请到https://github.com/artisanstack/summary

点击右上角的watch即可订阅。

##License##

© 2015 Phodal Huang. This code is distributed under the MIT license. See LICENSE.txt in this directory.

待我代码编成,娶你为妻可好

js-refactor's People

Contributors

phodal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.