Template:About Template:Short description
A method stub<ref name="DaleWeems2004">Template:Cite book</ref> 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 Template:Endash a declaration with any parameters, and if applicable, a return value.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
A method stub may be used to implement an interface that is defined but for which the implementation is not available.
ExampleEdit
In the following example pseudocode, the function Template:Mono 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 Template:Mono which is common for a stub.
function ReadThermometer(Source source) return 28 end function
RelatedEdit
Distributed computingEdit
In distributed computing, stub is like a mock object Template:Endash simulates existing code, such as a procedure on a remote machine. Such stubs can be useful in porting.
In RMI nomenclature, a stub on the client-side communicates with a skeleton on the server-side.<ref>Template:Cite book</ref>
Windows/DOSEdit
In Windows and DOS, stub is like a shim Template:Endash small interface code left in conventional memory by self-relocating resident drivers which move most of themselves into upper memory, the high memory area, expanded or extended memory as well as similar stubs to allow the relocated code to communicate with real-mode DOS in conjunction with DOS extenders (like DPMI, DPMS, CLOAKING or NIOS).
See alsoEdit
ReferencesEdit
External linksEdit
- A Stub Generation System For C++ (PDF)
- Stub/mock frameworks for Java Review and comparison of stub & mock frameworks for Java