In my 8-9 years of programming career, I've came across many software, code editors, programming languages, software companies, team leaders, project managers and my changing self as a programmer. These 8 rules are just a summary of what I still do in daily life. I am following way more than these 8 rules, but these rules are very close to my heart. I thought of sharing with you guys. Here they all are.
1. Keep Your Source Code Easy to Understand
The goal of the source code is to explain future programmers or maintainers what the code actually does. Sometimes there might be many future programmers, or it might just be you. So, in any cases if the code is easy to understand then there will be less headache for you and for others.
Use this trick: If you can understand what the code does in less than a minute by just looking at the comments and the code then it’s definitely well written.
2. Take notes of your ideas
This rule applies to all fields. We can say that it’s universal. Whenever you are coding and any thoughts come to your mind, just grasp it, wrote down to your notebook so that you can implement it later on. Sometimes the thought is so fast and quick, it could just slip away from your mind and when you are thinking about some new tricks, some new problem-solving technics, you should write down that thought by taking time from your thought process.
Use this trick: I keep my to-do list open whenever I am coding. It takes few seconds to write down my thoughts. I have implemented many of them later on and I am glad that I am grasping those quick thoughts.
3. Be Super Positive
You are going to run into many errors while coding. You need to keep working on that thought to make that thought a reality using coding. And for that you’re going to need lots of mental toughness.
Use this trick: Read developer stories so that they can inspire you. You are not alone. There are many people who faces errors everyday and on somedays they couldn’t even solve it. They go after it on the next day with a different approach. Learn from them.
4. Think Twice, Code Once
This quote is on my laptop as screen saver. It inspires me to think every time I unlock my laptop. Rushing to code is one of the popular mistake developers make. Have you ever heard of how Google employees and Facebook employees code? They spent time to think about the whole idea and then they develop plan together to write down the code in a team. That’s how they develop big functioning websites with complex functions. Its simple rule. If you want to make a taller building, then the base has to be really powerful.
Use this trick: Remind yourself to think more about the problem before solving it. Use some wallpaper or screensaver to remind yourself unconsciously.
5. Copy, but wisely
It’s really common to copy someone else’s code if that feature is not a grate idea itself. For example, full background image code or some buttons and form code. You don’t need to write down each line by yourself. But whenever you use someone else’s code, use it wisely. For example, let’s say you have a website and you want to implement comment system into it, and you are using someone’s code which is freely available for anyone. Now, before you just implement the whole code, make a line to come back your original code just incase that code doesn’t work properly or in ace it messes up your website. For example, the CSS has some tags style which creates a problem when you try to include it into your system. So, if you have a safe point where you can go back then it’ll be helpful to go back and start all over again.
6. Don’t throw away old code
We all have faced this situation in which we write down new code and delete the old one because the new code it super easy to understand and implement. But my deal friends, all keep your old code so that in future you can use it when you need in different situations.
Use this trick: Keep a used folder under same project name with OLD keyword in the name and add your old code to it with the file name and what it does. It’ll be handy someday.
7. Give your variables and functions meaningful names
Try to give variables and functions meaningful names rather then function1 or variable1 or x. When your project is small and code is just of few lines, you won’t be able to feel the difference but when you’re working on a big project and when the lines are in hundreds and thousands, you’ll feel the huge difference.
Use this trick: Give the same name to the function and variable according to what it does. For example, if it calculates something then SUM and if it’s a supporting function to an algorithm then try to add names of major calculations it does using underscores like function1_temp_multiply and function2_temp_sum.
8. Your code editor is your motherland
I mean it. Once you choose your editor, stick with it. Learn to use your code editors completely and follow its updates. Learn those new updated things and I am sure it will make you code faster. Learn all the shortcuts as well.
career coding professional programming rules