我们距离自由程序员有多远
Posted: 五月 9th, 2012 | Author: Su Lifu | Filed under: All, 非技术 | No Comments »慢慢打字中…
ipad/iphone视频观看地址:http://v.youku.com/v_show/id_XMzg5Njc0MzQ0.html
好吧,当看到这篇文章的时候我愣了一下,禅修程序员? 也是.各行各业都有修行之人,人活着就是为了修行嘛. 我是否能算个禅修的程序员呢?或者看了下面的文章你会有个认识.因为这能提升你的工作态度.
On a rainy morning I found myself sitting on the desk thinking about efficient working. Before I started as a freelancer I had some days were I worked lots but could look only back on a worse outcome.
在一个下雨的早晨,我坐在桌子旁,开始想着如何才能高效的工作.在我成为自由职业者之前,我有很长一段时间都在很努力的工作,但收效胜微.
I started with Zen practice back in 2006. What clearly came to my mind before a good while was: the old Zenmasters alredy knew before hundreds of years, how today programmers should work. Even when I don’t like these “be a better programmer” posts, I want to outline some of my thoughts from that morning. It shall serve me as a reminder, but if you have some ideas about it, feel free to comment
我在2006开始接触禅学。我马上意识到:古代的禅宗大师们几百年前早就已经知道现今的程序员应该如何工作。虽然我很讨厌“如何成为一个更好的程序员”之类的文章,但我仍旧想分享一些我的想法。它对我来说起到个提醒的作用,如果你有什么想法,也请留言。
If you have decided to work on a task, do it as well as you can. Don’t start multiple things at the same time. Do only one thing at one time. You’ll not become quicker, just you work multithreaded. If you work multithreaded you’ll become exhausted, make more errors and lose time to jump from one task to another. This is not only about programming, this is a general tip.
如果你决定开始工作,请尽力的做好它。不要同一时间做几件事情。一次只做一件事情。如果你多线程工作的话,你不一定会更快。多线程会让你精疲力尽,出错,转换任务时消耗更多的时间。这不是仅限于编程,这是个普遍的法则。
Kodo Sawaki says: if you need to sleep, sleep. Don’t plan your software when you try to sleep. Just sleep. If you code, code. Don’t dream away – code. If you are so tired that you cannot program, sleep. Even known multitaskers like Stephan Uhrenbacher meanwhile have decided to work singlethreaded. I have made a similar experience to Stephan and finally I wrote Time & Bill, a time tracking tool. Goal was to track my time so easily that I even do it for small tasks like a phonecall. Now I can create a few stopwatches at the beginning of the day and track my time with only one click. The outcome was a disaster: sometimes I just worked a few minutes on a task until I moved on to the next one. Now I am better. Similar to the Pomodoro technique I plan a few time slots and concentrate on them. No chatting, no sleeping, no checking out of a new great game on the Appstore.
Kodo Sawaki说过:如果你需要睡觉,去睡吧。当你试图睡觉的时候,不要想着程序,单纯的睡觉。如果你在编程,就专注编程吧,不要做白日梦。如果你很累的话,不能再编程的时候,就睡觉吧。就算是著名的多线程超人Stephan Uhrenbacher也决定以后单线程工作。我也有与Stephan类似的经历,最后我写了Time & Bill,一个追踪时间的工具。目的是想只需要点一个键,就能追踪我的时间。结果很糟糕:我经常在一个任务只专注了几分钟就转移到另外一个任务去了。现在我好多了。类似于Pomodoro technique,我计划了一些工作时段,专注于它们。不聊天,不睡觉,不查看Appstore里的新游戏。
图片属于http://yannickloriot.com
well.偶尔测试中发现,NSArray,NSSet 比较函数都是基于isEqual+hash 比较,只对于字符本身做比较,下面的代码是通过设置callback来实现指针比较 :) FYI .
int main(int argc, char *argv[]) {
@autoreleasepool {
//Default callbacks
CFSetCallBacks callbacks = kCFTypeSetCallBacks;
//Disable retain and release
callbacks.retain = NULL;
callbacks.release = NULL;
NSMutableSet * cachedPlaces = (NSMutableSet *)CFSetCreateMutable(kCFAllocatorDefault,
0,callbacks);
NSString * a1 = [NSString stringWithFormat:@"A"];
NSString * a2 = [NSString stringWithFormat:@"B"];
[cachedPlaces addObject:a1];
NSLog(@"A %d, B %d",[cachedPlaces containsObject:a1],[cachedPlaces containsObject:a2]);
}
}