Language Selection

English French German Italian Portuguese Spanish

The Inverse Extension Design Pattern

Filed under
HowTos

In an inheritance hierarchy, permit each parent class's method to extend its child class's method so it can act as a decorator for its child class's behavior.

In object-oriented programming, it is common for a child class's method to extend the parent class's method. However, inverting this pattern is useful as well. Although most object-oriented programming languages support the former, I have never encountered one that supported the latter. Nonetheless, it is possible to implement this pattern without explicit support from the programming language, just as it was possible to implement inheritance in C before C++ was created.

A few interesting features of normal extension should be kept in mind. First, a child class can call its parent class's method anywhere within its own method. Hence, the child class is responsible for determining if the parent gets to go first, last or somewhere in the middle. Secondly, the child class gets to choose what to pass to the parent class's method and what to do with whatever, if anything, the parent class's method returns.

Full Article.

More in Tux Machines

Weston's IVI Shell Sees New Version

There hasn't been much in the way of exciting Wayland/Weston developments to report on this month, but its development is continuing in its usual manner. Out today is another version of the Weston IVI Shell as it still works to being accepted upstream. The weston-ivi-shell is a reference shell for Wayland's Weston compositor running on In-Vehicle Infotainment (IVI) systems. The Weston-IVI work dates back many months and today's revision to the shell marks its eighth public version as it still seeks to be accepted into mainline Weston. Read more

Python 3 Support Added To The GNOME Shell

The GNOME Shell 3.15.2 release fixes some visual glitching, improves the layout of the extension installation dialog, supports the CSS margin property, and offers other bug fixes and minor enhancements. Most notable to GNOME Shell 3.15.2 though is there's finally Python 3 support. Many GNOME components have long ported their Python 2 code to Python 3 while GNOME Shell's Python support has just received the Py3 treatment. Details on GNOME's overall Python 3 porting work can be found via this Wiki page. Read more

Clonezilla Live 2.3.1-15 Now Available with Check for 32-bit Libraries

Clonezilla Live is a Linux distribution based on DRBL, Partclone, and udpcast that lets users perform bare metal backup and recovery with ease. The developers have just upgraded the system and it's now at version 2.3.1-15. Read more

Workaround Found for Annoying Workspace Switcher Bug in Ubuntu 14.10

The virtual desktops on Ubuntu systems have been working very well in the last few editions, but it looks like there is a problem in Ubuntu 14.10, at least for the system I'm running. The desktop locks up with the workspace switcher activated. Read more