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.
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.
The function ignores the input parameter source which is common for a stub.
In distributed computing, stub is like a mock object – simulates existing code, such as a procedure on a remote machine.
In RMI nomenclature, a stub on the client-side communicates with a skeleton on the server-side.