-
If it's not tested, it doesn't work. 代码不做测试就不会正常
-
Source control is your friend - make sure you use it.源代码控制是你的伙伴,确定你用了它
-
Just because you wrote it doesn't mean you own it — don't be offended if someone else on your team has to change your code.你写的代码不属于你,所以当团队里的其他人改了的时候,不要生气
-
Don't reinvent the wheel, library code is there to help.不要重复造轮子,类库它不香嘛
-
The fastest code is code that's never executed — look for early outs.最快的代码是那些从不执行的代码,尽早早跳出循环
-
Just because you didn't write it doesn't mean it's crap.不是你写的代码,不意味着那是垃圾
-
Source code is just a hint to the compiler about what you want to do, it won't necessarily do it (e.g. You might declare a function as inline but the compiler doesn't have to obey).源代码把你想做的事情提示给编译器,但编译器可能不会按字面意思照做
-
Code that's hard to understand is hard to maintain.难以理解的代码,难以维护
-
Code that's hard to maintain is next to useless.难以维护的代码很快就会变成垃圾
-
“Whilst I'm editing this file I’ll just…” is a great way to introduce feature creep and bugs.当我编辑这个文件时,就会.... 是一个介绍功能错误的好方式
-
The neater your code layout, the easier it is to read. The easier it is to read, the easier it is to understand and maintain.越整洁的代码布局,越容易阅读和维护
-
Code is not self documenting. Help others by adding comments to guide them. You may understand it now but what about in 5 years time?代码不是一个人的,给它加上注释以帮助和引导他人,你现在可能记得它的逻辑,五年后呢
-
Bad Code can and will come back to haunt you.垃圾代码总能回来搞你心态你
-
There is no such thing as a 5 minute job. It'll always take at least half a day.没有那么多5分钟的工作,工作总是要花半天时间
-
Magic numbers are bad.魔数是如此的垃圾
-
Constants don't take up storage, they're compile time text substitutions.常量不占用存储空间,编译的时候会被替换
-
Project management will always want you to do twice as much in half the time.项目管理总想让你事倍功半,然而那是想🍑,他们自己咋不试试
-
If there is a bug, the user will find it.如果你的代码有bug的话,用户总会找到它
-
A code review is not a criticism.代码评审不是批评
-
It's not the quantity of code that matters, it's the quality. Any idiot can bang out 40kloc but that doesn't make it fit for purpose.代码质量比代码数量重要的多,一个笨蛋也能举起40kloc,但是那不是目的
-
The true cost of poorly written code is in the maintenance.垃圾代码的成本在于维护
-
Eat your own dog food — fixing bugs in your own code helps you code better and improves your understanding.吃自己的狗粮,改自己的代码能让你变得更好,并且提高你对代码的理解
-
Code rots over time.代码是会腐烂的,你要常看看它
-
If the user didn't ask for a feature, don't add it.用户没要求,不要🦐🐔做
-
If it's not tested, it doesn't work (yes, I know I've included that twice but it's really important).最重要的一条,如果你不测试,那你死定了
-
Bad architecture causes more problems than bad code.烂架构比烂代码差劲多了
-
You will spend more time thinking than coding.多想少写,先想再写
-
The best programmers are always building things.最好的程序员总是在写代码
-
There’s always a better way.总是有更好的方法
-
Code reviews by your peers will make all of you better.同辈代码评审会使你们都变得更好
-
Fewer features for better code is always the right answer in the end.最终你会明白少就是多的真正含义
-
Always know how your business makes money, that determines who gets paid what.总是知道你们的商业模式,那决定着谁付钱
-
If you want to feel important as a software developer, work at a tech company.作为程序员你想获得尊重,你就要去技术公司