Timeline for Method vs Function vs Procedure
Current License: CC BY-SA 2.5
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 7, 2019 at 16:56 | comment | added | 15 Volts | In Ruby, Smalltalk etc. other Pure OO languages, there's no function except module functions in Ruby. They are not the same thing. | |
| Oct 19, 2018 at 12:09 | comment | added | 463035818_is_not_a_number | nice answer, what is missing imho is that within each language those terms usually do have a quite clear definition (just across languages those are not necesarily consistent) and sometimes there really is a difference made between the terms | |
| Feb 6, 2018 at 17:37 | comment | added | Berin Loritsch |
A method has an implicit this parameter that holds a reference to the object instance the method is associated with. That's the key distinguishing factor between a method and the function/procedure.
|
|
| May 7, 2017 at 13:01 | comment | added | AturSams | And the slight exception that (pure) functions don't use external state as input. | |
| Aug 21, 2015 at 20:46 | comment | added | Don Larynx | I would call it a procedure. | |
| May 8, 2014 at 23:54 | comment | added | Cole Tobin | You don't know me. I might just put that into production ;) | |
| Dec 3, 2012 at 15:13 | comment | added | Vladimir F Героям слава |
Actually the term procedure has a strict defined meaning in Fortran. It means a function or a subroutine (for example, there are procedure pointers). Also subroutine does not have to return anything, or more accurately it does not return anything. It may, but doesn't have to, alter its arguments.
|
|
| Apr 12, 2011 at 18:37 | comment | added | Django Reinhardt | Bruce's answer is definitely the one you should go for if you're new to programming. His definitions will be absolutely correct, 99% of the time. But I was looking for more of a technical/theoretical answer. Sometimes newer programmers know only their own domain, and insist that is all there is. In reality there are programmers working today who still use older languages, and who are not "wrong" for using different definitions. That was what I was most interested in. | |
| Apr 12, 2011 at 18:29 | vote | accept | Django Reinhardt | ||
| Nov 24, 2010 at 1:28 | comment | added | Jörg W Mittag | Kind of dual to C++, which calls methods "member functions", Java and C# call functions "static methods". | |
| Nov 23, 2010 at 23:33 | comment | added | LarsH | Let's not throw the baby out with the bathwater. Just because the terminology is not used with full consistency, doesn't mean that the different terms don't have different meanings. @Bruce's and @Frank's definitions are widely recognized, not idiosyncratic. The fact that the meanings are not universal is important, but it doesn't justify the leap to "practically speaking, there's really no difference". (@Django) | |
| Nov 23, 2010 at 19:58 | history | edited | Charles Salvia | CC BY-SA 2.5 |
added 1 characters in body
|
| Nov 23, 2010 at 19:54 | comment | added | Charles Salvia | C programmers use the term "function" simply because the designers of C used that term. | |
| Nov 23, 2010 at 19:42 | comment | added | Django Reinhardt | That's precisely what I thought the answer was. (I should have added "subroutine" as another variant in hindsight.) Can I ask: Why wouldn't you find anyone who call that C function a "Procedure"? Because it's technically incorrect, or because the term "procedure" is currently out of vogue? | |
| Nov 23, 2010 at 19:37 | history | answered | Charles Salvia | CC BY-SA 2.5 |