Content deleted Content added
Sammi Brie (talk | contribs) Adding local short description: "Function whose job is only to call another subroutine", overriding Wikidata description "Subroutine who’s job is only to call another subroutine" |
No edit summary |
||
Line 3:
{{redirect|Wrapper method|wrapper methods in feature selection|Feature selection#Wrapper method}}
A '''wrapper function''' is a [[Function (computer programming)|function]] (another word for a ''subroutine'') in a [[Library (computing)|software library]] or a [[computer program]] whose main purpose is to call a second subroutine<ref>{{cite book |title=Using Visual Basic 6 |last=Reselman |first=Bob |author2=Peasley, Richard |author3=Pruchniak, Wayne |year=1998 |publisher=Que |isbn=9780789716330 |page=446 |url=https://books.google.com/books?id=X5ZQAAAAMAAJ }}</ref> or a [[system call]] with little or no additional computation. Wrapper functions
== Purpose ==
Line 9:
=== Programming convenience ===
Wrapper functions
===Adapting class/object interfaces===
Line 18:
===Code testing===
Wrapper functions can be used to write [[Debugger|error checking]] routines for pre-existing system functions without increasing the length of a code by a large amount by repeating the same error check for each call to the function.<ref>{{cite book |title=UNIX Network Programming |last=Stevens |first=Richard |author2=Fenner, Bill |author3=Rudoff |author4= Andrew M. |year=2003 |publisher=Addison-Wesley |isbn=9780131411555 |pages=5–6, 29 |url=https://books.google.com/books?id=ptSC4LpwGA0C }}</ref> All calls to the original function can be replaced with calls to the wrapper, allowing the programmer to forget about error checking once the wrapper is written.
A test driver is a kind of wrapper function that exercises a code module, typically calling it repeatedly, with different settings or parameters, in order to rigorously pursue each possible path. It is not deliverable code, but it is not throwaway code either, being typically retained for use in [[regression testing]].
An interface adaptor is a kind of wrapper function that simplifies, tailors, or amplifies the interface to a code module, with the intent of making it more intelligible or relevant to the user. It may rename parameters, combine parameters, set defaults for parameters, and the like.
Line 39:
==Helper function==
A helper function is a function which groups parts of [[computation]] by assigning descriptive names and allowing for the reuse of the computations.<ref>{{cite web|url=https://web.cs.wpi.edu/~cs1101/a05/Docs/creating-helpers.html|archive-url=https://web.archive.org/web/20210507033146/https://web.cs.wpi.edu/~cs1101/a05/Docs/creating-helpers.html|archive-date=7 May 2021|title=CS 1101: Helper functions|first=Kathi|last=Fisler|publisher=[[Worcester Polytechnic Institute]]|year=2005|access-date=17 November 2021|url-status=live}}</ref> Although not all wrappers are helper functions, all helper functions are wrappers, and a notable use of helper functions—grouping frequently utilized operations—is in [[Binary_translation#Dynamic_binary_translation|dynamic binary translation]], in which helper functions of a particular [[Computer architecture|architecture]]
==See also==
|