Modularized Code

When you record a macro, all the code generated by the macro recorder is written into one procedure. As you learn to write code by hand and begin to write more complex procedures, you might be inclined to continue this practice. Breaking your code into separate components for easily identifiable tasks, however, makes reading, debugging, maintaining, and modifying your code much simpler.

Looking again at the AddTask and strNewTask procedures, for example, you can see that there's no reason the functions of the two procedures couldn't have been combined into one. Keeping them separate means that AddTask could be modified to perform additional tasks by simply calling new procedures in addition to strNewTask, such as SearchForUnassigned-Resources and AssignResources.

Another aspect of modular code is that it makes writing new code faster and easier. A procedure that searches for overallocated resources, for instance, could be called from many other procedures rather than rewriting the same code for every procedure that needed it.


Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment