4

关于提升编程效率的两点想法

 2 years ago
source link: https://www.v2ex.com/t/817199
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

关于提升编程效率的两点想法

  tool2d · 6 小时 54 分钟前 · 226 次点击

第一是大项目的代码模块,一开始就要按照功能划分为很多子模块。不能大海捞针一样的,直接在几万行代码库里修改。

否则过大的程序代码库,就意味着大脑负担大。同时数据量大,加载慢,调式慢,运行慢,多耦合,写代码自然也慢了。

而轻量级的数据,能让单元测试写起来很顺手,事半功倍。

第二是语法不能定太死,尽可能根据项目需求,引入 DSL ( domain-specific language ),来最大限度降低代码的阅读难度。

条件允许的情况下,可以对源代码做二次预处理(比如 QT )。

举个例子,JSX 语法肯定要比传统的 JS 拼接字符串有更高的可读性,但是代码都是必须经过编译的。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK