Search code examples
terminologydefinitionword-wrap

What does "wrapping" mean in programming?


In programming literature and on internet in general I noticed frequent use of term "wrapping".

For example "to wrap library in classes" or to "wrap database". Is that official in programming or just a slang? And what is the best way to describe it?


Solution

  • "Wrap" is a standard English word meaning "Cover or enclose". Typically programmers use it to mean enclosing the functionality of something with something else. It's a fairly widely accepted term. There is no "official programming terms" guideline, so that's about as close as it gets.

    Example:

    • a wrapper function is a function that calls another function;
    • a wrapping class is a class that holds inside itself a reference to another object;
    • the Facade design-pattern is a class/object that wraps around another object, for the purpose of simplifying the interface to access/use such object;
    • a Decorator design-pattern is a class/object that wraps around another object at run-time, for the purpose of enhancing the object's interface with new functionality (without having to modify the object itself).