Understanding Object Oriented Programming

这是一篇很早的文章,讲的关于面向对象,原文地址:Understanding Object Oriented Programming。这里有关于这篇文章的评论如此理解面向对象编程,很有有趣。我觉得这篇作为一篇入门讲面向对象的例子还是很不错的,通过不同的例子讲述了不同人的实现想法。最后用策略模式+工厂模式来实现,来达到消除if-else。

The code on this page grew out of a discussion on the Object Technology in Computer Science Education list server. The discussion had been going on for about 36 hours in late March and early April 2000 centered on the question of “What is OO really; is it a real paradigm, different from procedural programming or is it just a packaging mechanism for procedural programming?” Both of the authors believe that it is a real paradigm shift, requiring a change in mental model in the practitioners. Winder produced the first three of the following code fragments to show the difference in styles between hackers, procedural programmers, and (naive) object oriented programmers. Bergin then added the more sophisticated OO version that appears last.

Read more