How to contribute to Open Source NOW – Coding a solution.


In the previous post ( see: How to contribute to Open Source NOW – Finding a good issue to Fix ) we went through the process of finding our first issue to start contributing to open source.

In this article, we will continue the process and write the solution.

More than coding the solution to the problem we chose, we will outline a general approach to solve an issue once you’ve find it. I find more valuable to show the process that goes through my mind when dealing with issues, rather than the technical stuff of coding the solution.

So let’s start!

As you may remember, we are going to solve this issue:


 

So … how are we actually going to approach it?

The first thing we have to know whenever facing a new issue is to get what the issue is about.

We see that this particular problem has some relevant words, the first one being “admin notice” and the second one “persistent object caching is not present”.

To be fair, the problem is pretty self explanatory, but we have to always have a general understanding of what the problem is about, so we can come up with a good solution to it.

In our case, our solution would be to display an admin notice in the WordPress Admin Area of the AMP plugin if “persistent object caching” is not present.

This particular problem has an easy part and an “unknown” or hard one .

The easy part of this problem is that the logic behind the solution has been given to us already ( Display an admin notice, if “something else” ).

The hard problem (for most of us at least) is: what the hell is “persistent object caching” and how does it work within WordPress?

This is something you will have to deal constantly when solving github tickets: you will know something about the issue, but you will not know anything about some other things.

The obvious answer to this challenge would be to google what you do not know and become an expert at the current topic you are fixing.

That, however, would be a major issue.

Why? you may ask.

Because, let’s say you spend 3 weeks learning about persistent object caching. You have become the dungeon persistent master and an authority there. And, that’s cool, but that expertise is not really needed to solve this (and most problems).

The urge to go out and learn about everything could be hard to stop, but i highly recommend you to take a breath and analyze your problems better, mainly ask yourself this question:

How can i solve this problem in the least time possible?

Fortunately, our real life example is great to show this.

Yes, we could study about persistent object caching for weeks, but what do we really need to know? if persistent object caching is present. 

So, with that in mind, we know that we don’t have to become proficient at the whole topic of caching in WordPress, but rather, we have to become proficient at knowing how does persistent object caching works in WordPress and mainly: how can we check if it is turned on? 

We have a pretty good question to start googling to, so let’s go and search a little:

We have a pretty good result in stack, so let’s go and see if it answers our question:

Bingo! We now know what triggers persistent object caching on and off. With that in mind, we will start coding our solution in the next post.

Summary

The key distinctions from this article are:

1.- Get a general understanding about what the problem is about

2.- Define what you do know as well as what you do not know about the problem.

3.- Define the minimum knowledge required for you to solve the problem by asking the question: how can i solve this problem in the least time possible?

4.– Google those minimum requirements and start building a solution from there.

5.- Try to minimize as learning stuff you do not need to know as much as you can.

On our next post, we will continue solving this problem.

Until next time and happy coding  😉

 

Leave a Reply

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