We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Software

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What Is a Glue Code?

By Jessica Susan Reuter
Updated: May 16, 2024
Views: 22,868
Share

Glue code is computer code that unites programs or software components that would not be compatible otherwise. This code usually does not serve a purpose such as computation or calculation, but serves exclusively as a proxy between two incompatible pieces of software. Object-oriented programming languages can be connected to scripting languages, two object-oriented languages can be connected together, or large pieces in the same language can be united by this code.

Although glue code can be used to transfer information between computer languages, it is not required to do so. Generally, it allows one piece of code to call functions in the other, or allows small data values to be passed between code blocks. Some code generators allow user-specified data structures to be passed between code modules, but not all of them do. Moving large pieces of data through the connecting code may not always be reliable.

Generated glue code, particularly when it connects distinct computer languages, often contains code pieces specific for each connected code module. For example, to connect C++ with Java, the generated code may include both a C++ file and a Java file. As long as no major changes are made to the structures of the connected code modules, the generated files do not need to be changed, but they may need to be updated over the course of development. Generated files such as these rarely need to be changed or maintained by a developer, and never by an end user.

Glue code can be used to connect code modules of any size, from small functions to large libraries. Depending on the amount of proxy code generated for this purpose, there may be a significant amount of code bloat and overhead, so connecting small pieces of code in this way may not always be ideal. When synchronizing calls to large libraries or merging large code repositories, on the other hand, a small amount of this type of code can be an invaluable way to bring functionality where it might otherwise be unavailable.

Extensible Markup Language (XML) data is sometimes mistaken for glue code, but the purpose of each is quite different. XML is a markup language, that is, it adds organizational and descriptive information to existing data for easier interpretation. Both can serve as a proxy to move information, but XML is static and far more limited in terms of the data it can transfer between code blocks. XML annotates and classifies data, while glue code allows for movement and manipulation of data.

Share
EasyTechJunkie is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Discussion Comments
Share
https://www.easytechjunkie.com/what-is-a-glue-code.htm
Copy this link
EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.

EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.