Java is a new object-oriented programming language that was developed by Sun Microsystems for programming the Internet and intelligent appliances. In a very short time it has become one of the most widely used programming languages for education as well as commercial applications.Design patterns, which have moved object-oriented programming to a new level, provide programmers w...
Java is a new object-oriented programming language that was developed by Sun Microsystems for programming the Internet and intelligent appliances. In a very short time it has become one of the most widely used programming languages for education as well as commercial applications.Design patterns, which have moved object-oriented programming to a new level, provide programmers with a language to communicate with others about their designs. As a result, programs become more readable, more reusable, and more easily extensible.In this book, Matthias Felleisen and Daniel Friedman use a small subset of Java to introduce pattern-directed program design. With their usual clarity and flair, they gently guide readers through the fundamentals of object-oriented programming and pattern-based design. Readers new to programming, as well as those with some background, will enjoy their learning experience as they work their way through Felleisen and Friedman's dialogue.
And a third?
21 Here's one more:
new Onion(
new Lamb(
new Onion(
new Skewer()))).
Are there only Onions on this Shish:
new Skewer()?
22 true, because there is neither Lamb nor Tomato on new Skewer() (查看原文)
If Java had parametric polymorphism for methods, no downward cast would be necessary for our visitors (Martin Odersky and Philip Wadler, Pizza into Java: Translating Theory into Practice, Conference Record on Principles of Programming Languages, 146-159. Paris, 1997) (查看原文)
Advantages of Java ------------------ - a small core language with a simple semantic model - gc Design Patterns --------------- Design patterns are used: - to organize your code - to communicate with others Introductory Language --------------------- Recomm...
(展开)
1 有用 硅胶鱼 2016-03-08 23:38:42
visitor pattern讲透了;最后用interface实现的Y组合字还没太看懂
1 有用 郭少 2016-01-28 11:25:37
最后一章没看太明白。晾两年回头来看,也许会明白。
3 有用 执追内修 2013-12-25 05:37:35
刚开始的时候,以为是在看函数式语言,因为new一个新的Object就像是在创建一个list一样,一层叠一层,然后就是讲解为什么需要一个visitor类,当datatype的变种变得越来越多的时候,如果要对每一种都添加一个函数的话,那就需要在不同的类中去添加并且要照顾到变种之间的关系,这就萌生了把所有变种的同名函数集中到一起,那就方便互相查看与验证。再然后就是变种的方法函数只需要一个accept就可... 刚开始的时候,以为是在看函数式语言,因为new一个新的Object就像是在创建一个list一样,一层叠一层,然后就是讲解为什么需要一个visitor类,当datatype的变种变得越来越多的时候,如果要对每一种都添加一个函数的话,那就需要在不同的类中去添加并且要照顾到变种之间的关系,这就萌生了把所有变种的同名函数集中到一起,那就方便互相查看与验证。再然后就是变种的方法函数只需要一个accept就可以了,然后调用一个visitor进行工作,等于是外包工作给任意多的有功能的函数。 为什么需要外包工作给visitor,那就是没人能一开始就写出完整无缺的程序,随着需求的修改,需要变动程序,那就是visitor pattern发挥作用的时候,可以单独的增加与原来变种平行的类,并且类之间可以互调…… (展开)
1 有用 yxnsu 2014-01-04 14:54:12
用 java 来玩 functional programming ,简单用了用 java 的类型系统。
1 有用 Sam 2016-04-01 12:59:19
Daniel Friedman的书,没得说