The Liskov Substitution Principle

The Liskov Substitution Principle (or LSP) is one of the SOLID Principles, originally expressed by Barbara Liskov in 1988[BL1].
Although the authoritative sources express it in more formal language (see “Formally” below), it may be summarized as:

Clients of a Supertype S should be able to use instances of a Subtype T, without knowing it, and without undesired results.

Interestingly, the LSP is a Semantic principle, rather than a Syntactic one: as we can see in some examples (eg: “The Square/Rectangle Problem” below) the syntax of a language may be respected while breaking the LSP.

Square and Rectangle
Continue reading


Hiding a Theme Customization Section

Here’s the quick answer:

function my_customize_register($wp_customize) {
add_action('customize_register', 'my_customize_register');

Which is what you’d expect, of course. However, this little one-liner gives me the opportunity to point out a few things related to it. Continue reading