Software Engineering in Web Development, Backend Services, and More

Author: Tom (Page 157 of 430)

Single Responsibility Principle: Option Pages

Assuming you’ve read the following two posts (on the single responsibility principle and WordPress submenus), then this is a good place to tear apart the code and start trying to apply the principle.

Single Responsibility: One Reason to Change

If on the other hand, you haven’t read the posts, there are two things to note. First, the single responsibility principle says the following:

A class should have only one reason to change.

Secondly, review the code in this gist as this is the basis for the rest of the content of this article. Specifically, I’m going to be taking the above principle and try to apply it to the code.

Continue reading

Single Responsibility Principle: WordPress Menus

The single responsibility principle, as mentioned in the previous post, should be thought of as nothing more than asking the following question:

A class should have only one reason to change.

The question is far simpler than the answer, though. And through this post and the next, I’m hoping to demonstrate exactly that.

But first, I want to mention that the context for this particular question is with a relatively simple API. This doesn’t mean that the result isn’t as beneficial. It does, however, make for quicker reading and more time to talk about the application of the principle.

Continue reading

The Single Responsibility Principle in WordPress

Every time I work on a project for a client (or a side project for myself), I try to keep in mind each of the five SOLID principles.

These are often talked about by developers on numerous blogs (and I’ve done so myself on this site), so I’m not about to teach of them in this post.

Single Responsibility: One Reason to Change

Instead, I’ve been looking at how the Single Responsible Principle applies with working with various aspects of the WordPress API. And what I’ve found is that, in my experience, using this principle consistently results is far smaller classes.

My most recent experience has been in a very simple use case: Working with the WordPress API to create a submenu item and a corresponding submenu page.

Continue reading

A Pressmatic Image for WordPress Trunk

As a follow-up to yesterday’s post with using Pressmatic and a copy of WordPress from the Subversion repository, Kiko Doran asked me a good question via Twitter dealing with one of Pressmatic’s nicest features:

First, you can think of Pressmatic templates as preconfigured images that can be used to re-create a development environment. This is useful if you need to create a second or third or ninth install on your machine.

Or, better yet, it’s really convenient to have it available for your team so that you can make sure you’re all running the same image across all development machines.

Still, the question remains: Can you create an image that has trunk installed by default?

Continue reading

Using Pressmatic with WordPress Trunk

Pressmatic 1.0 was released a few days ago (with 1.0.1 made available today).

Pressmatic with WordPress Trunk

There is no shortage of options when it comes to setting up local WordPress development environments. And as with anything, there are pros and cons to each of the available products. Ultimately, this gives us a choice when it comes to setting up our machines for what works best for us.

Since the product entered beta, I’ve been reading tweets and blog posts all about it and ultimately decided to purchase it and give it a try for myself.

Continue reading

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑