Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Method stub

From Wikipedia, the free encyclopedia
This article is about placeholder method source code. For other uses, seeStub (disambiguation).
Short and simple version of a method

Amethod stub[1] is a short and simple placeholder for amethod 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 aninterface that is defined but for which the implementation is not available.

Example

[edit]

In the following examplepseudocode, the functionReadThermometer returns a particular value even though ultimately it is supposed to read a value from ahardware source. It returns a valid value, allowing consuming code to be runnable. The function ignores the inputparametersource which is common for a stub.

function ReadThermometer(Source source)return 28end function

Related

[edit]

Distributed computing

[edit]

Indistributed computing,stub is like amock objectsimulates existing code, such as aprocedure on a remote machine. Such stubs can be useful inporting.

InRMI nomenclature, a stub on the client-side communicates with askeleton on the server-side.[3]

Windows/MS-DOS

[edit]

InWindows andMS-DOS,stub is like ashim – small interface code left inconventional memory byself-relocating resident drivers which move most of themselves intoupper memory, thehigh memory area,expanded orextended memory as well as similar stubs to allow the relocated code to communicate withreal-mode DOS in conjunction withDOS extenders (likeDPMI,DPMS,CLOAKING orNIOS).

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. Retrieved2012-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. Retrieved2012-08-28.

External links

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Method_stub&oldid=1316699040"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp