2020-07-26
We’ve been doing a lot of mob programming at work the last year or so and I’ve seen that I have a different attitude to naming things than others on my team. When I see that a name can be improved I always think this is priority number one. My colleagues often say “later”.
I also saw something related recently when doing a programming course internally at work. I sat and helped a guy with an issue he was having. I saw a really bad variable name and recommended he change it. He said “later, I just need to fix this first”. I pushed the point once more saying “trust me” and then left him to his devices. A few minutes later he asked for help again, being totally stuck. Renaming the variable got him immediately unstuck. He had wasted lots of time because the name put him in a mental trap.
My philosophy is: there are only two acceptable types of names: good names and metasyntactic names
. If you have a name that is bad or just a bit misleading it’s better to rename it to foo
NOW.
I believe good (or metasyntactic) names lead to easier problem solving and less effort in programming. It’s not just something we add at the end to make the code more understandable to others or future you. To me the primary thing we work with in programming isn’t numbers or computation, but language.
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
锋利的jQuery
单东林、张晓菲、魏然 / 人民邮电出版社 / 2012-7-1 / 49.00元
《锋利的jQuery(第2版)》循序渐进地对jQuery的各种函数和方法调用进行了介绍,读者可以系统地掌握jQuery的选择器、DOM操作、事件和动画、AJAX应用、插件、jQuery Mobile、jQuery各个版本变化、jQuery性能优化和技巧等知识点,并结合每个章节后面的案例演示进行练习,达到掌握核心知识点的目的。 为使读者更好地进行开发实践,《锋利的jQuery(第2版)》的第8......一起来看看 《锋利的jQuery》 这本书的介绍吧!