Of all of the design patterns you could use in your code, the adapter pattern is one of my all time favourites. It allows you to abstract the implementation to an adapter that implements an interface. so you can switch implementation simply by switching the adapter.
PHP
Context-aware headings in HTML
A look at the new experimental headingoffset attribute, which lets heading levels adapt to their context instead of hardcoding h2s and h3s. A thoughtful explanation of where this could be genuinely useful, especially in component-based Read more…