Microsoft's Build Lab
July 28th, 2008
(From The Build Master )
Because a build lab tends to have some downtime while the build team waits for compiles, links, and tests to finish, it should take advantage of these slow times to work on improvements to the build process. After the lab tests the improvements and confirms they are ready for primetime, it rolls out the changes. One way to deploy a new build process after a shipping cycle is to send a memo to the whole team pointing to an internal Web site that has directions on the new process that the Central Build Team will be using in future product builds.
Today, the Windows build lab has its own development team working on writing and maintaining new and old project tools. The development team also works on deploying new build processes. Conversely, of the more than 200 customers I’ve spoken to, only one or two of them have developers working in a build team.
In 1991, Windows NT had only a few hundred thousand lines of code, unlike the more than 40 million lines of code that Windows XP has today. Even in the early stages of developing Windows NT, Microsoft recognized the importance of a good build process.
一本好书
July 28th, 2008
Hyperproductivity, and Skip To My Lou
July 27th, 2008
David Bock在给Neal Ford的 The Productive Programmer 的序里提到这个词:
We spent some time discussing that hyperproductivity and how to bottle it.
另一处提到这个词的是 Paul Virilio的blog
A worker in the textile industry in western France says, “I make the same movement six hundred times an hour. With the old machines, you could have a bit of a break. Now, it’s the computer that controls the assembly line and sets the pace.”With this level of hyperproductivity, in which a person can no longer keep up with the racing of his digital command tools, we are seeing a new epidemic, following the outbreak of stress. Repetitive Strain Injury, or RSI ─ acute inflammation of the bones and joints ─ is a new professional disease. It can lead to long-term paralysis of the employee’s hands.
但这不是──不仅仅是──身体和压力的问题。这是劳动的异化。这是现代化对人性的侵蚀。
再看一遍 Skip 2 My Lou 的 老视频 。再看一场 Rockets 的比赛。
正确的方式,高效的方式,全无浪费的方式,未必等价于有想象力的方式,美的方式,自己喜爱的方式。这才是资本主义的病根所在。
MySQL掉线咯
July 26th, 2008
一个后台操作算得太久,然后再想跟MySQL说说话的时候,就发现 那个server已经偷偷的跑掉了 。
MySQL的超时可以用SQL查到:
mysql> show variables;
看interactive_timeout和wait_timeout这两项。缺省是28800(秒),我们的服务器上设成了600。所以,一个长循环跑了11分钟之后,数据库连接已经被关掉了,因为中间没有和数据库打交道。
(多长的循环可以跑10分钟?我看到的大概是8000多和20000多的两个数组做了一下select…)
这些变量可以在/etc/my.cnf里面设置的。
Rails应用可以把ActiveRecord::Base.verification_timeout设为一个小于数据库连接超时的值(比如500)这样Rails就会帮你每过500秒PING一下数据库这样连接就不会断掉了。
(唔…10分钟会让很多东西超时,比如Apache…)
然则我们的操作是Rails之外的一个stand-alone进程,Rails也不管帮忙它,所以要在循环的过程中时不时的PING一下数据库:
ActiveRecord::Base.connection.verify!(0)
于是就可以了。
坦尼斯·塔西斯之旅
July 19th, 2008
坦尼斯突然转过身,看着南方。为什么是我?他不停地问着自己。我对自己的未来毫无概念,大家却都希望我领导他们。我没有像史东一样有驱逐恶龙,成为修玛第二的理想。我也没有像伊力斯坦有着把真神的知识散布给每个人的神圣使命。我甚至不像雷斯林热衷于追逐强大的力量。
史东推推他,示意他往前看。一线低矮的山脉出现在地平线上。如果坎德人的地图是正确的,塔西斯城就在这些丘陵的后面。
塔西斯,有翼的白色天鹅船,白色闪耀的高塔。美丽之城塔西斯。
好的设计从哪里来
July 19th, 2008
河里的青蛙从哪里来,是从那水田向河里游来。
这样的设计调整 遇到过多少次?
基本上,每个项目都有,一年两三次吧。
下次做复杂的功能之前多做点设计吧,免得还有类似这样的调整。
好的设计真的不是做出来的。它是长出来的。
测试驱动出来的高质量的代码基础就像土壤,平时的持续集成和重构就像精耕细作。播下问题的种子,你就看着它长出来。有时候自然长出来的设计不对,于是你调整它。好的设计就在不断不断的调整当中浮现出来了。
(所以,一开始的设计是好的固然好,但更重要的是调整的能力。有些项目,好的设计会慢慢浮现出来。有些项目,好的设计也会慢慢腐化。)
可是,什么时候该忍着,什么时候才该动手调整?
不知道。不过,程序员的鼻子(和胃)知道。所以,别烦他们,别拿进度之类的玩意吓唬他们。给他们轻松,他们就会做出正确的事。
不然,反正你也没办法知道什么是正确的事。
工业界是时候严肃认真了
July 14th, 2008
偶像切尔斯基:敏捷质疑: TDD
我认为工业界是时候严肃认真的考虑测试环境了, 最好在语言中内建对测试的支持, 一些为产品环境设计的语言特性, 应该在测试环境中关闭, 而在产品环境中生效. 其实之前很多编译器都支持 Release 和 Debug 两种环境, 也是从代码质量的方面考虑的. 现在毫无疑问证实单元测试比 Debug 更有效, 是时候与时俱进增加对 Test 的支持而逐渐罢黜对 Debug 的支持.
不过我认为工业界是时候严肃认真的考虑的不是内建对测试的支持而是对类型推导的重视。要让程序不出错,一大堆和更大的一堆错误侦测机制都解决不了这个问题,你应该写不会出错的程序。当然debugger本身就是一个鸡肋,在exception stack trace帮不了你的情况下,debugger也帮不了你。
(写出像 Erlang 那样不会出错的程序吧。写出像 Haskell 那样不会出错的程序吧。)
尤其是在并行计算的时代。当然就算不考虑并行计算,类型体系是能让程序不出错的严肃认真的办法。写得快并且具有类型推导的语言是应该被严肃认真的考虑的。
Rewrite :default task
July 6th, 2008
Rake::Task[:default].prerequisites.clear task :default => %w(db:test:prepare unit functional)
Essentials of Software Process
July 3rd, 2008
From IEEE Software
... human-centricity, technical orientation, discipline, pragmatism, empiricism, experimentation, and value orientation.
I like this most:
A disciplined process applies its chosen technical practices CONSISTENTLY, if not BLINDLY. These practices may include coding standards, frequent builds, requirements modeling, architecting, informal design, code inspections, regressive unit testing, and exploratory testing. A disciplined process also consistently applies management practices to coordinate activities, share knowledge, and control product artifacts.
JavaScript跑太久…
July 2nd, 2008
IE就瞎菜了…傻了吧唧的蹦出来问“好像浏览器上有个操作死菜了,咱把它干翻吧?”烦人还是小事,十有九个人会点“Yes”,然后就真干翻了…
(根本原因是IE6/7不支持XPath,于是只好遍历DOM来找东西,which is非常慢啊…从一个500K+的DOM里找到一堆东西,Firefox只要几十毫秒,IE6要用到1秒…)
(试了一下 JQuery的CSS selector ,搞了个折中,IE6和Firefox都一百多毫秒,然则还是不够…几组查询下来IE还是瞎菜了…)
于是用空间换时间,在page上建索引。然则还是不行,因为最耗时的操作不止这一个…
于是把耗时的操作摘出来,原本都在onload里做的事情放在DOM loading的过程中,变成几百个小块来做。最耗时的两个操作,组装过滤列表和查询,用setTimeout变成异步的。
(这个时候很得意的问 郑晔 :“阻塞操作太长怎么办?”得到答案:“搞成异步的。”)
然后一边唱着“牛x闪闪放光芒”,一边就发现break了另一处的功能…这个组件是被很多地方以很多方式重用的…
紧接着伤心地发现这块JavaScript已经非常混乱而难以理解了…重构迫切需要中…多想用JavaScript搞出如同Erlang一般优雅的并行计算序列啊…
(为什么每次感到很牛x的时候总会紧跟着很失落的发现有一大堆破事搞不定呢…这就是程序员的宿命吧…)




