A method stub[1] 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.[2]

A method stub may be used to implement an interface that is defined but for which the implementation is not available.

Example

edit

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 function
edit

Distributed computing

edit

In distributed computing, stub is like a mock objectsimulates 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.[3]

Windows/MS-DOS

edit

In Windows and MS-DOS, stub is like a shim – 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 also

edit

References

edit
  1. ^ Nell B. Dale; Chip Weems (2004). Programming in C++. Jones & Bartlett Learning. p. 308. ISBN 978-0-7637-3234-9.
  2. ^ "stub". WEBOPEDIA. 23 March 1998. Retrieved 2012-08-28.
  3. ^ Freeman, Eric; Freeman, Elisabeth; Kathy, Sierra; Bert, Bates (2004). Hendrickson, Mike; Loukides, Mike (eds.). Head First Design Patterns (paperback). Vol. 1. O'REILLY. p. 440. ISBN 978-0-596-00712-6. Retrieved 2012-08-28.
edit

📚 Artikel Terkait di Wikipedia

High memory area

In DOS memory management, the high memory area (HMA) is the RAM area consisting of the first 65520 bytes above the one megabyte in an IBM AT or compatible

DOS Protected Mode Services

DOS Protected Mode Services (DPMS) is a set of extended DOS memory management services to allow DPMS-enabled DOS drivers to load and execute in extended

MS-DOS Editor

earlier versions of MS-DOS. Originally, EDIT.COM was a stub that ran QBasic in editor mode. Starting with Windows 95, MS-DOS Editor became a standalone

Conventional memory

In DOS memory management, conventional memory, also called base memory, is the first 640 kilobytes of the memory on IBM PC or compatible systems. It is

Terminate-and-stay-resident program

program running under DOS that uses a system call to return control to DOS as though it has finished, but remains in computer memory so it can be reactivated

DOS Protected Mode Interface

modified DOS driver software into extended memory and run them in protected mode, thereby reducing their conventional memory footprint down to small stubs. This

DOS/4G

flexible and reusable memory extension library, DOS/4G allowed programmers to access extended memory without writing specialized code. It embeds itself

EMM386

expanded memory manager of Microsoft's MS-DOS, IBM's PC DOS, Digital Research's DR-DOS, and Datalight's ROM-DOS which is used to create expanded memory using