Using duplicate script fragments
This article describes the standards that apply to duplicating script fragments. All of the listed recommendations are mandatory unless noted otherwise.
1. Duplicate script is defined as script fragments or entire procedures or functions copied during the implementation of functionality that has the same logic as another functionality available in the configuration.
Using duplicate script fragments might cause the following issues:
- Their bugs are also duplicated.
- When fixing a bug, one might miss some of its occurences.
- Fixing bugs becomes more resource-consuming.
- The applied solution structure becomes more complex.
Script is often duplicated because the original fragment cannot be accessed (for example, the required fragment is located in a form module and therefore cannot be accessed from another form).
We recommend that you avoid duplicating script fragments whenever possible. It is usually done by refactoring the existing script and moving procedures an functions that you want to reuse from form and object modules to common modules.
2. Remember that duplicating script fragments is acceptable and recommended if future development will lead to significant changes between the original and duplicate script.