Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

"Method" is a special term in Object-Oriented Programming. Does anyone know when the word began to be used in this particular sense, and in connection with what programming language or other branch of quantitative learning?

share|improve this question
add comment

4 Answers

Programmers with REAL BASIC, VBx and VB.net background are aware of two types of method declarations "FUNCTION" & "SUB". BASIC family of languages allow to declare a function with the "FUNCTION" keyword as well as the "SUB" keyword. The difference between these two is that a "FUNCTION" can or will not return a value where as a "SUB", just executes the code but will not return any value. But with the advent of OO concepts, terms sub and function are started being used interchangeably as methods.

share|improve this answer
2  
Same goes for Pascal's procedure/function –  Mchl Jul 15 '11 at 7:25
2  
VB uses "Function" and "Sub", short for "Subroutine", not "Method". –  Ant Jul 15 '11 at 8:03
4  
I doubt Alan Kay was thinking Basic when coming up with OOP and Smalltalk –  Maglob Jul 15 '11 at 8:11
add comment

Java and C# got method from C++, which got it from Simula.

And Algol probably had influence on Simula:

Also, an MIT ALGOL version, AED-0, linked data structures ("plexes", in that dialect) directly with procedures, prefiguring what were later termed "messages", "methods" and "member functions"

share|improve this answer
3  
IIRC, C++ usually prefers 'member function' over 'method'. –  tdammers Jul 16 '11 at 8:49
add comment

I don't know anything about etymology of this word in OOP history. But I know that it's not deductional (deducable). A better term (a More Deductional Term or MDT) for it could be reaction or act

share|improve this answer
2  
I am entirely sure that I do not agree with you. "Method" is a perfectly cromulent word for what the whole thing started out as, a way of modeling various things, with each 'thing' being of a class, having methods to change how the thing was. In the same way that methods change things in the real world, like. –  Vatine Jul 15 '11 at 9:27
    
I'd guess "method" originally described the implementation code, similar to "procedure" - the method/procedure/algorithm for computing the result. Using it for an interface where the implementation isn't known is a tad wierd, but originally (in Simula) "message" was probably used for that. Even so, when you call a method, you are invoking implementation code, even if you can't know (at the call site) which implementation. –  Steve314 Jul 15 '11 at 9:41
1  
I guess of the three words 'function', 'procedure', and 'method', 'function' has a mathematical connotation (map inputs to outputs), 'procedure' is imperative (perform a series of steps, also used in the same sense in the military); 'method' doesn't have either connotation, which is probably why it is preferred in OOP. –  tdammers Jul 16 '11 at 8:48
    
@Vatine +1 for "cromulent" –  MattDavey Oct 12 '11 at 15:22
add comment

It's hard to find a definite answer out there but the first language to refer to things as methods appears to have been Simula though this may well be false or retroactive. Given that functions (from math) and procedures (also from math) show up in programming languages, the best I can figure is that "Method" is short form for "Methodology".

All of these are Subroutines, bits of code making up a computer program. I'd imagine "Method" was chosen because the idea behind OOP style programming is to reuse code as much as possible. Thus, you could have a procedure but a method makes it more clear that it's a new style at work. Honestly, I've been known to call methods functions and I've heard functions called methods.

share|improve this answer
6  
I'm afraid you 'figure' incorrectly - method (a process to achieve a goal) and methodology (the study) are have different meanings. –  Jonathan Khoo Jul 15 '11 at 4:35
1  
Also, "method" has existed as an English word for a very long time. There's no need to look for a longer word to contract from. –  Steve314 Jul 15 '11 at 9:44
    
On using "function" instead of "method", that's largely the fault of C++, and due to the fact that C has no concept of a "procedure", only a "function" that returns void. C++ member functions are very closely related to ordinary functions (unlike in Simula) - having an implicit this parameter and (possibly) a runtime dispatch mechanism doesn't really change what you're dealing with. I don't know if C was first to treat functions and procedures as the same thing, but Pascal (a newer language) has function and procedure keywords - though IIRC, Pascal functions could have side-effects. –  Steve314 Jul 15 '11 at 9:52
    
Specifically, method is a way to achieve a goal, a description/knowledge, not the process itself. This has a significance in connection with "class", another abstract concept, defining a type of objects. You get a class of objects and a method of doing X with each/any of the objects, as long as they are of that class. You apply a generic method to specific object and get results specific to that object. –  SF. Jul 15 '11 at 13:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.