Today, I’ve put up a list of the seven most common errors that I’ve done or seen other devs make. Some will be technical, such as at the grammar or code level, while others will simply be terrible development habits. If you’re a seasoned developer, some of these will be self-evident, while others may be something you’re doing without realizing it.
This is one of the most typical blunders I notice in newcomers. Variable names like x and y aren’t particularly useful; well, it’s simple to type because it’s only one letter, and it may not seem like a major problem at first, especially in a smaller project, but the code will begin to make no sense down the road. It will be less understandable and, in general, less maintainable. I know that as a programmer, coming up with a suitable variable name might be one of the most difficult tasks. You must use a self-descriptive variable name, such as ‘age’ for storing age rather than ‘x’ or ‘y’.
For beginners, getting into the habit of utilizing source control is a smart idea. Whether it’s Git or Apache Subversion, you’re aware. You may use git from the command line, or there are several nice UI tools available. The source tree is fine, and I utilize a fork.
Using version control is also insufficient because it is only applicable to your system. As a result, if your hard disc dies or your laptop is stolen, you will lose all of your work. As a result, you’ll want to save your work to a remote repository like Github or Big bucket.
Now, whether you’re working on a project with numerous developers or just you, your code should be consistent throughout your repository; otherwise, your code will appear unprofessional and its readability will suffer.
Tutorial hell is when you keep viewing tutorial after tutorial but never feel ready to ditch the training wheels and start creating independently. It happens frequently to new developers who are unsure where to begin. It’s the same feeling you get when people constantly promote new television series to you and you’re like. I’ll never get to all of them, but the fact is that you won’t know what you don’t know until you start using your talents and making errors, and learning from them. You’ll never be able to take the next level because you don’t need to know everything about a language before you begin; all you need is a decent foundation and then you can learn as you go.
When I execute my code and get 12 errors and 18 warnings, I think to myself, “Oh crap, where did I mess it up?” But then I can’t identify where I screwed up. As a result, you must go back and start removing your code and rerunning it. It becomes a pain in the neck, therefore the best way to go about it is to make a few modifications and run your code to ensure that it looks fine.
To make a few modifications, run your code and make sure everything looks okay. In the long term, you’ll be producing more error-free code, which will save you a lot of effort when it comes to debugging.
The magic number is the direct use of a number, while the magic string is a text-based version of the magic number. So, just as when we spoke about incorrect variable names, it makes your code less understandable and potentially causes errors.
There’s virtually never a legitimate reason to do this, but I see it all the time, even at the professional level, and it just confuses me as to why this commented-out code is still in the code. It’s frequently written out because you’re thinking, “We might need this later,” but it never gets utilized and merely clutters things up.
Also, as I previously stated, your code should be in source control, so if you ever need to go back and look at past versions, you can do so.
In this post, I have stated 7 points that I feel are very useful for any beginner developer. These are some very common mistakes that I made during my starting days. So I hope this will help to get rid of those mistakes.
Thank you for reading this post. Don’t forget to follow me to read more articles like this.