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() { ...
随机推荐
- 【Linux】 JDK安装及配置 (linux-tar.gz版)
安装环境:Linux(CentOS 7 64位 版) JDK安装:tar.gz为解压后就可以使用的版本,这里使用jdk-8u211-linux-x64.tar.gz版,安装到/usr/java/(us ...
- (独孤九剑)---PHP操作MySQL数据库
[一]开启mysql扩展 在PHP操作MySQL数据库之前,要保证开启了MySQL数据库扩展 若未开启,则可以将php.int文件下的php_mysql开启即可,方式为去掉前面的封号; 配置完成后要重 ...
- 07Java Server Pages
Java Server Pages JSP是一种Java servlet,主要用于实现Java web应用程序的用户界面部分. JSP全称Java Server Pages,是一种动态网页开发技术.它 ...
- java中的数学函数Math方法记录
1,三角函数与属性Math.sin() -- 返回数字的正弦值Math.cos() -- 返回数字的余弦值Math.tan() -- 返回数字的正切值Math.asin() -- 返回数字的反正弦值M ...
- RC: blkio throttle 测试
本文将测试一下使用cgroup的blkio组来控制IO吞吐量 : 测试环境CentOS 7.x x64 创建一个继承组 [root@150 rg1]# cd /sys/fs/cgroup/blkio/ ...
- 低版本ie兼容问题的解决方案
CSS hack \9 所有的IE10及之前 * IE7以及IE7以下版本的 _ IE6以及IE6以下版本的 !important 提升样式优先级权重 1.ie6,7 ...
- 解决window.location.href参数太长
前言:一提到页面跳转,最常用的一般就是window.location.href,如果需要带参数,也许可以在后面用?拼上,但这样并不安全,而且有个更严重的问题,这样的拼接是有长度限制的,如果达到好几千个 ...
- Ubuntu16.04安装rabbitmq(实战)
安装Erlang 由于RabbitMQ需要基于Erlang/OTP,所以在安装RabbitMQ之前需要先安装Erlang/OTP.同样的,在Ubuntu标准的repositories中,Erlang/ ...
- Python基础(三) 数据类型
我们首先要看的是几乎任何语言都具有的数据类型,包括字符串.整型.浮点型以及布尔类型.这些基本数据类型组成了基本控制块,从而创建的Python应用程序. 一.基本结构 1.数值: Python支持不同的 ...
- 【19】AngularJS 应用
AngularJS 应用 现在是时候创建一个真正的 AngularJS 单页 Web 应用(single page web application,SPA)了. AngularJS 应用实例 现在可以 ...