Students achieving Oneness will move on to Twoness.Woody Allen
Writing clean code is a fine art, while at the same time, exacting in its nature. These rules will help with some of the latter, freeing you to focus on the former.
Consistent and appropriate naming of directories, files, modules, classes, functions, and variables provide several advantages:
Repetition in code is the vampiric garlic of the software world. It appears innocuous yet can cause great harm. And, it stinks. There are many avenues of condensing code; we explore a few of them here.
Memory impact may be positive or negative. Obviously less memory will be used if you have one copy of a complete function instead of two or more copies. But if you consolidate a code fragment as described above, you incur the overhead of additional function calls, using more memory when running. With well-written function declarations, however, function calls should not incur high overhead (TBD: see "clean function calls").
Conditional branching involves more than meets the eye, when it comes to design consideration. From the single if statement to the multiple if and the switch statements, there are issues with code clarity, performance, and maintainability to consider.
Proper handling of variables.
Functions are our friends.