有人玩过apache Zest吗?

楼主: ripple0129 (perry tsai)   2016-08-06 21:32:17
Zest是由Rickark Oberg写的Qi4j改名而来,
且直接成为了apache的顶级项目。
讲的composite oriented programming (COP)
比起OOP更加抽象了。
https://zest.apache.org/java/2.1/two-minutes-intro.html
光是hello world我都觉得好像搞得有点复杂啊。
我没理解错误的话是
Interface 代表了一个物件然后定义行为
Class 实作行为
但是把Interface混合Class的行为才出来做事。
也就是Speaker Interface 混合 Speaker class
才出来做相对应的事。
范例是这个Speaker出来sayHello()
如果要让这个Speaker 也可以dance()
那就在Speaker 定义dance()
写个Dancer.class含有dance()
我就把Speaker interface混合Dancer class
就能够让这个Speaker也可以跳舞。
具体来说,一个物件其实可以有很多能力,
如果我把一个人定义为Speaker
基本上就限制了该人只有Speaker的能力
如果我把人就定义为Human
那我透过Human混合Speaker的能力
他就拥有Speaker的能力
我想叙述这个Human有什么能力我就混给他什么能力。
不知道我的理解有错误吗?

Links booklink

Contact Us: admin [ a t ] ucptt.com