Modularize Code

When you are writing code, you should constantly evaluate whether any given block of code might be better if you moved it to its own function or sub-procedure. Is the code you’re working on rather complex? Break it into procedures. Are you using lots of Ands and Ors in an If…End If statement? Consider moving the evaluation to its own procedure. Are you writing a block of code that you think you might need again some other part of the script, or in another script? Move it to its own procedure. Are you writing some code that you think someone else might find useful? Move it.