When KISS is not DRY

2010-05-14
日常生活

這幾天一直都有考慮這個像是跟據喜好所展開的哲學問題.

要Keep It Simple and Stupid 還是Don't Repeat Yourself?

希望大家都可以閱讀:

有關術語集合:
http://dev.firnow.com/course/4_webprogram/php/phpjs/2008224/101342.html

註: Hard Code 該翻譯為硬碼

http://stackoverflow.com/questions/320373/ive-heard-of-dry-and-kiss-what-other-maxims-do-i-need

延展的思考:

http://mindhacks.cn/2009/03/09/first-principles-of-programming/

http://c2.com/cgi/wiki?ItDepends

討論:

http://stackoverflow.com/questions/159176

包含人生哲理的金句收錄:

Zen, part I: Programming is only the road, not the way.

Programming is only the technique to teach a computer what it's gotta do. To be successful in creating fast, reliable software means to know your algorithms, best-practices and all the other stuff not necessarily connected to your Programming (language).

Zen, part II: If you are in a hurry, stroll along slowly. If you really are in a hurry, make a detour.

Sounds silly, but do not let yourself get into compromises that (really) may trouble you afterwards. I got a rule: If you are at the core of a program, try to be as precise and good as possible. If you are using methods from the core that are deep in your software, try to be faster in coding. If you are coding above these two, you can even get a little bit more sloppy.

Design errors are the hardest to find and/or fix, next step are programming errors in parts everyone relies on, then the "real showing-off software parts". If you need to fix a design error at the end of a project, ummm, that's not good... ;-)

Zen, part III: Know your path, Neo.

Know your environment, tools and the stuff you rely on on a daily basis and get it sorted so that it works for you. Best if you use your programming "environment" so natural that you do not even have to think of it. If you have to get a job done do not introduce "fancy new stuff" but do your work. This stuff can be introduced in a new project, namely then when you have time to prepare and use it.

一个人的simple可能是另一个人的stupid,一个人的stupid可能是另一个人的unnecessary。

写API时时刻设想你就是要去使用这坨API的人。

對於這句, 我的感受: 雖然看來是很電腦的樣子, 但API 這個東西實在最能表達這個意思, 一個API 往往是集合很多API 而成, 而上一層的API 又是很多下一層的API 集合而成... 而這句很有在中間的透徹視野