Timeline for Should I avoid using object inheritance as possible to develop a game?
Current License: CC BY-SA 4.0
26 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 13, 2018 at 23:04 | history | protected | DMGregory♦ | ||
| Jul 13, 2018 at 19:50 | answer | added | Dragan Juric | timeline score: 2 | |
| Jul 13, 2018 at 19:42 | answer | added | Christopher Hoffman | timeline score: -3 | |
| Jul 13, 2018 at 16:39 | answer | added | Sava B. | timeline score: 1 | |
| Jul 13, 2018 at 11:14 | comment | added | Emanuele Paolini | I would say that an interface is a particular case of inheritance where the base class contains no data fields. I think the suggestion is to try to not build a huge tree where each object must be classified, but instead a lot of small trees based on interfaces where you can take advantage of multiple inheritance. Polymorphism is not lost with interfaces. | |
| Jul 13, 2018 at 6:09 | answer | added | AnoE | timeline score: 20 | |
| Jul 12, 2018 at 23:47 | history | edited | Vaillancourt♦ | CC BY-SA 4.0 |
Fixed title and tags.
|
| Jul 12, 2018 at 20:53 | comment | added | Dunk | @agweber-Sorry, apparently I had dyslexia with my typing:( It was supposed to say ECS (Entity-Component-System), which I would have typed out if I had enough characters left. | |
| Jul 12, 2018 at 18:49 | comment | added | cwharris | Bottom line: write what you and your colleagues are most comfortable with in terms of productivity and enjoyment, and always keep learning and sharing new things. Your preferences may change, but you should never sacrifice your work in favor of the craft... unless you're just doing it for enjoyment. :) | |
| Jul 12, 2018 at 18:44 | comment | added | cwharris |
@Dunk interfaces have little to do with composition, strictly speaking, except when needing to compose two or more ways of doing something, or where something needs to be treated in multiple ways where the "users" need not know the concrete class they are utilizing. A good example of the latter being ICollection, IList, IEnumerable`, etc. Lots of different implementations of those, and I don't always need the indexer of a list if I'm doing a non-mutative enumeration of it. Composition is about breaking things in to reusable loosely coupled parts, not necessarily writing interfaces.
|
|
| Jul 12, 2018 at 18:39 | comment | added | cwharris | I would like to point out that composition can replace inheritance for absolutely everything except when an external library requires you to implement virtual methods. Even in that case, it is possible to quarantine inheritance in such a way that composition can be used for all interactions with the sub-class. I'm not saying it's the most effective way in every case... but I haven't written but one abstract class in the past 5-6 years, and I had to go back and factor it out in favor of composition because I needed more flexibility. Most of what I write is concrete classes. Not interfaces | |
| Jul 12, 2018 at 18:38 | answer | added | StackOverthrow | timeline score: 3 | |
| Jul 12, 2018 at 18:15 | comment | added | agweber | @Dunk What is a CES design paradigm? All I find when I search is Consumer Electronic Show. | |
| Jul 11, 2018 at 22:29 | comment | added | Dunk | People tout using interfaces over inheritance in any form of development. However, it does tend to add a lot of overhead, cognitive dissonance, leads to class explosion, frequently adds questionable value and usually doesn't synergize well in a system unless EVERYONE in the project follows that focus on interfaces. So don't abandon inheritance just yet. However, games have some unique characteristics and Unity's architecture expects you to use a CES design paradigm, which is why you should tweak your approach. Read Eric Lippert's Wizards and Warriors series describing game-type issues. | |
| Jul 11, 2018 at 18:01 | answer | added | Bill K | timeline score: 6 | |
| Jul 11, 2018 at 14:29 | history | tweeted | twitter.com/StackGameDev/status/1017053245733244928 | ||
| Jul 11, 2018 at 13:15 | vote | accept | modernator | ||
| Jul 11, 2018 at 13:14 | comment | added | modernator | @Hawker65 He told that must not use inheritance first. So I asked him the actual cases that I can accept and understand, and now he said that "Everything has it's pros and cos. ..skip.. So in brief, class changes final object from inside, but interfaces are just combining them from outside. It is important to do anything properly, but most design pattern recommends using interfaces instead." | |
| Jul 11, 2018 at 13:00 | comment | added | modernator | @Cubic I never said that polymorphism is a pattern. I said "... one pattern I really enjoying is the polymorphism". It means that the pattern I really enjoy is using "polymorphism", not polymorphism is a pattern. | |
| Jul 11, 2018 at 12:59 | comment | added | Hawker65 | Did the person who suggested you interfaces were better than inheritance give you any arguments? I'm curious. | |
| Jul 11, 2018 at 12:55 | comment | added | Cubic | "There are so many advantages, and one pattern I really enjoy is polymorphism." Polymorphism isn't a pattern. It's literally the entire point of OOP. Other things like common fields etc can be easily achieved without code duplication or inheritance. | |
| Jul 11, 2018 at 12:33 | comment | added | Jan 'splite' K. | duplicate gamedev.stackexchange.com/questions/16677/… ? (idk...) | |
| Jul 11, 2018 at 11:05 | history | edited | Engineer | CC BY-SA 4.0 |
added 3 characters in body
|
| Jul 11, 2018 at 10:54 | answer | added | Engineer | timeline score: 67 | |
| Jul 11, 2018 at 10:27 | answer | added | Linaith | timeline score: 14 | |
| Jul 11, 2018 at 9:36 | history | asked | modernator | CC BY-SA 4.0 |