How to Become A Better Developer

I was on a panel at WordCamp Seattle this last weekend on becoming a better developer. One point I repeated a few times was “read core” and a related point of “don’t rely on tutorials.”

These ideas have been circling in my head since then, so I wanted to write them down.

Are Tutorials a Problem?

Tutorials can be great for providing context for code, but they often leave the reader without the tools to work out of that context. They may come away with working code, and even be able to reuse it over and over, but often without knowing what it is they’re doing. This happened to me.

It seems to me that a lot of tutorials fall into one of three categories:

  1. Installers: This is probably what irks me most. There will be a headline that looks like “How to foo bar” and the first step is “Download the Foo Bar plugin” and proceed to explain how to set up a plugin. These tutorials may be perfectly fine for helping a user solve a problem, but the title is very misleading.
  2. Copy-Pasta: These often just describe a problem and offer a snippet as a solution but with little-to-no explanation.
  3. Over-Simplified: These are tricky. The tutorial is often really trying to teach and does so understandably by simplifying the code to the bare-bones. But they are incomplete because they skip the ‘shoulds’ (like sanitization, and security) because they’re not ‘have tos’ so that users will end up with code that technically works but with no idea that there should be more.

I’m not sure there’s hope for the Installers. Those authors should just be more careful about picking titles. Or I should be better about detecting linkbait.

As for the other two, I won’t pretend I’ve never done those. I’m also not suggesting that they have no use, but I think there’s room for improvement.

Copy-Pasta is a great way to end up with conflicting function names, a bloated functions.php file, and/or unintended side-effects.

To me, the over-simplified ones are the most dangerous because the user doesn’t know what they’re missing. It’s like teaching someone to build a car, but never getting around to the seatbelts and windshield – they’ll get in and drive on the highway and be fine till they’re not.

Go To the Source (Code)

If you want to learn how a function really works, you’ll have to look at the source. Tutorials can provide examples of how to use a function or hook, but you’re often on your own to learn how/if you can repurpose or reuse it in a different context.

I’ve faced this personally more than once, and wrote about it.

WordPress core is neither magic nor mystery (though it can feel like it at times!). It’s full of awesome gems that you may never learn about unless you dig in.

Where do you start? Try the Code Reference and look up functions that you see in tutorials. Personally, I spend a lot of time in my xref or just straight up opening core files in my text editor.

One thought on “How to Become A Better Developer”

  1. I come across a lot of tutorials which make too many assumptions about what the read understands already. I’m usually reading the tutorial, because I’m struggling to grok something. Then they provide some random chunks of code, separated by paragraphs, but since I don’t really understand it I struggle to make the code actually work. A simple working example would be incredibly helpful in that situation, but many tutorial writers do not deem that necessary :/

    Or even worse, they point you in the direction of some huge piece of code, which has their tutorial code embedded deep inside it, which when you don’t really understand how it works, is darned near impossible to extract :/

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: