摘要:UML:http://edn.embarcadero.com/article/31863The heart of object-oriented problem solving is the construction of a model. The model abstracts the essential details of the underlying problem from its usually complicated real world. Several modeling tools are wrapped under the heading of theUML™, which
阅读全文
摘要:Tell, Don't AskAlec Sharp, in the recent book Smalltalk by Example[SHARP], points up a very valuable lesson in few words: Procedural code gets information then makes decisions. Object-oriented code tells objects to do things. — Alec SharpThat is, you should endeavor to tell objects what you want
阅读全文
摘要:英文原文:I give the orders around here! 自从 9 岁那年得到第一台 Commodore 64 家用电脑起,我就开始编程。然而,当面对如何写出好的代码时,我仍然感觉自己还有很多要学的。 在探索如何提高自己的过程中,我学了很多种语言。大多数是以面向对象为主的(OO)。 然而,让我惊讶的是,在我读过的大多数书本、杂志和网上文章中,有着大量遭透了的被当作面向对象例子的代码。 这些代码中,我看到的最多被违反的原则是“命令,不要去询问(Tell, Don’t Ask)”原则。这个原则讲的是,一个对象应该命令其它对象该做什么,而不是去查询其它对象的状态来决定做什么(查...
阅读全文