Using duplicate script fragments

This article describes the standards that apply to duplicate 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 occurrences.
  • Fixing bugs becomes more resource-consuming. 
  • The applied solution structure becomes more complex.

The 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.

Next page: Using global variables in modules

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.