Compile maintainable Javascript

Source: Internet
Author: User

Compiling maintainable Javascript
Basic Information
Author: (US) Nicolas C. zakas [Translator's introduction]
Translator: Li Jing Guo Kai Zhang Sanji
Press: People's post and telecommunications Press
ISBN: 9787115310088
Mounting time:
Published on: February 1, March 2013
Start: 16
Page number: 280
Version: 1-1
Category: Computer> Software and programming> network programming> Javascript

For more information, writing maintainable Javascript
Introduction
Computer books
The consistency of the encoding style must be emphasized in any language. As long as it is developed by a team, it is critical that everyone write code in the same way. In this way, you can easily understand and maintain the code of the other party.
Compiling maintainable JavaScript explains how to compile highly maintainable JavaScript code in team development. The book details how to write JavaScript as a team member. This book covers the coding style, programming skills, automation, testing, and other aspects, including the introduction of specific styles and principles, as well as examples and tips, finally, we also introduced how to use automated tools and methods to achieve a consistent programming style.
Nicolas C. zakas, author of "Compiling maintainable JavaScript", is a top-level Web technical expert and author of "Advanced JavaScript programming. He used to be Yahoo! The chief front-end development engineer, after finishing the transformation from a "Lone hero" to "Team elites", he extracted many best programming practices from the perspective of front-end engineers, these include the best rules that many industry authorities advocate, and these valuable experiences are the core content of this book.
Compiling maintainable Javascript is suitable for front-end development engineers, JavaScript programmers, and readers who want to learn JavaScript programming. It is also suitable for developers and project owners. Using the techniques and techniques described in this book, JavaScript team programming can be achieved from the haze of Chivalrous personal preferences, to the real high maintainability, high efficiency and high level.
Directory
Compiling maintainable Javascript
Part 1 programming style 1
Chapter 4 Basic formatting 4
1.1 indent level 4
1.2 statement end 7
The length of 1.3 rows is 8
1.4 line feed 9
1.5 empty rows 10
1.6 name 11
1.6.1 variables and functions 12
1.6.2 constant 13
1.6.3 constructor 14
1.7 direct quantity 15
1.7.1 string 15
1.7.2 digit 16
1.7.3 null 17
1.7.4 undefined 18
1.7.5 direct object count 19
1.7.6 array quantity 20
Chapter 21 Note 21
. 2.1 single row comment 21
2.2 multi-line comment 23
2.3 note 24
2.3.1 hard-to-understand Code 25
2.3.2 code that may be mistaken for error 26
2.3.3 browser features hack 26
2.4 document comment 27
Chapter 3 statements and expressions 30
3.1 bracket Alignment 31
3.2 BLOCK statement interval 32
3.3 switch statement 33
3.3.1 indent 33
3.3.2 "continuous execution" 35 of the case statement
3.3.3 default 36
3.4 With statement 37
3.5 For Loop 37
3.6 For-in loop 39
Chapter 41 variables, functions, and operators
4.1 variable Declaration 41
4.2 function declaration 44
4.3 function call interval 45
4.4 immediate call of function 46
4.5 strict mode 47
4.6 equal to 49
4.6.1 eval () 51
4.6.2 original packaging type 52
Part 2 programming practices 54
Chapter 5 loose coupling of the UI Layer 55
5.1 What is loose coupling 56
5.2 extract JavaScript from CSS 57
5.3 remove CSS from JavaScript 58
5.4 extract JavaScript from HTML 60
5.5 extract HTML from JavaScript 62
5.5.1 Method 1: Load 63 from the server
5.5.2 Method 2: simple client template 64
5.5.3 method 3: complex client template 67
Chapter 2 avoid using global variables 70
6.1 problems caused by global variables 70
6.1.1 name conflict 71
6.1.2 Code vulnerability 71
6.1.3 difficult to test 72
6.2 unexpected global variable 72
Avoid unexpected global variables 73
6.3 single global variable method 74
6.3.1 namespace 76
6.3.2 module 78
6.4 zero global variable 81
Chapter 3 event handling 83
7.1 typical usage 83
7.2 Rule 1: isolate application logic 84
7.3 Rule 2: do not distribute event objects 85
Chapter 4 avoid "EMPTY comparison" 88
8.1 Check Original Value 88
8.2 check reference value 90
8.2.1 detection function 92
8.2.2 detection array 94
8.3 detection attribute 95
Chapter 2 separating configuration data from Code 98
9.1 what is configuration data 98
9.2 remove configuration data 99
9.3 save configuration data 100
Chapter 4 throw a custom error 10th
10.1 error nature 103
10.2 throw error 104 in Javascript
10.3 benefits of throwing an error 105
10.4 when to throw error 106
10.5 try-catch statement 107
10.6 Error Type 109
Chapter 5 is not your object. Do not change it.
11.1 what is your 112
11.2 principle 113
11.2.1 do not overwrite method 113
11.2.2 method 114 is not added
11.2.3 method 116
11.3 better way 117
11.3.1 object-based inheritance 118
11.3.2 type-based inheritance 119
11.3.3 facade mode 120
11.4 notes about polyfill 121
11.5 prevent modification 122
Chapter 2 browser sniffing 12th
12.1 User-Agent Detection 125
12.2 Feature Detection 127
12.3 avoid feature inference 129
12.4 avoid browser inference 130
12.5 how should we choose 134
Part 3 automation 135
Chapter 4 file and directory structure 13th
13.1 best practices 137
13.2 basic structure 138
Chapter 2 ant 14th
14.1 install 143
14.2 configuration file 143
14.3 build 145
14.4 dependency of the target operation 145
14.5 attribute 146
14.6 buildr project 148
Chapter 1 Verification 15th
15.1 search for files 149
15.2 task 150
15.3 enhanced target operations 152
15.4 improvement in other aspects 153
15.5 buildr task 154
Chapter 4 file merging and processing 16th
16.1 task 156
End character at the end of row 16.2: 157
16.3 file header and end 158
16.4 processed files 159
Chapter 4 file streamlining and compression 17th
17.1 file streamlining 163
17.1.1 use Yui compressor to streamline code 165
17.1.2 reduced by 167 with closure Compiler
17.1.3 use uglifyjs to streamline the process by 169
17.2 compression 170
17.2.1 compression 171 during runtime
17.2.2 compression 171 during build
Chapter 2 docization 18th
18.1 jsdoc toolkit 175
18.2 Yui Doc 177
Chapter 2 automated testing 19th
19.1 Yui test selenium engine 180
19.1.1 configure a selenium server 181
19.1.2 configure Yui test selenium engine 181
19.1.3 use Yui test selenium engine 181
19.1.4 ant configuration 183
19.2 yeti 184
19.3 phantomjs 186
19.3.1 installation and use 186
19.3.2 ant configuration 187
19.4 jstestdriver 188
19.4.1 installation and use 188
19.4.2 ant configuration 189
Chapter 2 assemble together 20th
20.1 ignored details 191
20.2 prepare a packaging plan 192
Ipv2.1 development version build 193
20.2.2 build of integrated version 194
Release 2.3 build 195 of the released version
20.3 use CI system 196
4.1.3.1 Jenkins 196
199 other Ci Systems
Appendix A JavaScript coding style guide 200
Appendix B JavaScript toolkit 223

Source of this book: China Interactive publishing network

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.