Best coding practices part 2

Aatmaj - Sep 6 '21 - - Dev Community

Best coding practices to remember.

  • Be sure to understand your problem before you decide how to solve it.

  • Be sure you understand the algorithmic method before you start the program

  • In case of difficulty, divide the problem into pieces and think of each part separately. (Divide and conquer)

  • Keep your functions short and simple; rarely should a single function be more than a page long.

  • Use techniques like "scaffolding" to simplify debugging. Scaffolding is a technique used to localize errors.

  • Keep your programs well formatted as you write them. This makes debugging easier.

  • Keep your documentation consistent with your code, and when reading a program make sure you debug he code and not just the comments.

  • Explain your program to someone else: Doing so will help you understand it better yourself.

Adapted from the book Data Structures and Program Design in C

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .