3 ms·
I think traits are a big improvement on inheritance, do you count those as as some form of inheritance? In this case I can agree with you. Personally, when I h
by orwin 4y ago
I think traits are a big improvement on inheritance, do you count those as as some form of inheritance? In this case I can agree with you.
Personally, when I have to use it, I make abstract classes or better, interfaces. I avoid direct inheritance like the plague. But I've worked on personalized Jenkins where I had to inherit classes from weird modules, so maybe I got burned and my experience isn't the average experience (also, I hate Java now).
- ThePhysicist 4y agoIn my understanding traits (I guess you mean as defined in Rust?) are more powerful than interfaces in the sense that you can define them for objects from the outside, but I don't see how you could use them to build dynamic-dispatch like functionality? Not an expert on traits at all though. I think traits and interfaces are more supportive of a composition-like programming style, one might call that object-oriented but I still think it misses several key concepts of classical object-oriented languages.