分两天看完的,所以有上下两卷。
以下是读书笔记。
原文在[http://giftdotyoung.blogspot.com/2009/03/blog-post_3759.html]
和
[http://giftdotyoung.blogspot.com/2009/03/blog-post_24.html]。
半部九阴真经
而且还是上卷。
The Productive Programmer, Part I 笔记。
====================
Context switching eats time.
用于作为证据,说明 multiple clipboard 的重要性。
----
历史
[guyang@digi02 ~]$ history
1 17:37 ls
2 17:37 pwd
3 17:37 history
4 17:37 history
5 17:37 pwd
6 17:37 ls
7 17:37 ls -l
8 17:37 ls -l
9 17:38 history
10 17:38 history | grep ls
11 17:38 ls
12 17:38 history
[guyang@digi02 ~]$ !1
ls
100 a bin cat2.JPG Download input.txt map to sea.png Pictures text.aux text.tex 中华utf8
100.c aa blackduck.txt cat2 smile.JPG dwhelper learning mean sandbox text.dvi tour.png
30 aa.txt bookmark danmark.orgE eng.txt lib mean.c svn text.log tt.orgF
30.c a.txt canals Desktop fetion Mail News tc.txt text.pdf youngworkshop
[guyang@digi02 ~]$ !2
pwd
/export/home/aton4/guyang
[guyang@digi02 ~]$!h | grep p
history | grep p
2 17:37 pwd
5 17:37 pwd
10 17:38 history | grep ls
15 17:39 pwd
16 17:39 history | grep p
[guyang@digi02 ~]$ !2
pwd
/export/home/aton4/guyang
[guyang@digi02 ~]$
----
pushd & popd
----
快挺键的学习,需要在适用此键的上下文环境中。
One of my colleagues has a great way of teaching keyboard
shortcuts. Whenever you pairprogram with him, if you use a mouse to
select a menu or tool button, he makes you undo your operation, then
do it three times using the keyboard. Yes, it slows you down at first,
but the reinforcement (plus his evil eye when you forget them) is a
pressure cooker to learn shortcuts.
-----
grep显示文件名和行号
find . -name "*.java" -exec grep -n -H "new .*Db.*" {} ;
{} Placeholder for the filename found by find.
; Terminate the command after -exec. Because this is a Unix command,
you might want to pipe the results of this into another command, and
the find command has to know when the "exec" is done.
[guyang@digi02 ~]$ grep -nH "main" *c
100.c:3:int main()
30.c:3:int main(int argc, char *argv[])
mean.c:3:int main(int argc, char *argv[])
-------------------
explorer /e,/root,c:workcit
-------------------
web开发自动化测试
You can also interact with pages that require an HTML POST instead of GET using the "-d"
command-line option:
curl -d "birthyear=1905&press=%20OK%20" www.hotmail.com/when/junk.cgiG
Subvert Selenium to Walk Web Pages
Selenium‡ is an open source user acceptance testing tool for web applications. It allows you to
simulate user actions by automating the browser via JavaScript. Selenium is written entirely
in browser technology, so it runs in all mainstream browsers. It is an incredibly useful tool for
testing web applications, regardless of the technology used to create the web application.w
-------------------
uniq
#!/bin/bash
for X in $(egrep -o "[A-Z]w*Exception" log_week.txt | sort | uniq) ;
do
echo -n -e "processing $Xt"
grep -c "$X" log_week.txt
done
----------------------
Monad
Windows Power Shell
----------------------
svn st | grep '^?' | tr '^?' ' ' |
sed 's/[ ]*//' | sed 's/[ ]/\ /g' | xargs svn add
svn st
Get Subversion status on all files in this directory and all
its subdirectories. The new ones come back with a ? at the beginning
and a tab before the filename.
grep '^?'
Find all the lines that start with the ?.
tr '^?' ' '
Replace the ? with a space (the tr command translates one
character for another).
sed 's/[ ]*//'
Using sed, the stream-based editor, substitute spaces
to nothing for the leading part of the line.
sed 's/[ ]/\ /g'
The filenames may have embedded spaces, so use sed
again to substitute any remaining spaces with the escaped space
character (a space with a in front).
xargs svn add
Take the resulting lines and pump them into the svn add
command.
--------------------------
自动化的理由之一
Does this task destroy my focus? (Almost any task takes you away from
your locus of attention, making it harder to get back to your focused
state.)
-----------------------------
Don't Shave Yaksv
译为"别给牦牛剪毛"
Yak shaving is dangerous because it eats up a lot of time. It also
explains why estimating tasks is so often wrong: just how long does it
take to fully shave a yak? Always keep in mind what you are trying to
achieve, and pull the plug if it starts to spiral out of control.
-----------------------
canonicality
简而言之,所有开发人员的机器配置都一样。
同步或使用hard link。
开发工具允许不同(避免代码对工具的依赖),但是库及framework的版本必须一致。
----------------------
No matter what you are copying and pasting, resuse by copy and paste
is evil.
而indirection是推荐行为。
------------------
vmware虚拟机镜像,避免授权问题。
-------------------
不应直接修改从ORM中得到的class code,应该先继承,然后在子类中添加或修改方法...这也是间接。
Of course, this is just a DAO (data access object) with no behavior:
it is merely a collection of get/set methods. If you need to add
behavior to this entity, you can subclass the DAO to add
methods. Never hand-edit a generated file because it will be
regenerated the next time you perform a build. NOTE Add behavior to
generated code via extension, open classes, or partial classes.
杨注:这样,在DSM生成的C代码中,也应该预留回调函数,而不应该允许直接修改生成的代码。
-----------------------
Always keep "living" documentation.
过时的文档 比没有文档更糟糕。
提到自研发工具svn2wiki
------------------
...continuous integration
-------------------
告诫是一遍又一遍啊。
Repetition is the single most diminishing force in software development.
Duplication is evil. Evil, I say!
DRY = Don't Repeat Yourself.
-----------------
-----------------
半部九阴真经 下卷D
半部九阴真经
下卷。
----
JAVA的复杂度检查工具 和 code coverage工具。
甚至能检查疑似的copy&paste代码。
对比C++。群众基础是多么重要啊。
-----
YAGNI STANDS FOR "YOU AIN'T GONNA NEED IT." ItT
不要为将来而担心.
过度工程.
-----
Powerful languages + domain-specific meta-layers offer the best
approach currently available. The productivity comes from working
close to the problem domain in the DSL; the power comes from the
abstraction layer simmering just below the surface. Expressive DSLs on
top of powerful languages will become the new standard. Frameworks
will be written using DSLs, not on top of statically typed languages
with restrictive syntax and unnecessary ceremony.
------
The Law of Demeter
不要跟陌生人说话.
never use more than one dot for any method call.
Job job = new Job("Safety Engineer", 50000.00);
Person homer = new Person("Homer", job);
homer.getJob().setPosition("Janitor");
按 Law of Demeter,改为
public PersonDemo() {
Job job = new Job("Safety Engineer", 50000.00);
Person homer = new Person("Homer", job);
homer.changeJobPositionTo("Janitor");
}
public void changeJobPositionTo(String newPosition) {
job.changePositionTo(newPosition);
}
Person屏蔽了job的细节.
杨常使用上面的那个不符合law of Demeter的方法,并困惑client怎么能不对job产生信赖.
---------------------
以下是引用的。
For projects on which I'm the tech lead, our rule of thumb is to
allow no method to exceed 15 lines of code in Java or C#. For dynamic
languages such as Groovy or Ruby, the rule is five lines of code.f
------------------
SLAP,没注意过这个。
这样,写public函数就有有点类似于写大纲了。
SLAP STANDS FOR THE SINGLE LEVEL OF ABSTRACTION PRINCIPLE.
SLAP insists that all your code within a
method live at the same level of abstraction.
Encapsulate all implementation details away from public methods.
----------------------
完美编辑器需要的功能之一
Additive cut and copy commands
Don't make round trips when you can batch.
------------------------
对于XML持否定态度
可以使用XML,但是只生成,不书写。
Keep behavior in (testable) code.
举例,用Groovy生成XML。
--------------------------
半部九阴真经 & 半部九阴真经
《卓有成效的程序员》热门书评
-
上帝的归上帝,程序的归程序
37有用 1无用 Yurii 2009-03-29
http://www.luanxiang.org/blog/archives/593.html程序员,就是整天与机器打交道的那群人。在计算机并不普及的年代,这样的描述毫无疑问;然而,这些年来,得益于计算机成本的不断下降,软件使用门槛的不断降低,如今,昔日昂贵而又神秘不可莫测电脑,已经成了随处可见、人...
-
卓有成效的程序员──咱码农如何实现自我加速
25有用 0无用 masque 2010-07-04
写在BLOG上,原文粘过来。额,有几张图片粘不了,链接在这里:http://www.oeddyo.com/%E3%80%8A%E5%8D%93%E6%9C%89%E6%88%90%E6%95%88%E7%9A%84%E7%A8%8B%E5%BA%8F%E5%91%98%E3%80%8B%E2%94%...
-
人有多大懒,才有多大闲
14有用 1无用 张凯峰 2009-08-15
《卓有成效的程序员》给我的震撼很大,程序员作为特殊的群体,有的人可以这么懒,懒到事情都交给机器去做,而有的人又可以那么勤奋,每天都孜孜不倦得做着重复单调的工作。在看这本书之前,我属于勤奋的人,而看完这本书以后,我要努力变成懒惰的人。不要在去庞大的开始菜单里面一项一项搜索自己的应用程序,也不要在自己的...
-
卓有成效的电脑使用者
8有用 0无用 Urumchi 2009-05-30
说实话,我只重点看了第一部分<机制>,第二部分<实践>倒只是走马观花的扫了一遍.不得不说,前5章很对我的口味.一些有些人可能认为难登大雅之堂,或者说零零碎碎的小技巧第一次(至少对我来说)写在书里.而这些之前大多只是在网上以新工具推荐方式出现,这本书却改变了这点,这些工具/技巧...
-
高效开发的敲门砖
6有用 0无用 dreamhead 2008-10-06
回想一下:* 怎样启动一个程序?* 怎样切换到一个文件上去?曾经的我这样做:* 点开“开始”菜单,在“程序”中,一项项寻找过去……* 在IDE中,找到目录的根,然后一层层目录展开……现在的我这么做的:* 用快捷键调出一个启动程序,比如Launchy,敲入我要启动程序的名字,比如firefox,然后回...
书名: 卓有成效的程序员
作者: [美] Neal Ford
出版社: 机械工业出版社
原作名: The Productive Programmer
副标题: 一本揭示高效程序员的思考模式,一本告诉你如何缩短你与优秀程序员的差距
译者: ThoughtWorks公司
出版年: 2009-3
页数: 216
定价: 45.00元
ISBN: 9787111264064