When you’re a developer working with any kind of software, you are striving to get better with years. Well, at least, that’s something I think we all as people are always trying to do (get better in any skill with practice).
This is a sign of a developer who is aspiring to get better and wants to learn how to do it. I love that!
I’ll go over some answers that he got in the comments and then add my own view on it.
1. Code Reviews
Jason Bahl has suggested to ask for code reviews from other fellow developers. Here is a part of his comment:
When I started working at an organization that code reviews every pull request to the codebase I started learning a lot, often more so from reviewing others code than them reviewing mine.Jason Bahl – WP GraphQL
He also mentions to read from open source projects. Since we are here talking about WordPress, he mentioned several big and successful plugins such as WooCommerce, Easy Digital Downloads and Advanced Custom Fields.
2. Write Unit Tests
That’s a suggestion from Chase Miller. Writing unit tests can help you write quality code and also make testing easier when you’re publishing a new update.
To be honest, unit testing was a scary topic for me as well but once I’ve started working on complex stuff, I had to go into it and learn it. It actually is quite easy once you’ve gone through the instructions and a few tutorials.
Once you’ve written a few small tests, you’ll soon see how to configure the XML for PHPUnit to use and other parts that will improve your testing experience.
Something from my experience:
- Install PHPUnit through composer on the project,
- Scaffold the testing suite using WP CLI
wp scaffold plugin-tests my-plugin(while positioned in your main plugin directory),
- Install the testing environment using
bash bin/install-wp-tests.sh wordpress_test root '' localhost latest,
- Run the tests using
phpunit(if installed globally) or
vendor/bin/phpunit(if installed locally on the project through composer).
Happy testing! 🙂
3. Read the WordPress Handbooks
This suggestion came from Russell Aaron and it’s quite a good one. I myself have gone through these handbooks several times.
Here are a few handbooks you could try to read:
These two are the first I would recommend to go through. Of course, you don’t have to read it all. But when working on a specific part, try to find it in those handbooks and apply what you learn.
When you want to learn even more try these:
4. Apply WordPress Coding Standards
Using WordPress Coding Standards is something great if you’re writing plugins and themes that are going to be pushed to the repository.
These standards also help other developers read your own WordPress-related code.
Dragan Đurić suggested to have a look at the coding standards.
I would also suggest reading some other coding standards as PHP coding standards are not always (in most parts) same as WordPress coding standards. So taking a look at both it will give you a bigger picture on how people code and what you could implement in your own code.
5. Work with other people
Chris Flannagan has suggested to try and work with other people. A part of his suggestion:
Working with other people has made me grow in code maturity consistently for four years now.Chris Flannagan – ModernTribe
I didn’t improve for ten years before that. It’s vital to getting better.. Code reviews, being around smarter people than me, projects and training.
This is somewhat related to the first suggestion about getting code reviews. Working with other people will help you learn more and also faster. Some will guide you and some will be guided by you (as you become better).
I’ve learned a lot once I started working remotely such as:
- how to use Git with a large team and its workflows,
- how to fix conflicts
- how to deploy code
- and a lot more
I’ve also improved my English a lot.
6. Build Extensions for Popular Plugins
This is my own suggestion and also came from a few others. What I’ve learned in the last years is that I’ve learned a lot while working with clients on Codeable and also by building my own plugins.
When building extensions for a popular plugin, you should try to mimic their own structure and code style. That way you will:
- be familiar with the structure,
- know where something could be when issues arise,
- learn by reading their code,
- make others happy when they try to extend your own extension.
I started doing that when I was building my “Live Scores for SportsPress” plugin. With that in mind I also reduced my time thinking and figuring out where a function should go.
Just by looking at their folders, I created my own and put the code in the “same place”. This has proven an effective method when you come back a few months later.
For example, when working with WooCommerce, you’ll likely have to add a feature to a product or maybe even create a new product type. You’ll have to read their code to understand where something goes and how you can extend it.
Just by reading it, you’ll learn a bit about OOP and also hooks in WordPress.
7. Learn from others
Some people you should be reading are:
- https://tommcfarlin.com/ – Practical WordPress development tips,
- https://carlalexander.ca/ – Advanced PHP development put into WordPress context,
- Josh Pollock – he writes on his own site and on Torque,
- https://managewp.org/ – this is a list of various tutorials and articles in the WordPress community.
There are a lot of others folks that you should follow in the WordPress community and from whom you can learn a lot.
I also enjoy learning while listening to podcasts so you can read about that in my other article on “Podcasts WordPress Developers should listen to“.
Growing as a developer is not always easy. Especially, if you are cornered in a company which does not try new practices and you have to work with a codebase that’s 10+ years old.
That happens (it happened to me as well) but you should not let that stop you from learning more. With the help of a lot of people in our WordPress community, you can become a good developer.
If you have any other tips which could help people to grow as developers (be it related to WordPress or not), please share them in the comments below.