Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Method stub
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{about|placeholder method source code|other uses|Stub (disambiguation)}} {{Short description|Short and simple version of a method}} A '''method stub'''<ref name="DaleWeems2004">{{cite book|author1=Nell B. Dale|author2=Chip Weems|title=Programming in C++|url=https://books.google.com/books?id=mxZBPSjSEYUC&pg=PA308|year=2004|publisher=Jones & Bartlett Learning|isbn=978-0-7637-3234-9|pages=308}}</ref> is a short and simple placeholder for a [[Method (computer programming)|method]] that is not yet written for production needs. Generally, a method stub contains just enough code to allow it to be used {{endash}} a declaration with any parameters, and if applicable, a return value.<ref>{{cite web | url = http://www.webopedia.com/TERM/S/stub.html | title = stub | date = 23 March 1998 | publisher = WEBOPEDIA | quote = | accessdate = 2012-08-28 }}</ref> A method stub may be used to implement an [[interface (computer science)|interface]] that is defined but for which the implementation is not available. ==Example== In the following example [[pseudocode]], the function {{mono|ReadThermometer}} returns a particular value even though ultimately it is supposed to read a value from a [[Electronic hardware|hardware]] source. It returns a valid value, allowing consuming code to be runnable. The function ignores the input [[Parameter (computer science)|parameter]] {{mono|source}} which is common for a stub. '''function''' ReadThermometer(Source source) '''return''' 28 '''end function''' ==Related== ===Distributed computing=== In [[distributed computing]], ''stub'' is like a [[mock object]] {{endash}} [[simulation|simulate]]s existing code, such as a [[Subroutine|procedure]] on a remote machine. Such stubs can be useful in [[porting]]. In [[Remote Method Invocation|RMI]] nomenclature, a stub on the client-side communicates with a [[Skeleton (computer science)|skeleton]] on the server-side.<ref>{{cite book | last1 = Freeman | first1 = Eric | authorlink1 = | last2 = Freeman | first2 = Elisabeth | authorlink2 = | last3 = Kathy | first3 = Sierra | authorlink3 = | last4 = Bert | first4 = Bates | authorlink4 = | editor1-last = Hendrickson | editor1-first = Mike | editor2-last = Loukides | editor2-first = Mike | year = 2004 | title = Head First Design Patterns | volume = 1 | page = 440 | publisher = O'REILLY | format = paperback | isbn = 978-0-596-00712-6 | accessdate = 2012-08-28 | url = http://shop.oreilly.com/product/9780596007126.do }}</ref> ===Windows/DOS=== In [[Windows]] and [[DOS]], ''stub'' is like a [[Shim (computing)|shim]] {{endash}} small interface code left in [[conventional memory]] by [[self-relocation|self-relocating]] resident drivers which move most of themselves into [[upper memory]], the [[high memory area]], [[expanded memory|expanded]] or [[extended memory]] as well as similar stubs to allow the relocated code to communicate with [[real-mode]] DOS in conjunction with [[DOS extender]]s (like [[DOS Protected Mode Interface|DPMI]], [[DOS Protected Mode Services|DPMS]], [[CLOAKING (DOS extender)|CLOAKING]] or [[NetWare I/O Subsystem|NIOS]]). ==See also== * [[Method (computer science)#Abstract methods|Abstract method]] * [[Mock object]] * [[Dummy code]] * [[Test stub]] * [[Glue code]] * [[Shim (computing)]] * [[DOS stub]] == References == {{reflist}} == External links == * [http://www.cs.ncl.ac.uk/research/pubs/articles/papers/94.pdf A Stub Generation System For C++] (PDF) * [https://web.archive.org/web/20090711150137/http://www.sizovpoint.com/2009/03/java-mock-frameworks-comparison.html Stub/mock frameworks for Java] Review and comparison of stub & mock frameworks for Java <!-- Fittingly enough, this article is a stub --> <!--Categories--> [[Category:Unit testing]] [[Category:Computer programming folklore]] [[Category:Software development]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:About
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Endash
(
edit
)
Template:Mono
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)