Tom McFarlin

Software Engineering in WordPress, PHP, and Backend Development

Page 4 of 424

Thoughts on the Upcoming WordPress Admin Redesign

During this year’s State of the Word, the new design for the WordPress administration experience was discussed.

As described by Matias:

As WordPress turns twenty years old, the overall aim of this work is to improve upon this experience at a foundational design level, giving plugins and users more control over the navigation while ensuring each WordPress experience is recognizable, intuitive, accessible, and delightful.

The full posts lays out the high-level plans for how they plan to move forward and I find the Scope section one that’s most relevant for developers (and designers who write code, as well).

This dude is completely stoked about the redesign.

It’s too long – and redundant – to post here, so I recommend reading it via the aforementioned link.

The Upcoming WordPress Admin Redesign

As a developer who’s worked in this space since “The Kubrick Era” (is that even the way some people refer to it?) and has been involved through the years of Gutenberg development, I have some thoughts relevant to the announcement that I’m sharing for posterity to see how things pan out as this project begins.

  • I was a fan of the UI refresh we received a few years ago and I’m excited about what’s planned for this one, as well. It feels like it’s going to be much bigger but it’s easier to say that when we’ve been working with the current UI for so long (and I remember the design before that – it was no small undertaking to update it, either).
  • I’m looking forward to seeing how hooks are going to be updated (and if anything new will be introduced in terms of what we’re able to do within the admin). Will be using JavaScript to work with them more? How does PHP fit into this?
  • I’m curious as to how other things have not been updated in some time (such as certain Settings screens) will be updated beyond revamping the UI. That is, part of the WordPress philosophy used to be decisions, not options but I’d say the software isn’t as decisive as it could (or should?) be. My guess is most of the options are going to stay the same, but the general look and feel is what will change.
  • I hope to see clear documentation provided for each release for developers, designers, and users to help make it clear how to achieve certain tasks. That was a challenge within the Gutenberg-era – things that worked in one release didn’t worked in a new release and the cycle was happening to fast, it was difficult to keep up.
  • I’m very interested to see how plugins will inherently interact with the new UI given many are built to perform, look, and feel native within the existing UI.
  • Performance is something that’s always a concern and if you’ve done any profiling or network monitoring within the tools the Chromium-based browsers provide, it’s evident that there’s some things that could be refactored. Is now the time? (I’m genuinely asking – this isn’t a loaded question.)
  • I’m curious to see how well the existing Block Editor will fit within the context of the new experience. Will anything need to be modified, adjusted, or tweaked to make it feel more natural or is the Block Editor, as we know it today, more-or-less standardized?

But that’s not all there is to say about it. A lot is going into the overall project especially given this is just the third phase of a larger roadmap.

Change Is Hard

As the cliché goes, change is hard. But working through change when there are so many opinions on how the change is going makes it ever harder. Further, all the training material that agencies and organizations have as well as the material they will produce are eventually going to need to be updated as the new administration area is released.

Not that kind of change. Though I guess it’s technically hard, too.

I know the ultimate goal is to have more modern administration experience that’s easier for all types of users and I’m excited to see it come to fruition.

There’s likely going to be some friction – as is the case to come with any major updates – but I’m optimistic that we’ve learned a lot from how Gutenberg was initially developed and rolled out and I hope to see others work even more closely with the administration experience to make the transition easier both for developers and users.

I Didn’t Want to Resist Gutenberg

Though I wouldn’t say I resisted Gutenberg, I definitely found plenty of times where wasn’t ready for how I wanted to use it. The learning curve was forever influx because of the how the underlying technologies were changing or how the implementation of those technologies were changing.

Dude’s as scared of this printer as some were of Gutenberg.

To put it succinctly, trying to adopt it into my day-to-day work was a challenge.

Thus, it made me slower to adopt it both as a user and as a developer until it reached a certain level. Now it’s stabilized to a point where I both enjoy writing with it and have learned enough of the APIs to build out custom blocks for my day-to-day work in a consistent way (yes, even as one of those old people who primary works with server-side technologies).

I Don’t Want to Resist the Admin Redesign

To that end, though I recognize there are going to be inevitable hurdles to cross for this update, I also think this is a time in which lessons learned over the past few years can be applied.

Maybe we’ll receive the new admin like this. This computer is hugging back with a hand of its own.

Even though it’s not a one-to-one comparison, overhauling a major component of an older piece of software once yields plenty of learning. And I hope to be more present at least in terms of making sure the things developers enjoy – such as certain actions, filters, and other things with regard to menus, settings pages, options, and so on – are easy to learn and make sense when it comes time to migrate our code.

You Will Sometimes Work With Incompetent People (Or Will You)?

Some of the definitions for incompetent:

  • lacking the qualities needed for effective action
  • unable to function properly
  • not legally qualified
  • inadequate to or unsuitable for a particular purpose

Given this, it’s more than likely we’ve all been the incompetent one on the team at some point in our career. Depending on the nature of the work we do, it’s reasonable to assume we could all be that person whenever we join a new team.

This isn’t to discount the skill experience teaches, but each time you start a new project (greenfield or not), there’s going to be a period in which you have to learn enough about the problem domain to actually start making meaningful contributions.

All of the above is a longer way of me delaying commentary on the claim that we’ll work with incompetent people. It’s uncomfortable to discuss because we’re making a claim about peers who are not incompetent because they’re just getting started in their career or because they are the new person on the team.

They’re considered incompetent because they aren’t able to fulfill the responsibilities, obligations, and/or demands of their job because of any one point of the above definition.

So given the claim we’ll sometimes work with incompetent people and given the definition above, how true is it that we’ll sometimes work with incompetent people?

Will We Work With Incompetent People?

In my experience, the only time I’ve truly worked with anyone incompetent was because of a willful desire to not learn what was necessary to do the job. And by that, I mean the person had the potential to actual do what was asked of them but achieving said potential required a level of effort they were unwilling to put forth.

Therein lies how a person can become incompetent not only in the field of development but generally in any field:

  • There’s a problem that needs to be solved,
  • The problem exists in a domain that requires a level of discovery and/or education (and not necessarily in the academic sense),
  • The person opts out of discovery and/or education,
  • The person can’t solve the problem,
  • And thus the person remain incompetent in their job.

Because some organizations still allow you to draw a paycheck without doing more than the bare minimum, there isn’t always a strong incentive to get better at whatever is asked.

And if this is what it means to work with incompetent people, then yes. It happens.

On Willful Incompetence

People don’t necessarily want to remain willfully incompetent, though. In my career [so far], there are plenty of times in which I would be labeled incompetent not because of my inability to ever solve the problem, but because of my inability to solve the problem at that time.

Given enough time, training, and/or information as well as enough motivation, it’s possible to move yourself out of that position and into one that enables you to get the work done.

Not only that, assuming you’re a person who is working with someone who may be currently incompetent but needs more information to become familiar with the problem domain, it’s also possible for you to be the person to help them move from one arena to the next.

In other words, if you see a need, meet it. If a colleague is unable to achieve something that you’re able to do, don’t attempt to subvert their attempt and solve it yourself.

Give them whatever help necessary to give them enough information to move forward and, assuming they’re motivated, they’ll move into the arena of being able to solve the problem.

On the Original Article

An incompetent developer who’s more interested in his fidget spinner. Generated by Imagine by Meta.

Finally, I wanted to make sure I link to the original article to see the context in which this claim was written as well as the author’s experience. In trying to summarize what’s listed here, I’d say it’s something like this:

  • Dealing with incompetent colleagues in the workplace can be frustrating and time-consuming, creating a toxic environment that affects productivity and deadlines.
  • Working with such individuals can lead to significant delays, ultimately costing companies both money and resources.
  • The frustration and challenges posed by incompetent colleagues can prompt individuals to spend considerable time strategizing ways to navigate around their lack of competence.
  • In certain situations, individuals may lack the complete context behind someone’s performance issues. There are instances where individuals struggle to perform well due to an overwhelming workload, juggling responsibilities meant for two people and hindering their ability to fulfill their job adequately.

So, yes, there are differences in what he’s experienced versus me. I’m not arguing his claim (any more than I’ve done so in the past articles). I’m just stating my observations, experiences, and ideas on how to mitigate the situation.

Final Outcomes

Ultimately, I find that one of two outcomes will happen:

  • The person will be motivated and needs more information to get started.
  • The personal lacks motivation and desire to do more than the minimum amount of work. This will be a hindrance, but there’s very little that can be done about it.

Whatever the case: Don’t dismiss incompetence on its face. Perhaps the person needs more help. And in any case, good luck.

Someone Has Likely Already Written Your Blog Post

This morning, I was going through my RSS reader. In one of the programming feeds that I read, I read two different articles both of which were talking about Git.

Each were talking about something that has been discussed I don’t know how many times over in the past by someone else:

  • Should dependencies be kept in Git or now?
  • And an outline of Git branching strategies.

It’s easy to look at posts like this – just like I can look at stuff I’ve written and realize it’s been discussed by someone else or you can look at stuff that you’ve written and find something similar has been written by someone else – and want to dismiss them.

That’s not the best way to think about publishing practical technical content, though. Even though someone else has likely already written your blog post, that doesn’t mean it isn’t worth writing.

  • You have a different audience than whoever you’ve come across. And although you may be reading something similar to what you’ve read or written, that doesn’t mean that whoever reads your site is reading those sites.
  • Writing for others is important, but it may be just as important if not more important than writing for yourself. Distilling your ideas into something that you can explain is incredibly helpful in making sure you solidify the information you’ve learned.
  • Writing something this year can be different than writing something a few years ago (and will be different in writing it in the future). The economy and environment changes fast.
  • The context in which you’re sharing knowledge and explaining your ideas may be similar, but not exactly the same, as someone else.

The next time you attempt to write about something and are skeptical if you should hit publish or not, go ahead and hit publish. At best, you’re helping yourself and maybe someone else will come across what you’ve shared; at worst, you’re sharing something someone else has shared but it’s unique to what they do.

And since similar isn’t the same as unique, the value of publishing what you have to say is greater than not.

Thanksgiving 2023

For nearly every year I’ve written, I’ve made sure to publish a post on the end-of-the-year holidays here in the United States.

Happy Thanksgiving!
This is the earliest Thanksgiving photo I have in my library.

It’s neat to see what I wrote on this day 10 years ago in comparison to now:

For those of you who are in the United States and are celebrating Thanksgiving, I hope you guys have an awesome day hanging out with your family, friends, eating, sleeping, and generally enjoying the day off.

A lot has changed both personally and professionally since then (though I’m still working in the same industry and enjoying it as much as I always have), but the message is consistent: If you’re in the US, I hope you enjoy the time off; if you’re elsewhere, I hope you enjoy whatever you’re doing today, too.

How To Mitigate Side Effects in WordPress Development

In software development, the concept of a side effect is generally understood to be something like this:

In computer science, an operation, function or expression is said to have a side effect if it modifies some state variable value(s) outside its local environment, which is to say if it has any observable effect other than its primary effect of returning a value to the invoker of the operation.

Side effect, Wikipedia

The Software Engineering Stack Exchange has a great answer. You can read it in its entirety, but I really like how succinct the person puts it:

It’s really very simple. Side effect = changing something somewhere.

There are a handful of ways developers try to mitigate side effects such as automated testing or quality assurance, but when a piece of software is large enough such that each part that composes the system is like a small system unto itself, it’s not difficult to imagine how introducing new code could inadvertently change the state of the program.

This is why any given project at scale is impressive to see work as smoothly as it does. (Sure, projects like large scale web applications, operating systems, are one thing but thinking about medical software, automotive software, the software that runs on airplanes, applications built at places such as NASA, and so on are all the more amazing.)

Bringing this down to the level of stuff I write about and that I work on during my day-to-day – specifically WordPress – side effects are something we’re likely all too familiar with experiencing.

If nothing else, think about the last time you activated a plugin and it immediately conflicted with another plugin or a feature of theme.

  • It could have thrown up a notice,
  • It might have displayed an error message,
  • Perhaps it completely broke the way some part of the way the core application functions,
  • Or it just threw up a PHP error message that wasn’t even clear on what was going on.

To make matters even more fun, the only way to resolve the issue is the disable the plugin via WP CLI or, even more drastic, deleting the plugin.

This is an obvious example of a side effect in WordPress. They can happen for any number reasons, too. Sometimes it’s a matter of running a different version of PHP, it could be a matter of a team not keeping their code contained in its own namespace, or perhaps it’s a matter of not doing enough testing.

Regardless of the case, it’s something many of us have experienced and it’s likely a problem many of us have caused during our careers.

Initially, when I started thinking about side effects in WordPress development, I was working on a plugin that needed to fire when certain events happen during the user management lifecycle.

From there, I started thinking about edge cases and then I started thinking about the overall economy around WordPress and the interoperability and compatibility challenges that come with writing software that runs on top of a piece of open source software that powers so much of the web.

It’s impressive.

Then I was left at a fork of what I wanted to discuss:

  1. Should I talk about the initial problem that kicked off this entire post (that is, making sure I handled all cases of user management)?
  2. Or should I offer general commentary on edge cases and how it relates to work in building WordPress or WordPress adjacent projects?

If you’ve read this far, it’s obvious that I’ve spent more time on the latter than the former. So I’ll save the former for another day.

Since I’ve discussed this at length already, these are a few things – in no specific order – I recommend doing the following things to prevent side effects and conflicts when working on WordPress-specific code:

  • Even if you’re not using object-oriented programming, use namespaces to keep all of your functions contained within their own context.
  • Know the environment(s) in which you’re code is going to run and write for the lowest supported version.
  • When writing a custom function that will fire on a specific hook, take the time to understand the priority and number of arguments the function will expect and write your code defensively (that is, ask “how would I write this code so someone else’s won’t interfere with what I’m trying to do?”)
  • Don’t be afraid of writing unit tests not only to ensure your code is doing what it’s supposed to do but also that it’s not doing anything it shouldn’t be doing.
  • Before writing anything to any type of storage, make sure that the keys you’re using are not already in use and/or make sure to uniquely prefix the keys you’re going to use.
  • Don’t add frontend assets to any page that doesn’t need them.

I don’t know if it’s possible to put together and exhaustive list. But in my experience, these are the things that I’ve found to be helpful especially as it relates to working on backend development.

« Older posts Newer posts »

© 2024 Tom McFarlin

Theme by Anders NorenUp ↑