Applying the DRY Principle to the eCards Plugin

πŸ™‚ Like
πŸ™‚Like πŸ₯°Love 🧐Watching this 🀨Suspicious πŸ˜’Meh 😑Angry

As part of a massive code cleanup, I am applying the DRY principle to the eCards plugin:

Don’t repeat yourself (DRY, or sometimes do not repeat yourself) is a principle of software development aimed at reducing repetition of software patterns, replacing it with abstractions or using data normalization to avoid redundancy.

The first candidate for this cleanup was the image attachment feature, custom coded as a metabox.

Attaching images like this is/was dangerous as images could get unattached from other posts or pages.

Attaching images is already possible in WordPress Media Library, using the list view. Also, metaboxes have been like second-class citizens since the block editor landed, and coding a Gutenberg-compatible inspector panel requires JavaScript, which, in my opinion, adds zero value for the eCards plugin.

So, we now have a bit of back-end performance gain by removing 2 JavaScript files and dequeuing the media/upload classes.

Enjoy!

Added by Ciprian on Thursday, September 24, 2020 in Blog

Unlimited Automated Page Speed Monitoring & Tracking.
Use SpeedFactor to track your website. It’s simple and reliable.
See how real people experience the speed of your website. Then find (and fix) your web performance problems.
Get Started

Related Articles

%d bloggers like this:
Privacy Policy