PHP也很强

以前以为PHP只是ASP之类的语言,也就是类似VB Script的脚本语言。即使它是面向对象的,也无非是向JavaScript学习,有些不太强的OO特性。没想到今日一看,发现除了c++的基本特性外(没有指针而有interface,有点像c#),还扩展了一些动态的特点:可以动态include别的php,动态方法$funcname(),动态对象new $classname,这些有点c#的reflection的意思,但是调用机制那么直接,不需要一个系统的类来实现,语法本身就支持。还有一些magic method,也就是一些内建的函数,功能非常强大。除了由于是解释型的语言,性能上的差距外。简直可以用恐怖来形容。不过语言本身功能越强大,意味着越复杂,把一些复杂的功能放到系统的库里实现,让语法本身最简单,应该更合理。PHP已经是一个够复杂的语言了。no more is needed.

TOC理论与JIT的Model Storming

无意中看到一个管理学中的TOC理论(Theory Of Contraint),与传统的角度不同,不是认为自己本身什么也没有,在做一件事的时候需要创造条件去make it happen.而是假定自己或自己的团队什么都有,从限制的角度看最弱的一环,看看是什么限制了项目的成功。在敏捷的开发过程中其实就有这种TOC的思想–仅仅进行JIT(Just In Time)的需求整理(或者说是功能列表,Feature List)和建模。避免了投入过多的精力和资源到多余的地方。这也许不是一个最有远见和完美的做法,但却很实用。

转载:Pimp My Code, Part 14: Be Inflexible!

http://wilshipley.com/blog/2007/05/pimp-my-code-part-14-be-inflexible.html

……

The fundamental nature of coding is that our task, as programmers, is to recognize that every decision we make is a trade-off. To be a master programmer is to understand the nature of these trade-offs, and be conscious of them in everything we write.

You’ve probably seen some variant of this, but I’ll show you my version. In coding, you have many dimensions in which you can rate code:

– Brevity of code
– Featurefulness
– Speed of execution
– Time spent coding
– Robustness
– Flexibility

Now, remember, these dimensions are all in opposition to one another. You can spend a three days writing a routine which is really beautiful AND fast, so you’ve gotten two of your dimensions up, but you’ve spent THREE DAYS, so the “time spent coding” dimension is WAY down.

So, when is this worth it? How do we make these decisions?

The answer turns out to be very sane, very simple, and also the one nobody, ever, listens to:

“START WITH BREVITY. Increase the other dimensions AS REQUIRED BY TESTING.”