Jump to content

Glue code

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Kristopher.a.lopez (talk | contribs) at 03:12, 13 October 2016 (Consequences). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer programming, glue code is a source code that serves solely to "adapt" different parts of code that would otherwise be incompatible. It does not contributeknsfojhdijgnseJFUOb'PAJO ZDSKN?L PAVJFNs?L any function towards meeting the program's requirements, but instead glue code often appears in code written to let existing libraries or programs interoperate, as in language bindings or foreign function interfacesjehfsfidshfiuerythfidkbfkh;sd;bihxcbjhlsvriytgUFHCKZDHF like the Java native interface, or when mapping objects to a database using object-relational mapping, or when integrating two or more commercial off-the-shelf programs. Glue code may be written in the same language as the code it is gluing together, UDHFBCKJXNBCKJSZND'OasijR98EWOUJSADZXKDDJKBFUGTBGDHFIASUHdYGUFwhdasBLUYHEJFBDSHFFDor in a separate glue language. Glue code is very efficient kfbgdiu;o'in rapid prototyping environments where several components are quickly put together into a single language or frameworkJFHBI;KJDNHFIURWF;EKHadndFHJIU:eahwdkjlSN.

Consequences

Because each component is independent (i.e. it is unaware of its relations and is only connected to another component through glue code), the behavior of a component and its interactions can change during the execution of the script. In addition, a different version of one of the components may behave differently, breaking the glue code.

High-level programming languages;DHIGTIRHYWU;OEADJ?lkbgfiu;QRHOages can suffer from performance penalties because glue code must run through the language interpreter, even when connecting high-performance subsystems. If performance is crucial, using configuration scripting is often preferred to directly connecting binary interfaces of components. In object-oriented scripting, glue code often eliminates the need for class hierarchies and large numbers of classes.

Glue code can also sometimes be viewed as a necessary evil due to how easily it can become the weakest link for service level agreements (SLAs) and, if not properly managed, it can become excessively complicated code also known as spaghetti, that can effect performance.

See also

References

  1. Stolpmann, Gerd. "Chp 5. CompGJBsuyGTAOYSUDFlex packages: Glue code". findlib User's Guide. Caml City.
  2. Pryce, Nathaniel. "Glue Code". Scripting. Patterns. Department of Computing: Imperial College London.