Andy’s Dinosaur Adventures

At the moment my son is really loving Andy’s Dinosaur Adventures, which I must admit is pretty well-made (even though we all miss Kip).

The premise of the show is that Andy is now working in “the National Museum” (most of the interior shots seem to be from the Natural History Museum in London; some of […]

Towards Type::Tiny 1.000000

Type::Tiny has been knocking around in some shape or another for almost a year now. It’s certainly grown a lot since its first commit. The distribution probably no longer merits the “Tiny” name, though the lead module itself is…

Horizontal Reuse: An Alternative to Inheritance

In class-based object-oriented programming, when there are classes that appear to share some functionality, this is often a time when people will refactor them into two subclasses of a common base class, avoiding repetition.

For example, in my farm model the Horse class and the Tractor class each implement a pull_plough method. (American readers might prefer pull_plow.) So this method is a candidate to split out into a Hitchable class for Horse and Tractor to each inherit from.

This would have nice benefits for polymorphism. I’ll be able to pass an object to my Farmer which will only need to check that the object inherits from Hitchable rather than having a hard-coded list of classes like Horse and Tractor that it knows are acceptable.