Coding Guidelines

Always try to take pride in your work. Here are just a few things that can help you do just that.


“Nothing can be quite so helpful as a well-placed comment. ... Nothing can be quite so damaging as an old crufty comment that propagates lies and misinformation.” — Robert C. Martin


Not writing unit tests is not an option.

Formatting and Naming

Sloppy formatting can be construed as being lazy, or not taking pride in yourself or your work. Your code should, in addition to being correct, look beautiful. It should read, in the words of Grady Booch, “like well-written prose.”

Note that the use of a linter or code prettier can check for these items and more, and generally automatically fix any problems. Once you have learned the basics of programming and have gotten familiar with editing and running programs, use these tools.

DRY Code

So many bugs have been traced to “I remembered to change it here but not there.”

Efficiency and Security

Sometimes a readability versus performance tradeoff pops up, but quite often the most readable code actually is the most efficient. And sometimes, your code may be prone to efficiency attacks, so watch out.


Often, compact code is more readble than drawn-out code.

C Specifics

C is hard, but if you keep some things in mind, you can avoid the common problems.