Is OO design's strength in semantics or encapsulation?

后端 未结 11 1399
余生分开走
余生分开走 2021-01-30 23:28

Object-oriented design (OOD) combines data and its methods. This, as far as I can see, achieves two great things: it provides encapsulation (so I don\'t care what data there is,

11条回答
  •  暖寄归人
    2021-01-31 00:07

    As a Lisp programmer, whose object system arguably provides neither of these, I say: none of the above.

    jwz: "the pseudo-Smalltalk object model loses and that generic functions (suitably constrained by the no-external-overrides rule) win".

    I think the desirable attributes which you and others list here (encapsulation, modularity, etc.) are not as inherent in OO as you think. They're often provided alongside Java-style OO, but not purely the consequence of it.

提交回复
热议问题