Good Programming Practice
Good Programming Practice
Read the guide thoroughly and take the basics to heart. You
can always look up the less common requirements, but
remember to always apply the rules of the style guide. Never
cut corners when it comes to this area.
One tool that can help you and your team to stay on the
same page in terms of style is Sider. Sider is an automated
code review tool that analyzes your team’s pull requests on
the 몭y to help ensure that your codebase is consistent. It can
check for violations of style, as well as code quality, and it
helps your team stay up to speed on best practices, as well as
the rule-sets for each project.
5. STAY DRY
When following the coding best practices, remember the DRY
Principle. DRY stands for Don’t Repeat Yourself, and the DRY
Principle states that “Every piece of knowledge must have a
single, unambiguous, authoritative representation within a
system.” This is also sometimes known as DIE: Duplication Is
Evil.
When you follow the DRY principle, you are saving yourself
time and energy and following one of the most important
coding best practices.
8. CONSISTENCY IS KEY
When looking at coding best practices, consistency is always
important. It’s important to do things that are similar in ways
that are similar. When you’re developing a new routine with a
functionality that closely matches an existing routine, use a
comparable name, parameter order, and structure for the
comparable name, parameter order, and structure for the
code body. The same goes for classes. Make the new class
adhere to the same interface and match any new names with
those already existing.
9. AVOID HARD-CODING
As much as possible, avoid hard-coding anything, other than
constants. System-level settings, usernames, passwords, and
other con몭guration information should never be hard-coded.
Some developers may try to take shortcuts when developing
prototypes, and then these prototypes can 몭nd their way into
production environments. This is the opposite of best coding
practices. Hard coding in these cases is not technical debt,
but could be seen as irresponsible with major consequences.
Should that code ever become accessible, it represents a
huge security risk when endpoints and access credentials are
exposed.
T r yi n g to cod e wh e n yo u ’r e t ir ed o nl y l e a d s
to-day practices. Are you t o mo r e mi s ta k e s. A v oi d i t.
Today, tools like Git and GitHub -as well as a host of other
similar repositories- make it cheap and easy to take
advantage of everything that version control has to o몭er. If
you’re not already using one of these tools, do your research
and see which one best 몭ts your needs.
And, of course, always save your work often. You never know
when a dead battery, software glitch, power outage, or worse
will happen. Anything can result in a loss of data, causing you
a lot of unnecessary stress and double work. Save your work
regularly and back it up to the version control system that
you choose. It’s a simple coding best practice to follow.
15. COLLABORATE
As a programmer, you spend a lot of time sitting at your
desk, typing away. It can be easy to think that you’re working
desk, typing away. It can be easy to think that you’re working
on something alone, but you’re not. You’re part of a team,
and you all share a common goal - ideally, to create the
highest possible product in the fastest amount of time. So, in
this way, it’s not bene몭cial for you to work alone.