Articles

Still totally undecided about implementation inheritance

In Language design, Object-orientation on September 14, 2010 by Matt Giuca Tagged: , ,

Everyone keeps saying it’s a bad thing. They cite the fragile base class problem and other various issues which I don’t really have a problem with. (The FBC problem as far as I can tell almost always is caused when someone violates the Liskov substitution principle.)

I recently went to a Go talk. Go is another in a string of languages which extol the virtues of interface inheritance and not implementation inheritance. But in most of the OO code I write (including the code I encourage and expect my students to write), I use class hierarchies with a lot of data and code re-use in the child classes, I think to great effect. Am I mistaken?

To this end I shall undergo an experiment: Having never used Go, I will rewrite the Java project I gave my students in Go, making extensive use of interface inheritance and see if there’s a natural “Go-ism” for achieving code and data re-use where my existing code uses implementation inheritance — I assume using ordinary composition and functions.

Advertisements

One Response to “Still totally undecided about implementation inheritance”

  1. Sounds like an interesting experiment, Matt. Keep us updated with how it Goes! Pun obviously intended.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: