优秀的程序 vs 糟糕的程序

开发者Rahul Singh近日在其个人博客中列出了他眼中的优秀的程序和糟糕的程序:

引用

优秀的程序可以使复杂的东西看起来很简单;糟糕的程序让原本简单的东西变得复杂。

优秀的程序不需要加以说明;糟糕的程序需要大量注释。

优秀的程序编写时需要更多时间,但未来花费的时间却更少;糟糕的程序往往花费较少的时间,但会在未来浪费掉更多时间。

优秀的程序需要考虑当前和未来的需求;糟糕的程序只侧重于现在,在未来可能无法正常工作。

优秀的程序非常易于维护;糟糕的程序难以维护。

优秀的程序有更长的生命周期,甚至应用范围超出预期;糟糕的程序在其工作范围之外几乎无法使用。

优秀的程序如同良好的习惯,其影响将持续很长一段时间,几乎可以永久地解决问题;糟糕的程序如同止痛药,其效果只有很短的时间,解决问题大多是暂时的。

优秀的程序是整洁的、遵守规律的;糟糕的程序是混乱的。

优秀的程序可以令人学到很多编程方法和经验;糟糕的程序只能令人越学越糟。

优秀的程序中,该重用的地方重用,该发明的地方发明;糟糕的程序会重新发明轮子,并在适合发明的地方重用。

优秀的程序依靠程序员的直觉和知识,并经过了多年良好程序习惯的熏陶;糟糕的程序往往盲目依赖他人的知识和经验,而没有自己的理解。

优秀的程序可以很容易地从一个程序员转移给另一个程序员;糟糕的程序只能被编写者理解和实施。

优秀的程序员不会刻意去记忆一段代码,他依赖于他的逻辑思维能力和理解,并能在未来轻松改善代码;糟糕的程序员往往会记住很多自己不理解的代码。

优秀的程序都有相同的特征,如简单、可读性强、效率高;糟糕的程序各有糟糕之处。

优秀的程序比程序员存在的时间要更久;糟糕的程序存在的时间很短。

Good Programming, Bad Programming

November 17, 2012

Some thoughts on Good Programming and Bad Programming:

Good Programming makes even complex things seem simple.
Bad Programming makes even simple things complex.

Good programming is self-explanatory.
Bad Programming requires explanation.

Good Programming takes more time now, but less time in future.
Bad Programming takes less time now, but more time in future.

Good Programming involves considering present and future requirements.
Bad Programming focuses only on the present and may not work in future.

Good Programs are easy to maintain.
Bad Programs are hard to maintain.

Good Programs have a longer lifespan, and may even outlast the purpose for which they were created.
Bad Programs have short lifespan and barely usable outside their working scope.

Good Programs are like good habits, whose effects last for a long time and solves the problem almost permanently.
Bad Programs are like painkillers, whose effects last for only short time and solves the problem mostly temporarily.

Good Programming is clean and disciplined.
Bad Programming is messy and chaotic.

Good Programming is learned, practiced and mastered over a period of years.
Bad Programming is self brought, and when practiced for long time makes it even more difficult to learn good programming.

Good Programming is knowing when to invent and when to reuse.
Bad Programming is inventing what's already invented, and reusing what can be better invented.

Good Programming is relying on your own instincts and knowledge, gained after years of good programming practice.
Bad Programming is relying blindly on others knowledge and experience, without applying your own understanding.

Good Programs can be transferred from one programmer to another programmer.
Bad Programs can only be understood and implemented by the same programmer.

Good Programmer doesn't memorize piece of code. He relies on his logical skills and understanding, and can enhance the code easily in future.
Bad Programmer memorizes the piece of code instead of taking right efforts to learn it, and has difficulty in making changes to the code.

Good Programs are good for similar reasons like simplicity, readability, and efficiency.
Every Bad Program is bad for its own reason.

Good Programming Concepts outlast the life of a programmer.
Bad Programming Concepts die with the programmer.

http://www.singhrahul.com/2012/11/good-programming-bad-programming.html

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值