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() { ...
随机推荐
- wparam , lparam 传递消息
01.WM_PAINT消息 LOWORD(lParam)是客户区的宽,HIWORD(lParam)是客户区的高 02.滚动条WM_VSCROLL或WM_HSCROLL消息 LOWORD(wParam) ...
- 01网页<head></head>常用标记及属性
网页<head></head>常用标记及属性 <!DOCTYPE html> <html> <head> <!--网页标题--> ...
- gearman的安装与使用
Gearman是一个分发任务的程序框架,它会对作业进行排队自动分配到一系列机器上.gearman跨语言跨平台,很方便的实现异步后台任务.php官方收录:http://php.net/manual/zh ...
- 数据结构---二叉搜索树BST实现
1. 二叉查找树 二叉查找树(Binary Search Tree),也称为二叉搜索树.有序二叉树(ordered binary tree)或排序二叉树(sorted binary tree),是指一 ...
- 长久不用的mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
mac上安装过mysql: 然而,尝试连接时报错: $ mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to lo ...
- Jmeter使用笔记之断言
前言 Jmeter的断言方式有很多种,由于在工作中经常做的是API接口测试,所以这篇文章主要介绍如何对接口的字段进行解析,如何对解析出来的字段的值断言 了解API接口 Restful API 规范 协 ...
- __repr__()
class A : def __init__(self,name): self.name=name #def __str__(self): # return '**%s**'%self.name de ...
- JavaSE 学习笔记之包装类(十七)
基本数据类型对象包装类:是按照面向对象思想将基本数据类型封装成了对象. 好处: 1:可以通过对象中的属性和行为操作基本数据. 2:可以实现基本数据类型和字符串之间的转换. 关键字 对应的类名 by ...
- noip模拟赛 游
[问题背景]zhx 和他的妹子出去玩.[问题描述]zhx 和他的妹子去一个国家旅游,共有 N 个旅游景点, N-1 条双向连接的道路将它们联通起来, 每一条道路有固定长度. 一开始 zhx 位于 1 ...
- C++标准库:bitset 用法整理&&zoj 3812
转载: http://happyboy200032.blog.163.com/blog/static/46903113201291252033712/ 头文件:#include <bits/st ...