Comment your code.
It doesn’t really matter what code you’re writing, whether it’s HTML, PHP, CSS, Javascript or anything else, commenting your code can become very important.
There are a number of reasons why we should look to comment our code;
- If someone else has to work with your code, it will help them decipher what the hell is going on.
- It can be used to search for a specific block of code by adding key phrases/symbols to search for in the comments.
- If you haven’t worked with a piece of code for a long time, it can refresh your memory, saving you having to work it all out again.
- Other people can learn from what you’ve done.
Number 4 on that list is my favourite. I’ve learnt a great many things by seeing something I like on the web, checking out the code and having a go at building it myself. Help out your fellow developers, let them learn from your work.