Common Mistakes Junior Developers Make
As a beginner, it’s natural to make mistakes–but some mistakes can be more detrimental than others. If you’re learning on the job or in school, hopefully someone will be around to point out these mistakes… but if they’re not, or if you’re learning on your own, you might not even know you’re making these mistakes! In this article, I’ll discuss some of the most common mistakes junior developers make, and how to mitigate them.
Not asking for help when they’re stuck
The most significant mistake junior developers make is not asking for help soon enough. When you’re just starting out, you’re not expected to know everything, and it’s okay to ask for help when you are struggling! My general rule for students and on-the-job juniors is to spend absolutely no more than 30 minutes being stuck on a problem before asking for help, with the advice that it’s better to ask after only 15. Your helpers won’t be annoyed, unless you don’t learn from your mistake and keep getting stuck on the same problems–so pay attention!
Not testing their own code
It’s easy to get carried away writing code, but it’s important to test what you write, especially before submitting it for review or pushing it to a staging or production environment. Ideally, test your code as you’re writing it–finish a small piece of functionality, start the application and make sure it works, and then move on to writing the next small piece. Not testing your code as you write it can lead to bigger bugs and functionality issues later on down the line. It’s also a good idea to write unit tests as you go along, and run them after finishing each small piece of functionality to make sure that you haven’t broken any existing functionality with your additions.
Not commenting their code, or commenting their code too much
There doesn’t seem to be much of a happy medium with this mistake–I often see juniors commenting every single line of their code, or not commenting their code at all. While it’s true that ideally your code will be self-documenting due to your use of descriptive variable/parameter/function names and clearly-written syntax, sometimes it’s a good idea to leave a comment for future maintainers. If there’s a particularly tricky piece of functionality, a very strange edge case to handle, or a piece of syntax that could be less than crystal clear, it may be a good idea to leave a short comment.
Trying to be clever
Sometimes, junior developers get carried away with writing more complex code than necessary, just so that they can use fancier code syntax. Ternary operators, for example, can be very useful, but if the ternary statement runs off the screen, it’s probably better off being written as conditional blocks. If you write code that is overly complicated or unclear, it can be a challenge to debug and maintain.
Not using version control
Version control is a necessary job skill. On-the-job, it is critical for managing code changes and collaborating with other developers, for personal projects, it’s great for maintaining a backup copy of your own work. If you’re not using git and a remote repository like GitHub or GitLab, start now! Pushing your code to the cloud will help protect you from losing your code if your computer crashes, is stolen, or some other unfortunate event occurs.
When you’re just starting out, you’re bound to make mistakes… but it’s important to learn from them, and avoid repeating them! The common mistakes listed above can lead to bad programming habits, and the easiest way to not have bad habits is to not start them to begin with. Even on small projects, get used to using version control, writing clean, understandable code, pruning comments, testing/debugging as you build the project… and if you’re stuck, reach out and ask for help! These habits will keep you from spinning your wheels on a task for too long and keep you moving on your learning journey.