Fixing software bugs is expensive, and the cost of these bugs increases over time, especially when
Fixing software bugs is expensive, and the cost of these bugs increases over time, especially when these bugs lurks and gradually appear in released software. It is best to fix a bug immediately when you discover it. At this time, the problem that your code will solve is very clear in your mind. Otherwise, you move to another task and forget the specific code. You need to view the code after a while:
- Spend time learning and understanding this problem
- It takes time to understand the code for the problem to be solved
There are still problems, especially for large projects or companies, the guy who fixes the bug is not the one who writes the Code (and found that the bug is not the same person who fixes the bug ). Therefore, it is necessary to reduce the time it takes to understand the code, whether it is the code you wrote yourself some time ago or the code written by other members of the team. This is related to the bottom line (business revenue) and the happiness of developers, because we should develop new exciting things instead of spending hours and days to maintain legacy code.
Another fact related to software development life is that it takes much time to read code than to write code. Sometimes, when you focus on and think deeply about a problem, you can sit down and write a lot of code one afternoon.
Your code can work very quickly, but as the application matures, there will be many other things happening, which requires you to review, modify, and adjust. For example:
- Bugs are exposed.
- New features added to applications
- Programs work in new environments (for example, new browsers appear on the market)
- Code Change Purpose
- Code should be completely re-written from the beginning, transplanted to another architecture, or even using another language
As a result of these changes, the code that is rarely written by several hours has finally evolved into reading the code for weeks. This is why creating maintainable code is crucial to the success of the application.
The maintained code means:
- Readable
- Consistent
- Predictable
- It looks like it was written by the same person.
- Recorded
Additional reading
The topic list of this article is as follows:
- How should we understand the working principle of the JavaScript engine?
- JavaScript exploration: the importance of writing maintainable code
- JavaScript exploration: exercise caution when using global variables
- JavaScript exploration: var pre-parsing and side effects
- JavaScript exploration: for Loop (for Loops)
- JavaScript exploration: for-in loop (for-in Loops)
- Exploring JavaScript: Prototypes is too powerful
- JavaScript: eval () is the devil"
- JavaScript exploration: Using parseInt () for Numerical Conversion
- Exploring JavaScript: Basic coding specifications
- JavaScript exploration: function declaration and function expression
- JavaScript exploration: Name function expressions
- JavaScript: function name in the debugger
- JavaScript: JScript Bug
- JavaScript exploration: Memory Management of JScript
- Exploring JavaScript: SpiderMonkey's quirks
- JavaScript exploration: an alternative solution to naming function expressions
- JavaScript exploration: Object
- JavaScript exploration: Prototype chain
- JavaScript exploration: Constructor
- JavaScript probing: executable context Stack
- Execution context 1: Variable object and activity object
- Execution context 2: Scope chain Scope Chains
- Execution context 3: Closure Closures
- Execution context 4: This pointer
- Exploring JavaScript: Powerful prototype and prototype chain
- JavaScript Functions 1: function declaration
- JavaScript function 2: function expressions
- JavaScript function 3: function expressions in a group
- JavaScript function 4: function Constructor
- JavaScript variable object 1: VO Declaration
- JavaScript variable object 2: VO in different execution contexts
- JavaScript variable object 3: two stages of execution Context
- JavaScript variable object IV: Variables
- Property of the JavaScript variable object __parent _
- JavaScript scope chain 1: Scope chain Definition
- JavaScript scope chain 2: function Lifecycle
- JavaScript scope chain 3: Scope chain features
- JavaScript closure 1: Introduction to closures
- JavaScript closure 2: Implementation of closure
- JavaScript closure 3: Closure usage
Address of this article: http://www.nowamagic.net/librarys/veda/detail/1621,welcome.