|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
VBA - Modules - efficiency and standard programming practices
When using modules to house libraries of user defined functions and code, are there any disadvantages to placing everything in 1 module within your database? Is there any performance increase to using multiple modules to break out Functions?
I'd love to here thoughts on wether or not to just use one huge module or break out code into multiple modules. What is the standard programming practice when it comes to modules in your database? |
|
#2
|
|||
|
|||
|
Don't know if there is any standard or convention for module setup but I like to create modules and group procedures based on some commonality. For instance, I have a module 'Utilities' that has some housekeeping code in it, another module 'Data Calc Functions', and a very specialized module 'Soil Classifications', then there is 'Misc' for a multitude of procedures related to the core operations of the project.
|
|
#3
|
||||
|
||||
|
There's really no performance effect, it's a matter of ease of code maintenance. I have yet to see the application that doesn't require some changes, at some point. It is messy to deal with huge modules that have dozens and dozens of procedures/functions, to find the one that you need to change or print out for documentation. So it is often very helpful to group them together, as June7 described. Like most everything, it can be overdone, but having a few modules that are sensibly named and contain related procedures/functions. Any grouping that helps you quickly find the code for a particular operation is fine.
__________________
Experience is the thing you have left when everything else is gone. |
|
#4
|
|||
|
|||
|
Thanks for the responses guys! I was planning on breaking out modules into "groups" of related code in my next database but had seen other people shove all the code under the sun in 1 module in theirs. I just wanted to be sure I wasn't going to miss out on performance by utilizing multiple modules.
|
|
#5
|
|||
|
|||
|
You may also like to think along the lines of reusability.
If we wish to reuse code do we keep that code in one module and import it or do we run around copy/pasting bits and pieces from all over the place? A simple example would be a global error handling module which is self-contained. If we wish to use it, just import it. |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > VBA - Modules - efficiency and standard programming practices |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|