博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Style(Chapter 9 of JavaScript: The Good Parts)
阅读量:5345 次
发布时间:2019-06-15

本文共 1403 字,大约阅读时间需要 4 分钟。

  I want to avoid idioms that look like mistakes.

  I never allow switch cases to fall through to the next case. I once found a bug in my code caused by an unintended fall through immediately after having made a vigorous speech about why fall through was sometimes useful. I was fortunate in that I was able to learn from the experience. When reviewing the features of a language, I now pay special attention to features that are sometimes useful but occasionally dangerous. Those are the worst parts because it is difficult to tell whether they are being used correctly. That is a place where bugs hide.

  Quality was not a motivating concern in the design, implementation, or standardization of JavaScript. That puts a greater burden on the users of the language to resist the language's weaknesses.

JavaScript provides support for large programs, but it also provides forms and idioms that work against large programs. For example, JavaScript provides conveniences for the use of global variables, but global variables become increasingly problematic as programs scale in complexity.

  I use a single global variable to contain an application or library. Every object has its own namespace, so it is easy to use objects to organize my code. Use of closure provides further information hiding, increasing the strength of my modules.

转载于:https://www.cnblogs.com/zhtf2014/archive/2010/07/14/1777159.html

你可能感兴趣的文章
Linux常用命令(二十四)
查看>>
14、第七 - 网络编程基础 - 队列queue和生产者消费者模型
查看>>
4种java定时器
查看>>
Vue.js 教程
查看>>
【php中的curl】php中curl的详细解说
查看>>
自习(二)
查看>>
uva 10375 Choose and divide
查看>>
深刻理解:C#中的委托、事件
查看>>
linux 设置网卡
查看>>
C#中datatable导出excel(三种方法)
查看>>
面向接口编程
查看>>
hive 语法 case when 语法
查看>>
归并排序
查看>>
the Triangle
查看>>
Ajax:js读取txt内容(json格式内容)
查看>>
Task 7 买书最低价格问题
查看>>
Selenium3+python自动化007-警告框
查看>>
html5 相同形状的图形进行循环
查看>>
springboot中文官方文档
查看>>
lamdba表达式
查看>>