Re:Inheritance was invented as a performance hack
by RHSeeger on Thursday May 08, 2025 @08:38AM
(#43925527)
Making the class add 2 methods and a field for every place the interface would define a field adds noise. And if you have a class with 20 interfaces, that can be a lot of noise. When you consider that the class itself doesn't actually need to know anything about the field because only the interface uses them, it's just... ugly.
[ Parent
| on HN ]
Re:Inheritance was invented as a performance hack
by int_19h on Thursday May 08, 2025 @03:58PM
(#43930664)
That's more of an issue with Java not having properties as first class language feature. In C#, you don't have to deal with fields at all, because auto-properties do all the same things:
int Foo { get; set; }