Coding practices may vary.
As a general principle, things work better when they’re done right.
This also applies to code. Software developers tend to play by the rules more often than not. However, sometimes a code can be sloppy and disorganized and that doesn’t make anyone’s life any easier.
According to the ubiquitous Pareto principle, 80% of consequences come from 20% of the causes. This means that the root of all your problems lies in only a few bad coding practices.
Below are 4 deadly sins of programming:
1. Typos in Your Code
Spelling and grammar deficiencies can impact your overall programming skills.
There’s nothing more infuriating than showing off your work to your boss and seeing a spelling error.
It’s like waving a red flag at a bull.
One solution to this is to work on a decent integrated development environment (IDE) that has syntax coloring. Furthermore, you may pick easy-to-spell variables and function names just to be on the safe side.
2. Too Many Cooks
Let’s say, a team of developers works on a project over a few months or years. During this time everyone continues to ‘twist and turn’ the code and software design scope.
This, in turn, creates incomprehensive coding structures and GOTO statements that contradict with the code’s scopes and models.
You can avoid a tangled web of programming source code by leveraging lightweight frameworks, implementing layers, as well as giving unit testing some added traction.
3. Not Commenting on Your Code
Should a good code speak for itself? Only if you include comments.
We feel your pain. Nobody has the time and aspiration to narrate their code after hours of debugging or problem-solving.
Nevertheless, you shouldn’t leave your code without a translation.
Sometimes, what looks simple to you might look like a Klingon to other developers.
Always write at least a one-liner to comment on classes, methods, and other parts of your work. You’re already testing the limits of your brainpower, so don’t make it any harder by not leaving reminders for later.
When you make a mistake in the original code and need to revert the changes, version control becomes a true godsend. Furthermore, let’s not forget the fact that the log history shows you exactly who else has played in the sandbox.
Have you ever:
- Lost code or had an antiquated backup?
- Had to keep up multiple versions of a product?
- Wanted to see the difference between your code versions?
- Needed to provide global access to your team?
Version control will get you covered any time you need recovery, coherent collaboration, or improved visibility. It’s an elegant tool for a civilized world.
Trust us, not using feature flagging when rolling out new functionalities to your users is the deadliest sin of them all.
With feature flagging, new features can be deployed without making them visible to users. Likewise, if you need data migration (for example), feature toggles will prevent your work from impacting the rest of the team or destabilizing the codebase.
This article is republished from hackernoon.com