分两天看完的,所以有上下两卷。
以下是读书笔记。
原文在[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 的重要性。
----
历史
[[email protected] ~]$ 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
[[email protected] ~]$ !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 c***s Desktop fetion Mail News tc.txt text.pdf youngworkshop
[[email protected] ~]$ !2
pwd
/export/home/aton4/guyang
[[email protected] ~]$!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
[[email protected] ~]$ !2
pwd
/export/home/aton4/guyang
[[email protected] ~]$
----
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.
[[email protected] ~]$ 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/rootc: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 ja
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-ba
to nothing for the leading part of the line.
sed 's/[ ]/\ /g'
The filenames may have em
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 li
开发工具允许不同(避免代码对工具的依赖),但是库及fr
----------------------
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 ob
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 me
approach currently available. The productivity comes from working
close to the problem domain in the DSL; the power comes from the
abstraction la
top of powerful languages will become the new standard. fr
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.
------------------------
对于xm
可以使用xm
Keep behavior in (testable) code.
举例,用Groovy生成xm
--------------------------
本文由作者笔名:小小评论家 于 2023-03-26 11:50:19发表在本站,文章来源于网络,内容仅供娱乐参考,不能盲信。
本文链接: http://www.w2mh.com/show/42004.html