Glue code
![]() | This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
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 contribute 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 binding or foreign function interface like the Java native interface, or when mapping Object 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, or in a separate glue language. Glue code is very efficient in rapid prototyping environments where several components are quickly put together into a single language or framework.
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 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 languages. Glue code often eliminates the need for class hierarchies and large numbers of classes.
Programming language
- Adaptor pattern
- Scripting language
- Shell script
- SWIG
- Lua (programming language)
- Glue logic
- WinGlue
- Wrapper function
- Wrapper library
References
- Stolpmann, Gerd. "Chp 5. Complex packages: Glue code". findlib User's Guide. Caml City.
- Pryce, Nathaniel. "Glue Code". Scripting. Patterns. Department of Computing: Imperial College London.