i dislike go on the whole, so i hope we can find other languages that can be used as positive examples. like traits in scala. oh wait, scala is bad on the whole, too. oh well. :-(
On Wed, Jun 25, 2014 at 10:50 AM, Rob Earhart <[email protected]> wrote: > Yeah, shared code in base classes is a sadly common antipattern. It's not > so bad to provide useful static helper functions, though (although then > those don't have to be in the base class at all). > > On the pro-inheritance side, in Java, I've found it useful to provide > AbstractFoo base classes to supply default behaviors for an interface's > optional methods, and ForwardingFoo base classes to make it easier to write > composable wrappers. But Go again demonstrates that you can do these pretty > easily without inheritance, too. > > )Rob > > > On Tue, Jun 24, 2014 at 11:28 PM, Ben Kloosterman <[email protected]> > wrote: >> >> >> >> >> On Wed, Jun 25, 2014 at 4:33 AM, Rob Earhart <[email protected]> wrote: >>> >>> One of the things I love about writing code in Go is that it's all >>> interfaces, no class hierarchies. So it's at least possible. The embedding >> >> >> In C# that has both , programs with lots of inheritance are harder to work >> on and FAR harder to test and maintain than those that use a lot of >> interfaces. It is not a coincidence that there has been a significant move >> in Java and C# from inheritance to interfaces over the years. There will >> always be someone who will put crap into a base class . Personally i don't >> really use inheritance anymore in C# , maybe once in a blue moon , i always >> pull the base logic out and inject it , inheritance + generic + interface >> is just too much. >> >> I also note that shared code in base classes tends to have code not >> related to the type , with an interface the code stays closer to what the >> type is supposed to do with the extra code being injected. ( Part of this >> is due to lack of multiple inheritance but the cost of that in complexity is >> not worth it either) . Starting from what the type is supposed to represent >> ala biological categorization is a very difficult task - better to just >> represent its properties. >> >> Ben >> >> _______________________________________________ >> bitc-dev mailing list >> [email protected] >> http://www.coyotos.org/mailman/listinfo/bitc-dev >> > > > _______________________________________________ > bitc-dev mailing list > [email protected] > http://www.coyotos.org/mailman/listinfo/bitc-dev > _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
