JavaScript Patterns 2.1 Writing Maintainable Code
Revisiting the code after some time has passed requires:
• Time to relearn and understand the problem
• Time to understand the code that is supposed to solve the problem
As the application matures, many other things happen that require your code to be reviewed, revised, and tweaked. For example:
• Bugs are uncovered.
• New features are added to the application.
• The application needs to work in new environments (for example, new browsers appear on the market).
• The code gets repurposed.
• The code gets completely rewritten from scratch or ported to another architecture or even another language.
Maintainable code means code that:
• Is readable
• Is consistent
• Is predictable
• Looks as if it was written by the same person
• Is documented
JavaScript Patterns 2.1 Writing Maintainable Code的更多相关文章
- JavaScript Patterns 2.12 Writing API Docs
Free and open source tools for doc generation: the JSDoc Toolkit (http://code.google.com/p/jsdoc-too ...
- JavaScript Patterns 2.11 Writing Comments
Document all functions, their arguments and return values, and also any interesting or unusual algor ...
- Practical Go: Real world advice for writing maintainable Go programs
转自:https://dave.cheney.net/practical-go/presentations/qcon-china.html?from=timeline 1. Guiding pri ...
- JavaScript Patterns 7.1 Singleton
7.1 Singleton The idea of the singleton pattern is to have only one instance of a specific class. Th ...
- JavaScript Patterns 5.8 Chaining Pattern
Chaining Pattern - Call methods on an object one after the other without assigning the return values ...
- JavaScript Patterns 5.5 Sandbox Pattern
Drawbacks of the namespacing pattern • Reliance on a single global variable to be the application’s ...
- JavaScript Patterns 5.3 Private Properties and Methods
All object members are public in JavaScript. var myobj = { myprop : 1, getProp : function() { return ...
- JavaScript Patterns 5.2 Declaring Dependencies
It’s a good idea to declare the modules your code relies on at the top of your function or module. T ...
- JavaScript Patterns 5.1 Namespace Pattern
global namespace object // global object var MYAPP = {}; // constructors MYAPP.Parent = function() { ...
随机推荐
- 并发编程学习笔记(4)----jdk5中提供的原子类及Lock使用及原理
(1)jdk中原子类的使用: jdk5中提供了很多原子类,它会使变量的操作变成原子性的. 原子性:原子性指的是一个操作是不可中断的,即使是在多个线程一起操作的情况下,一个操作一旦开始,就不会被其他线程 ...
- java项目其他基础配置
创建完maven项目之后. 1.pom.xml文件配置项目相关的架包. 2.src.main.resources下边 创建文件夹:spring以及mapper. 3.src.main.resource ...
- DeepCloneObjects 和 DeepClone
ARX AcDbDatabase 中的方法 deepCloneObjects() 和 wblock() 区别以及和 AcDbObject 方法 clone() 和 deepClone() 的关系 Ac ...
- jenkins自动部署测试环境
构建脚本如下: echo "当前目录":$(pwd)echo "当前时间":$(date +%Y-%m-%d_%H:%M)find ./ -type f -na ...
- c++通过CMake实现debug开关
刚学cmake,很多东西还不是很懂,不过今天刚刚实现了通过CMake控制debug的开关,兴奋之余记录一下. 背景介绍: 最近参与到了一个大的C++项目,很多代码已经非常成熟,我来添加一些辅助功能,但 ...
- 洛谷——P1471 方差
P1471 方差 题目描述 蒟蒻HansBug在一本数学书里面发现了一个神奇的数列,包含N个实数.他想算算这个数列的平均数和方差. 借一下远航之曲大佬的图片,特别清晰: 那么只要维护区间平方和,就可以 ...
- Python面向对象之面向对象封装案例
面向对象封装案例 封装 封装是面型对象编程的一大特点 面向对象编程的第一步--将属性和方法封装到一个抽象的类中: 外界使用类创建对象,然后让对象调用方法: 对象方法的细节都被封装在类的内部. 一个对象 ...
- ZOJ 1516 Uncle Tom's Inherited Land
题目大意: 除去那些作为荷塘的土地块,将剩余的土地希望每次将两块相邻的地一起卖出,最多能卖出多少种这样的由相邻土地 合成的长方形土地块 很明显的二分图问题,但是要考虑如何建模 一个长方形土地总是由相邻 ...
- poj3352
Road Construction Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7980 Accepted: 4014 Des ...
- CF558E A simple task 线段树
这道题好猥琐啊啊啊啊啊啊 写了一个上午啊啊啊啊 没有在update里写pushup啊啊啊啊 题目大意: 给你一个字符串s,有q个操作 l r 1 :把sl..rsl..r按升序排序 l r 0 :把s ...