Chess Club

I am in the local chess club with my two boys. It is a community centre in outskirt of Leeds. The children meet every Sunday evening from 5:30 to 7:30 at term time. There are about 25 kids, from age of 7 to 18. I have to say Chess is not a popular hobby among children, comparing to foodball or even drama in this country.

The club is run by three volunteer teachers. One is retired chess coach Nick, who is well over 70 years old. One is John, who also organises Yorkshire chess association. The third teacher is David, a young man who assists John on most of the events. Because the three teachers are volunteers, the club fee is almost nothing comparing to music tuition or other after school club.

The community centre is not very well equipped. Parents have to help the kids to set up tables and chairs at the beginning and move them back to the store room at the end. Nick has a portable projector to show his chess puzzles on the screen. But as the projector is in low spec, the image is not clear to me possible because I am badly shortsighted.

The meet starts with a warm up play session. Kids sit randomly playing a game or two before the tutoring session begins. As the kids are in different levels, the three teachers are leading a group each, say beginners, medium players and advanced players.

Watching all the kids in the dimmed room, amazingly, the kids look quite contented. They interact with their teacher actively. They think and smile. They enjoy as that is their hobby from heart. I guess playing chess is the joy of game itself than anything else.

Advertisements
Posted in Uncategorized | Leave a comment

关于生命那些事儿

又到年尾,参加圣诞聚会,准备圣诞礼物,和小朋友一起装扮圣诞树…… 小朋友已经知道耶稣不存在,圣诞老人也不存在。孩子们就这样不知不觉的长大了,好像这一年比一年过得快。

记得年初的时候,读了两本书,《When Breath Becomes Air》 (《当呼吸变成空气》),《The Things You Do For Love》(《因为爱》)第一本书关于死亡,第二本书关于爱。选择这两本书读,不是偶然的巧合,死亡和爱就是那段时间我想探寻的话题。

三十六岁的保罗,神经外科医生,刚刚结束了长达十年的专业培训,被诊断出晚期肺癌,《当呼吸变成空气》是他在生命的最后一年,写下那些文字。拥有文学,哲学,历史学和医学学位的他,无论是文字的魅力和他的经历和视角都是非常独特的。书中描述了他成为神经外科医生的艰难,成为外科医生以后面临一个又一个频临死亡的病人,他要和他们一起面对那些绝望的时刻,这其中包括他的同事因为压力而自杀身亡。当然书中笔墨最多的还是他如何面对自己的死亡。他说:“接受现实往前看是显而易见的,问题是我不知道我的生命还剩下多少时间。如果是三个月,我就选择和家人在一起,如果是一年的时间,我会写一本书,假如有十年的时间,我会回去继续做医生治病救人。” 他不知道他有多少时间,他选择了继续做他的外科医生,他还选择了写书。他不再去寻找剩下多长时间的答案,他所知道的就是时间不多了,就争取每一天做最想做的事。如果和广袤的宇宙相比,我们每个人的时间都不多了。«因为爱»是一本小说,探索女性职业生涯和兼顾家庭生活双重挑战话题。书的作者是女外科医生,Rachel Crowther。小说中有绘画,有雕塑,有音乐,有英国,有法国,当然还有爱,有背叛,有挣扎,有报复,有宽容,有和解 … 吸引我的除了小说中的人物和故事以外,还有作者本人。Rachel 在做了二十年的医生以后,辞职写作,在接近五十岁的时候出版第一本小说,她还是五个孩子的母亲,热爱文学,音乐,绘画… 我欣赏她这样丰富的人生。

圣诞前,有幸观看到 AlphaGo 的记录片。那不是关于生命的故事,但像生命的故事一样让人感动。因为片中给观众留下的思考似乎和生死一样深刻,那就是人和有智能的机器的关系。片中记录了在 AlphaGo 在伦敦的办公室第一次的人机大战,那时是AlphaGo 战胜了当时的欧洲杯冠军樊麾。然后片中详细跟踪 DeepMind 公司核心人员奔赴首尔,记录了AlphaGo和李世石的世纪大战。李世石在赛前的发布会上自信满满的说,他相信他可以胜,他预估结果是五场中或许会输一场。然而我们看到输了第一场的李世石。一路没有微笑走出来的他真的应该不只是难过,更多的是困惑吧,他不相信这个事实,但是还要面对这个失败。在接下来的两场比赛中,我们看到了一个无助的世界冠军,不断的皱眉头,搓手指,中途,他还会要求停下来,去酒店楼顶阳台抽烟。三场都输了之后,在新闻发布会上他第一句话说的就是向大家抱歉。现场的观众还有电视机前的韩国人甚至更多人都留下泪水。不过李世石毕竟是天才,他在第四局的第78步下的一手妙招,板回一局。那时候全场沸腾,(当然 DeepMind 团队除外,他们都在电脑前看数据,找Bug)赛后有记者问到这78步李世石是怎么想的。他非常自信的说,那个位置就是那一步最佳的选择,他很确定这一点。因为这一步,李世石得到了全世界的尊重。这场比赛结束了,结果刚好和李世石预测的相反,他赢了一场,机器赢了四场。令人感动的是,李世石赛后真诚的感谢 AlphaGo,感谢它让自己对围棋又有了新的理解,激发了他更多新的想法。虽然 DeepMind团队胜利了,这时候的观众都在为李世石鼓掌,祝贺。或许有一天,人类也会放下那些恩恩怨怨,一起面对未来威胁整个人类的挑战。

新的一年即将开始,生命的挑战,生活的挑战,未来的挑战,都会无情的到来。应对它们,借《唐顿庄园》里一段精彩对白:

“I suspect she’s quite a tough nut.” (“我猜她是个难缠的胡桃。”)

“And I am quite a tough nutcracker” (“我可是那个绝对锐利的胡桃夹子啊。”)

无论遇到的挑战是什么,就把它当作nut, 做一个自信满满的 nutcracker 吧。2018,祝大家新年快乐!

Posted in 读书, 人生感悟 | Leave a comment

Jam Factory

02/11/2017 Jam Factory

I was with the research group in a factory-transformed restaurant in Central Oxford. It was a King assigned marmalade factory in 1800s.

The building was well preserved and has been decorated with paintings, crafts and photographys. These art works are also labelled with price for customer to buy. It is a gallery but serving food.

I wondered if the owner was an artist or a business man or woman with passion for art. My friend walked me around the place, from corner to corner. There was another group of people gathering for drink as well and they then joined an art workshop in the art centre, a well equipped meeting room.

The menu includes burgers, streak, fish etc. I ordered a medium steak with half naked chips. I was amazed with the name of chips. The British tried very hard not call French fries French fries. They can be skinny chips, naked chips, finger chips etc etc. How creative, or defensive. After a long waiting, finally, the food was served, “steak with french fries”, I said to my English friend. To further entertainment, we discovered that the French fries actually originally created in Belgium in 1600s.

Posted in 世界各地 | Tagged | Leave a comment

Karate

07/10/2017 Karate

I am sitting at a corner of a community hall, watching my boys in a karate session. The groups started with running in a circle, following instructions of a master, running forward, sideways, pushups, situps … I love this part, which reminds me a lot about my childhood sports training. Mine was much tougher than theirs. It was full of painful stories.

Kicking, punching, shouting, they started practising more advanced forms. It is amazing watching British participating an Asian art. They look like falling in love with the sport so much and I can see their dedication on every move.

Half of the group are adults, in their 30s, 40s or even 50s. Some of the beginners are adults too. I wonder what made them to start to learn a new sport at this age.

They started to work as a pair, practising defencing skills with a partner. They talked a lot, not sure all related to the skills, but look like enjoying the discussion.

Everybody lined up in rows now. They are performing all the forms they have learned starting from the basic. Although everybody does the same move, you would not expect the performance like our soldiers marching style, in which everyone is in one rhythm like one person. They are performing in their own pace and the master will wait for everybody complete and then start another instructions.

Now it is the last bit of the hour, everybody running in his own spot as fast as they can and then do situps. It is the toughest part as this session goes. You can hear their heavy breathing and sweats from their foreheads.

Now, everybody sits with eyes closed, as the master said, “It is the time to reflect what we have learned and what you will practise at home this week.”

Then everyone stood up and bowed to the master and to their peers. Kungsu! Everyone shouted with their fist up in air. 空手道,万岁?!

Posted in 人生感悟 | Tagged | Leave a comment

Observation Notes @ Clinical Decision Unit

This week, I had an adventure visiting local hospital A&E. With most parts of my body still working well, I was curiously watching the operations there and the following are my notes and thoughts. It might not make sense at all but it might be interesting to share……

At A&E, soon after a few checks, I was sent to Clinical Decision Unit (CDU), where patients need to be watched, checked and wait until a duty doctor can make a decision on their cases. Normally this should take a few hours or more as the decisions are made based on some test result come out. And a decision could be taking more tests based on the results. My case fell into the latter scenario and I was there for totally 36 hours.

During the time, I was regularly checked by nurses on body temperature, blood pressure etc. I was also given pain killers regularly based on my feeling of the pain. There are about 30 to 40 patients in two large rooms with beds and a waiting area with seats. I believe there are about 10 staff at one time, including nurses, managers and doctors. To take care of every patient by different nurses and doctors, the operations in general are quite efficient and smooth, how do they do it?

Every patient is allocated a bed, a folder with a bed number, which has all the medical information, different forms, doctor and nurses’ notes, test reports etc. A doctor or a nurse have to take care of multiple patients and a patient will be taken care by definitely more than one nurse or one doctors. During the time I was there, my case has been reviewed by three doctors and I have been taken care of by seven different nurses. Every time, different nurses come to me, asking my name, my date of birth before he or she conducted any action, such as taking blood for tests or giving medications.

There is a big screen in the room, showing the patient and their medication measures which I cannot fully understand but I believe that screen show an overview of the Unit, the capacity, the progress etc. If some patient needs to be sent home by an ambulance, the Unit manager will arrange the transportation. Every so often, we can see the patient were sent in on a medical bed by a crew of ambulance and the duty manager of the Unit helps to arrange a slot for the bed. Patient sent from the A&E room should sit in the waiting area first to wait until a bed is available. The managers also take care of the staff who are responsible for food and clean the bed.

The interesting moment is the doctor review time and how they make decisions. This could happen case by case or by a routine review in the morning or evening. When all the results come back and check-up completes, a doctor will review the case. In the morning session, the doctor came with trainee doctor and his medical student. They discussed each case based on the information of patients’ folder, talk to nurses and then talk to the patient. I believe this is very much evidence-based decisions as the doctor will discuss the patients’ symptoms, the test results and the decision, which could be more time to watch and monitor, more tests to do or discharge from the unit. They also will ask how the patient feel and see if they can help in any way. All sounds not that hard if the symptoms are not life threatening and most of the time the patients got discharged with assurance as every test results show the body is reasonably function well.

At this point, you might wonder why I am interested in this? What is my point?

Let us compare this operation to a live defect fix scenario in a software development team. Dealing with live defect is like working at A&E. A system with live defect has to be fixed or a work around has to be applied by a developer at a limited time. Sometime the defect can be fixed quickly but sometime the defect takes ages to investigate. The live defect fix process is not as smooth as the Clinical Decision Unit. Most of the time, we will see following scenarios:

  1. Sometime, the systems are too poor to be fixed. This kind of systems are often called Legacy. I don’t know why this beautiful word is used to describe something going to be dumped soon. Often it is quite difficult to fix a live defect of a legacy system as the technology is outdated and nobody really knows what is going on inside.
  2. Sometime, the investigation can be time consuming as the developer need to reproduce the live issue in a development environment and sometime it is quite tricky to do so.
  3. It is quite common that one system can only be fixed by one or two developers as they have all the knowledge and it will take too much time for others to do the same job.
  4. It is also quite common that a live defect fix can trigger another defect as the quick fix applied with time pressure might not be technically sound and often it overpasses a development pipeline because of time constraint.

Compare to the CDU, the systems with live defects are like patient registered in A&E. The developers are the doctors, we have managers to take the defect in but no nurses to do the check-ups or specialists to do all kinds of tests, or analyse the results, such as blood specialist, heart specialist or radiologist to look at the X-rays etc.

There are more differences comparing the live defect fix with A&E operations, see the following:

  1. No nurses
  1. No routine tests
  1. No specialist
  1. The system cannot talk
  1. The systems are all different comparing to a human body
Posted in 信息科技 | Leave a comment

Story of Coding

This summer, I spent almost all my spare time on preparing a talk in DDD (Developer, Developer and Developer) North. It was a 60-minute long talk, which literally took me 10 years, or even 20 years to get to that public stage. (Yes, do you know that our fear of standing up in front of a group and talking is so great that we fear it more than death, in surveys at least. And speaking in your 2nd language in front of your professional peers including your colleagues, your boss is even worse than that).

And the journey of my coding goes far further than 10 years or even 20 years.

In 1980s, when I was in primary school, I was chosen to learn programming in a summer short course funded by Children’s Centre in my home town in North Eastern China. It was the days that China started to learn a bit more about the world. They imported an Apple II computer and I was there with a few other kids learning the language, Basic. We did learn very basic things, wrote a few little programmes using a kind of English, if, else etc. Even it was very basic learning,  I have to say, this first touch of computer and programming planted a seed in my mind.

(To continue ….)

Posted in Uncategorized | Leave a comment

关于代码那些事

这个夏天,我几乎用了全部的业余时间去准备一个程序员大会六十分钟的演讲。台上一分钟,台下十年功,老话不就是这样说的? 今天就写写那过去的十年,二十年,甚至更久的关于代码的事吧。

第一次接触写代码是上小学的时候。那会儿市少年宫进口了一台苹果电脑,组织了一个少儿编程序班。我有幸在那个学习班学习,接触了第一个编程语言,Basic。虽然只学了几个语句,编了几个小程序,和代码第一次的亲密接触多少让我对计算机有了点儿兴趣。

后来等到上大学才真正学习写代码。大学一年级第一门编程课是学习Pascal 语言。教课的钱老师喜欢抽烟,嘴角常带着一丝微笑。他的课很好听,一个学年下来觉得意犹未尽的感觉。后来读研究生的时候,我又毫不犹豫的请他做我的导师。钱老师那会儿做系主任,见我的机会也不多,大概一个星期一次吧,在他的办公室,计算机系楼三楼走廊尽头的一个小屋。钱老师话不多,不过每次见面,跟我说的内容都很深奥。谈过之后,我就乖乖回去在图书馆里啃书本,然后去机房里敲代码。这样孤独的写代码日子让我多少有点儿自卑,怀疑自己写代码的能力,面对导师,一直都是望其项背的感觉。

研究生读过一半,钱老师安排我去一个日本公司做实习。我的工作是用COBOL语言编写程序,支持财务和人事部定制和打印报表。那是我第一份有薪水的工作。几个月下来,赚了点儿钱,不过一点儿也不快乐。现在想起来大概有两个原因,一是COBOL语言本身就很枯燥,虽然语法上更接近自然语言,代码一行行的写出来就是对数据一次次处理,转换,繁冗复杂。另一个原因是我对日本人管理的方式有抵触情绪。他们在工作时间安排上极其苛刻,上午下午各有一次休息,听到铃声才可以站起来出去走走。那段经历给了我很多负能量,对写代码失去了兴趣,对自己未来的职业也一片茫然。

后来 IBM 在学校里办了一个培训中心,大力推广他们的技术。在这个培训中心,我又接触到SmallTalk, 一个真正面向对象的语言,当时的培训老师是计算中心的牛老师,讲课也同样生动有趣。面向对象语言和之前用到的面向过程的语言相比建模更有挑战,代码的编写更接近于现实生活。面向对象的语言开辟了一种新的思维方式。这段短暂的培训让我感受到写代码有魅力的一面。

研究生要毕业的时候,我和钱老师有一次长谈,谈编程的语言,谈编程的挑战,谈未来的工作,谈这个国家,甚至谈到世界。那会儿香港已经回归了,好多外资企业进入中国,几个同学在准备去国外读书。我问他对出国有什么看法。他说他在美国工作生活过半年,去到那里的时候,他大概花了一个星期去适应环境,等半年以后回到国内,他花了几个月也没适应过来。这句话我记忆深刻,因为当时甚至现在我也说不清老师不适应的是什么。在告别的时候他对我说,工作以后再好好学学英语吧,有机会去国外看看。

毕业两年左右的时候,钱老师突然病逝。我们毕业时候的那次长谈竟成为永别。噩耗传来,又想起往事,想起老师临别时的教诲。我也从那个时候开始把学英语和出国放进自己的人生计划。后来来到英国以后,慢慢体验老师当年的感受。

来英国读博士的时候,我所在的伯明翰大学的研究小组得到了微软的支持,我又开始学一门新的编程语言: C#。微软在2002年推出这个简单的,现代的,面向对象的语言。作者安德斯·海尔斯伯格就是当年Turbo Pascal 编译器的作者。他加入微软后推出这个语言,和跨平台运行的Java 抗衡。从C# 中,可以看到 C, C++,Java 和 Visual Basic 的影子。经历了十四年的发展,微软今年推出 C# 的第七个版本。每一次新版本的发布都给开发者一个惊喜,同时也带来不得不更新技能的压力。软件的更新换代是这个行业最大的挑战。俗话说活到老,学到老,这个行业是做一天,学一天,不可以停歇的节奏。《Pragmatic Programmer 》(程序员修炼之道) 中建议编码者每年学习一种新语言。优秀的编码者都坦诚他们除了每周四十个小时的工作以外,还要花上十到二十个小时学习新的技术。

和其他行业,比如建筑,医学,法律相比,软件行业还是一个很年轻的行业。从1945年艾伦∙图灵开始在第一台计算机上用二进制编码写程序开始,这个行业才发展了七十年的时间。在这七十年里,计算机硬件按照摩尔定律发展,每十八个月,性能就提高一倍,而软件行业并没有革命性的发展。最初的面向过程,面向函数的编程模式仍然影响着今天的软件行业。今年第七版C#推出的新功能就借鉴了一些面向函数语言的特性。

写代码的过程是一个不断做决定的过程。每一行代码,每一个数据结构,每一个控制流等等都是编码者做出的选择。从这个角度来说代码也反映着编码者的思维方式。由于每个人思维方式不同,读代码比写代码更有挑战。一个编码者试图从代码里揣摩另一个代码者的心思是一件有趣而又伤脑筋的事。编程界教父级人物 Uncle Bob 在《Clean Code》(《代码整洁之道》)上说读代码的时间要比写代码多十倍还多。这个比例和我们读小说刚好相反,一个作者花十年写的长篇小说,读者应该不需要用一年的时间来阅读。那是不是写代码比写小说要容易得多?这不见得。写出代码容易,但写出高质量的代码是充满挑战的。编写代码不仅要实现功能,增加其可读性和可维护性也同样重要。现代编码的工具虽然可以帮助编码者分析,纠正,甚至直接生成部分代码,编码仍然是一件有挑战的个人创作过程。衡量和提高编码的质量也一直是这个行业探索的话题。

针对这个话题,我在英国北部地区的年度编码大会上 (DDD North)做了一个演讲,演讲的题目是《控制,控制代码的复杂性》。

Take Control, Control Code Complexity

This talk is about control, control our code, the flow, the tests and   the complexity. It might be difficult to control the border of this country, but as a developer, we can take control of our code, can’t we?

Reading code and maintaining code cost us time and money.  “The ratio of time spent reading (code) versus writing is well over 10 to 1 … (therefore) making it easy to read makes it easier to write. (“Clean Code: A Handbook of Agile Software Craftsmanship” – Robert Martin).

We can’t manage code complexity if we can’t measure. It has been forty years since Cyclomatic Complexity was developed and published in the seminal paper “A Complexity Measure” by Thomas J  McCabe.

What have we learned from this measure? Can this measure help us limit the complexity of our code? How to use this measure to guide our coding and testing? How to reduce our code complexity and make it easy to read and maintain? 

This talk will look at a real-world problem and see how we can solve the problem with less complex code. 

控制,控制代码的复杂性

这是一篇关于控制的演讲,控制我们的代码,流程,和测试,控制代码的复杂性。控制这个国家的边界不容易,作为一个编码者,我们还是可以控制我们的代码的,不是吗?

阅读和维护代码正在耗费着我们的时间和金钱,”花在理解代码上的时间和写代码时间相比要远超过十比一的比例……(因此)让代码更容易阅读,才能使代码更容易写。”(《代码整洁之道》Robert Martin, 2009

如果我们不能衡量复杂性,我们也难以控制它。据这个领域的经典学术论文–     “A Complexity Measure  -Thomas J McCabe, 1976(软件复杂度的测量”)的发表整整过去了四十年。

我们从这个测量中学到了什么?这个测量可以帮助我们降低代码的复杂程度吗?怎么样来用这个测量帮助我们写代码,写测试代码?怎么样来降低编码的复杂性,把编码写的容易理解和维护?

在这个演讲中,我会和大家一起看看怎么用尽量不复杂的代码去解决一个实际的问题。

最后,把这份荣誉送给在天堂的导师,想告诉他,在异乡,学生一直在努力。

Posted in Uncategorized | Leave a comment