Talk:Method stub
From Wikipedia, the free encyclopedia
I'm not sure if the second definition (stub = hack) is correct. I thought that a hack should actually work but a stub doesn't.
I agree that the second definition (contributed by the otherwise anonymous user who identified himself/herself as "MJ") seems wrong/off. I think this second usage is slippery and even slangy. A stub is more very specifically a temporary or stop-gap routine (or at least a skeleton of one--it could just return fixed output, for instance) deliberately used in development/testing whereas a hack is more likely to arise from necessity than convenience. (Hacks, kludges and workarounds all kind of have overlapping meaning/usage.) And a hack can take any form—whereas a stub kind of tends to imply a single routine / entry point.
Besides, since the entry is headed "Method stub" we should stick with the C.S. definition rather than sloppy, slangy interpretations.
—Iguana Scales 20:27, 21 June 2006 (UTC)
I do not think it is a good idea to merge method stub with dummy code. At least not without merging mock object/method too. Since the stub differs from a mock in that it is stateless. But afaik both can be considered to be dummy code.
I absolutely love the fact that this article on stubs is itself a stub.
I hope this never changes. 82.2.153.188 23:05, 13 October 2007 (UTC)
In my experience (java programmer) I associate a stub with Remote Procedure Calls. You talk to the stub (locally) as if it was the object that is actually on a remote location. Mock objects I associate with Integrationtest, you dont actually read the tables, but just create a mock object instead. —Preceding unsigned comment added by 194.151.20.69 (talk) 12:35, 13 November 2007 (UTC)
I use stub methods to mainly keep the flow of reasoning going while writing a program. For example, while writing a method I figure that I might need the next few lines for another similar method and instead of writing those few lines, I just write out a new method name and make a method stub. This helps me check for compilation errors, keep going with the flow of the current method as well as in Refactoring[1]. I don't believe this use was mentioned in the article, however this might be an important use too. In my previous experience I have also found out that writing all the method stubs before actually sitting down to program helps me figure out the structure and flow of the program. Off course this kind of reasoning would be illogical and most likely be frowned upon for big software projects, but for small programs I have found this to be extremely useful.
-G6mps (talk) 01:58, 10 February 2008 (UTC)

