Coder Social home page Coder Social logo

Comments (3)

fanhexin avatar fanhexin commented on April 27, 2024

另外再多说一句。组件设计作为面向对象编程范式的一种设计模式,本身就是面向对象的,不好与面向对象相提并论,讨论利弊。概念上组件设计是面向对象的子集。

from et.

fanhexin avatar fanhexin commented on April 27, 2024

其实应该讨论的是组件设计模式与传统只通过继承复用代码这样的设计模式之间的利弊。

from et.

egametang avatar egametang commented on April 27, 2024

1.相同逻辑放到抽象类,在复杂的继承体系是办不到的,这是你想的一种理想情况。由于只能单继承,很多情况下只能通过多接口来处理,所以才会有接口逻辑难以复用的说法
2.热插拔当然是需要的,因为逻辑可以这样判断,如果player可以骑行,那么骑行。player一直带着骑行接口,那么,这样就做不了,必须要多加额外的字段来实现。那么player身上必须一直带着这个额外的字段。我觉得很不优美。
3.面向对象三大特性,封装,继承,多态。ECS组件式设计在开发逻辑的时候字段都是public的,逻辑继承没有,逻辑多态没有,三大特性都没有或者很少有,不能算面向对象的子集。

from et.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.