f*ups that made me a better programmer
Tags: php, javascript, webdev, wordpress
Published: 2022-09-29 09:58:41

How about not spending your weekends on fixing bugs that could have been easily predicted and not rushing because you underestimated the time you will spend on a project? 

Well, read about my f*ups guide to learn from my mistakes and avoid your own! 

**Do backups regularly**

Let me tell you a story. In one of my previous jobs, I was the person responsible for making manual backups for WordPress websites. I did it every month, but one month I forgot! Guess what happened... Yeah, our website server was attacked, I didn’t think it would be significant as I made backups regularly. I thought I could just upload the last version I had, but after checking the folder on the NAS server and looking for copies, I nearly had a mini heart attack! It transpired that that month, there were a lot of changes to the website. As a result, I spend two weekends making the changes and cleaning the server. I never forget to backup now!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aa8ytn8pw5x37cqcvja7.jpg)
Pro tip – It is also good practice to make backups before making plugins and theme updates!

**Double check the sandbox version with someone before releasing it**

We have all been in a situation when a client asked for “a little amendment”? Something along the lines of “Please, make this change quickly in the live environment, it’s small and won’t affect anything”. It’s an accident waiting to happen! You agree because it’s a “small” change/fix and of course, you decide not to test in the sandbox because it’s 4pm on Friday and all you can think about is the weekend. What could possibly go wrong? Well… everything!

It happened to me a few times in my developer career, but the story I will remember forever happened on Christmas Eve… The client had asked to introduce some changes to a WordPress-based website. It wasn’t complicated but there were a few changes and very little time to implement. I still remember applying changes late in the evening when all of the guys from my team were already sipping drinks at the work’s Christmas party. I was trying to fix one tiny change that didn’t work, it became apparent that one of the elements had the ‘!important’ attribute added to its style. Of course, it was a great evening and a fantastic party (I DID NOT GET TO ENJOY). 

But I learned an important lesson from this - when you are pushing some changes that are not tested in the sandbox they won’t usually work. Finding issues can be quick but fixing them can take a long time, that time it resulted in my weekend starting at 7pm instead of 4pm!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/41zzx0owun00aee0aprl.jpg)

Now I always remember to check the fixes, changes, and features in sandbox before deploying them. It is important to ALWAYS do it, even if it’s a “small” change. It’s also good practice to check the changes with someone else.

**Take your time with the estimate**

At the beginning of my career, when I received a project to do an estimate, I usually rushed it because I didn't want to spend a lot of time on this and of course, I didn't check the details of each element in the project. 

Time for the story number 3 ;) 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nsvanpz82r0qsb2wnzlh.png)

I was working on finishing a website project for a client. The last part of the development was adding a blog section. Before I progressed with this piece of work, the PM asked for an estimate. Well... I didn’t analyse it properly nor did I ask any detailed questions. I just took a look at the designs and picked one in less than 2 minutes! During coding, it turned out that they were all supposed to have some extra features and be based on Google Analytics… long story short – a few questions and a couple of minutes spent on choosing the right design would have spared me a few hours of adapting the design to the website.   

What did I learn from this? Always remember to take time to complete an estimation. Don’t ever think; “this page is very simple, just search box and a list of posts”, and instead ask the questions and pick a solution carefully. You will save yourself a lot of time in the long run!

**Summary**

I’ve shared with you a few of the f*ups I’ve made over the years. I made mistakes and I am sure I will make more in the future. It’s impossible to avoid them because programming is so dynamic and ever-changing. But it’s always better to learn from somebody else’s mistakes instead of your own ;)

Let me summarise, these tips will help you avoid mistakes in the future:

- Remember to make regular backups 
- Let somebody else check your work in a sandbox before deploying to production
- Don’t be in a rush to estimate the job, always research thoroughly
- Don’t deploy a product to production at 4pm on Friday... It will be 7am on Monday before you know it ;)
- If you don’t know something, do some proper research or ask your co-workers for advice.

Thanks for reading and I hope my f*ups help you avoid mistakes!