What I Learned About WordPress Development by Interviewing 15 of the Best WordPress Developers

Follow along at:
http://wpshout.com/wcdenver/

Hi! I'm Fred

WPShout | wpshout.com | @wpshout

Press Up | pressupinc.com | @pressupinc

Follow along at:
http://wpshout.com/wcdenver/

Fifteen.

function roundToFifteen( $int ) {
	$int = $int + ( 15 - $int%15 );
	return $int;
}
echo roundToFifteen( 13 ); // Fifteen

What We Asked Them

What does well-written WordPress code mean to you?

What's your favorite WordPress function or API?

What tools do you find most useful in your work in WordPress?

How should people learn WordPress development?

"What does well-written WordPress code mean to you?"

What they said

Understandable

To me, good code is code that you can understand, and that you can work with, and iterate upon without serious pain.
Another developer who's not familiar with the codebase should be able to jump in and understand what's going on.
Well-written code looks like something you can understand. If you look at a line of code and don't understand what's going on straightaway, it's not well-written.

Well-Formatted and Documented

It's no coincidence that most good and great developers take time to format their code nicely.
One of the things I look for is documentation. If they're taking the time to document it, it's at least a certain level of quality typically.
Documentation is like my past self was thinking about my future self, which is nice.
"Follow the WordPress coding standards!" -Everyone

https://codex.wordpress.org/WordPress_Coding_Standards

Done Right

It's really important to think about your development patterns and standards: how you're writing things, and why you're writing them that way.
We need to make sure that if others learn from [our code], they're learning how to do it correctly, so that they're not learning bad behavior by looking at how WordPress works.
Code should be the result of a lot of thought, a lot of preparation that goes into the functionality it's supposed to bring.

Extensible

Well-written code is presented in such a way that the user can figure out what's going on, and pick it apart and add other things to it.
Code has to work for the next guy or next gal. If the code works, and then somebody can take it and run the next mile with it, then that's good code.

The Unit of Good WordPress Code is:

Innovativeness

Difficulty

Wow-Factor

Latest and Greatest Tools

Clarity

Clarity:

What am I doing?

Just starting to write, "This function should do…" That's something I do at the beginning of every function: I write the function name and then I go back and fill in the first line of my doc block and say, "This function should do this thing."

Then I know if I start diving deeper into the function, "Oh, it does six other things too." Then I start breaking it out.

Clarity:

Why am I doing what I'm doing?

Do you figure out something that just works, and not really understand why it works? That's going to cause problems later.

Clarity:

Does my code communicate
clearly to others
(and Future Me)?

Other developers have to understand what you were doing, and they have to be able to add things to it and extend it without breaking the whole thing and having to reinvent the wheel.

How to Write Clear Code

Small, Single-Responsibility Functions

Break your code up into as small chunks as possible.
As a rule of thumb, if a function is longer than 6 to 10 lines it's probably doing too many things inside it.
A function should do one thing, and one thing only.

Descriptive Function and Variable Names

Good code is self-documenting—for example, when you give a function a really good name so that everybody knows, "This function is for this action."
On a line-to-line basis, if you have to have a comment that explains what's going on, your code isn't readable, or your comment is redundant.

Daniel B's function names are beautiful: For a test that tries to display a post with multiple authors, test_display_multiple_authors()

Documentation

I look for documentation: A basic PHP doc block of what the function's supposed to do.

These can be automated in most IDEs, like Sublime Text and PHPStorm

Curtis's Code is Mostly Documentation!

Above all:

Don't do anything "just because"

Stay curious and critical about what you're doing. Don't just lie back in your pool of copy-pastes and snippets.

(This is about mentality, not current code quality)

When I got my first job in WordPress, the stuff I was doing then was terrible. And stuff I'm doing today is probably terrible.

What's your favorite WordPress function or API?

What they said

Conditionals

It makes it so easy to read, and the logic is there; you don't have to think about it.
WordPress conditionals are one of my favorite things. It's so logical, and it mimics the way you speak.
Conditionals are one of the coolest thing about WordPress: the fact that you can test against all these statuses without having to pull things out.

Other Mentions

I have a favorite WooCommerce function: Weight unit conversion. It just works really nicely. You go, "Oh, it worked! I thought I'd have to spend a half hour on that." No, it just worked.
WP_Query. That API makes it so much easier to query complex information from the database without having to write complex SQL.
The body_class() functions make theming a whole lot easier.

What I Take From This

The best code isn't:

  1. Esoteric
  2. Complicated
  3. Intimidating

The best code is:

  1. Easy to use and understand
  2. Magically simple: "It just works"
  3. A quick path through otherwise rocky territory

What tools do you find most useful in your work in WordPress?

What they said

Rundown

IDE

Sublime Text | PHPStorm | Coda

Local Development

VVV | WAMP/MAMP

Version Control

Git and GitHub | Subversion for WordPress.org business | No one likes BitBucket :\

Rundown, Cont'd

Other

Sass (CSS preprocessor) | iTerm 2 (terminal/CLI) | Grunt (task runner) | Slack (chat-slash-email-killer)

It's Not About the Swag

I use three tools: Terminal, a code editor, and my WordPress install. I like to keep my requirements as minimal as possible. If I lose my computer, I can be up and running within thirty minutes of buying a new one.
The tools you need to use are the ones that make the most sense to you. When I learned Grunt, probably within two weeks, everyone said, "Oh, forget Grunt, you've got to start using Gulp." And I looked at Gulp and said, "What does it do? Oh, it does the exact same thing? Forget it." Use the tools that you want.

How should people learn WordPress development?

What they said

Specific Authors and Sites

Pippin Williamson | pippinsplugins.com

WPSessions | wpsessions.com

Tom McFarlin | tommcfarlin.com

Post Status | poststatus.com

And a thumbs-up for WPShout (thanks Brian!)

…But mostly not by reading and watching stuff

:|

Our interviewees learned because of qualities they have

Learning By Doing

When I want to learn something, I need to sit down and do it.
Having a WordPress site pushed me into, "What is CSS? What is PHP?" Let each little task force you to learn how to write this CSS rule, how to use that PHP hook in WordPress, and so on.

Confidence

I started writing plugins as: "I have a problem, no one else is fixing it; I'm annoyed enough and I'm smart enough that I'm going to try to do it."
If someone gives you a task, and you say "Okay, let's figure out how to solve it"—you're going to do really really well. If you look at a challenge and say "Oh, I don't know how to do this" and just quit, then you're not going to go far.

Learning By Doing + Confidence =

Learning On the Job

The best teacher for me has been freelance development.
My advice is: Find someone that needs a website and build it for them. Learn what you need to do to build that website.
Sometimes my clients would ask for custom functionality, and the first thought that went through my head was, "I have no idea how I'm going to do this!" And then the response is, "Sure, that'll be X number of dollars extra." And then you go figure out how the heck to do that, because you don't know but you just committed to it.

Learning is the Job!

…Everything else is just typing

Lack of Embarrassment

The first programming practice you need to learn is to say, "I have no idea: I don't know how to do this and I am going to ask how to do this."
As far as I'm concerned, there's no stupid question, it's just a great curiosity that everyone should have. Never let anyone tell you that your question's stupid.
I got my first job by pointing to a few personal websites that I'd built for myself… in order to say, "I'm passionate about WordPress, I know WordPress, I'm a completely inexperienced programmer. Will you give me a job?" And they did.

Lack of Embarrassment, cont'd

Have your own identity when it comes to writing code for WordPress. There are a lot of buzzwords that float around, there are a lot of big bullies that will put their opinion on you, and it doesn't necessarily mean that you need to grasp or embrace that right now.
There's this element of feeling better about what you're doing through elitism, by saying, "We're so learned in what we've done, and we've created all these boundaries and hurdles to becoming an expert." And so we feel better about what we're doing. And I don't love that.

Curiosity

There's a lot of value in just trying new things: being really curious about, "What will happen if I do X thing?"
If you're always doing easy things, you're not going to develop as a developer; you've got to always be pushing yourself to learn more, and do more, and get stuck more, and get unstuck.

Lack of Embarrassment + Curiosity =

Involvement

Collaboration was a huge turning point for me. I didn't know that people actually like other people contributing to their code, until I found a typo in Underscores.

When my pull request got approved, that's when I started looking at everybody's public repos: "I can talk to these people. I have value as a WordPress developer."

Involvement, Cont'd

Go to WordCamps, and don't be afraid to meet people and engage. The sessions are great, but really they're about 30% of the value for me. The rest is connecting with other people.
I get so much out of every WordCamp I go to. For me, that face-to-face time is better than anything else.
Going to meetups or usergroups, to me, is definitely the way forward.
Talk to people. That's my best advice. Don't find a cave and work in that cave on your own. I strongly recommend physically talking to people in real life.

Involvement Becomes Support

Push yourself out, make yourself a little bit uncomfortable, and meet people. And then when you're sitting in your office and working by yourself, you'll have a Slack buddy to chat with.
I'm in a Slack chat with some other solid developers. I can ask questions and usually get an answer within twenty minutes.

That came after years of cultivating relationships with them—contributing to their projects and continuing to try to be helpful to them. Now it's an easy exchange of information.

Consistency

I just keep going. That's my secret: I just keep going.
Code every day.

Consistency, cont'd

Most interviewees have been in WordPress since around 2008.

What About Raw Intelligence?

Yes, definitely: most interviewees way smart. But their intelligence mostly an aid to confidence:

  1. "I can do this": Committing to learning under pressure
  2. "I can learn this": Seeing knowledge as attainable, not out-of-reach
  3. "Let's see what happens": Taking risks and accepting responsibilities

(You're Plenty Smart)

If you can understand the concept of algebra—how to find X—you can troubleshoot any WordPress problem.

On Impostor Syndrome

In tech circles, knowledge is social currency

…Just ask me

:|

Me During Maybe 30%
of the Code Walkthroughs

Don't Ask for Handouts

I get a lot of emails: "I have questions. Tell me how to write this code." And I say no. It's more often to people who have never interacted with me. With other people who offer value up-front, it's like, "I have time for this person."

So How Can We Learn?

Give

If they know you're trying to help, people will loan you knowledge.

(You get to keep it)

Meet, Offer, Learn, Contribute

GitHub Projects | WordPress Core | plugins | You name it

Offer value just because it's valuable.

Thank You So Much to All Our Interviewees!

wpshout.com | @wpshout



Up and Running: A Practical Guide to WordPress Development

upandrunningwp.com