Method stub
Short and simple version of a method
A method stub is a short and simple placeholder for a method that is not yet written for production needs. Generally, a method stub contains just enough code to allow it to be used , a declaration with any parameters, and if applicable, a return value.
A method stub may be used to implement an interface that is defined but for which the implementation is not available.
01Example
In the following example pseudocode, the function ReadThermometer returns a particular value even though ultimately it is supposed to read a value from a hardware source. It returns a valid value, allowing consuming code to be runnable. The function ignores the input parameter source which is common for a stub.
function ReadThermometer(Source source) return 28 end functionSources and credits
This article is adapted from the Wikipedia article “Method stub”, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.
Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.