DEV Community

Aatmaj
Aatmaj

Posted on • Updated on

Principles of good software design

Principles of good software design

  • Most programs spend their 90% time doing 10% instructions. Find this 10% and concentrate your efforts there.
  • Never code until specifications are precise and complete.
  • Sometimes postponing (algorithmic) problems simplifies their solution, just like it happens in recursive algorithms.
  • Choose the algorithm wisely according to the need. Unnecessary complication of algorithm doubles up the work. Dont choose a algorithm just because you know it. Keep your logic simple!
  • Keep your algorithms as simple as you can. When in doubt, choose the simple way
  • Consider time and space tradeoffs while deciding your algorithm.(Valid in many conditions even to this date.)
  • Be sure that the algorithm is correct before starting to code. For this, make a throwaway prototype and test the algorithm. At least verify the intricate parts of the algorithm.
  • If >40% code of a module gives errors, Rewrite the entire module again. Never be afraid to start over. Next time may be both shorter and easier than patchwork and bug-fixing. Starting afresh is easier than patching an old program
  • Act in haste and repent at leisure. Program in haste and debug forever!
  • Never optimize a program until it is correct and working.
  • Don't optimize code unless absolutely necessary.

Adapted from the book Data Structures and Program Design in C

Top comments (0)