<p>I recently asked a question about what I called "method calls". The answer referred to "messages". As a self-taught hobby programmer trying to phrase questions that don't make me look like an idiot, I'm realizing that the terminology that I use reveals a lot about how I learned to program.</p>

<p>Is there a distinction between the various terms for methods/messages/etc. in OO programming? Is this a difference that comes from different programming languages using different terminology to describe similar concepts?</p>

<p>I seem to remember that in pre-OO languages, a distinction would sometimes be made between "subroutines" and "functions" based on whether a return value was expected, but even then, was this a language-by-language distinction?</p>

[{'answer_id': 43788, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 0, 'selected': False, 'text': "<p>I'm not sure about origin of <em>message</em> terminology. Most ofter I encounter <em>messages</em> in UML design. Objects (Actors in UML terminology) can communicate with each other by means of <em>messages</em>. In real-world code <em>message</em> is just a function call usually. I think of message as of attempt to communicate with some object. It can be a real message (like messages in OS) or function calls.</p>\n"}, {'answer_id': 43790, 'author': 'Michael Stum', 'author_id': 91, 'author_profile': 'https://Stackoverflow.com/users/91', 'pm_score': 0, 'selected': False, 'text': '<p>Usually, "Method" seems to be the proper name for Functions. However, each language has it\'s own keywords. Delphi for example even makes a difference between Methods that return something ("Functions") and Methods that return Nothing ("Procedures") whereas in C-Type languages, there is no difference.</p>\n'}, {'answer_id': 43791, 'author': 'Daren Thomas', 'author_id': 2260, 'author_profile': 'https://Stackoverflow.com/users/2260', 'pm_score': 2, 'selected': False, 'text': '<p>I believe <em>message</em> is used in smalltalk.</p>\n\n<p>Java, C# etc. tend to use <em>method</em> or <em>instance method</em>.</p>\n'}, {'answer_id': 43792, 'author': 'Ben Collins', 'author_id': 3279, 'author_profile': 'https://Stackoverflow.com/users/3279', 'pm_score': 5, 'selected': True, 'text': '<p>I\'ve found this to be a language and programming-paradigm thing.  One paradigm — OOP — refers to objects with member methods, which conceptually are how you send messages to those objects (this view is reflected in UML, for example).</p>\n\n<p>Another paradigm — functional — may or may not involve classes of objects, but functions are the atomic unit of work.  </p>\n\n<p>In structured programming, you had sub-routines (notice that the prefix "sub" implies structure).</p>\n\n<p>In imperative programming (which overlaps with structured quite a lot, but a slightly different way of looking at things), you have a more formulaic view of the world, and so \'functions\' represent some operation (often mathematical).</p>\n\n<p>All you have to do to not sound like a rube is to use the terminology used by the language reference for the language you\'re using.</p>\n'}, {'answer_id': 43796, 'author': 'lindelof', 'author_id': 1428, 'author_profile': 'https://Stackoverflow.com/users/1428', 'pm_score': 2, 'selected': False, 'text': '<p>I am pretty sure (but a quick <a href="http://en.wikipedia.org/wiki/Smalltalk#Messages" rel="nofollow noreferrer">Wikipedia</a> check seems to confirm this) that the `message passing\' terminology comes from the Smalltalk community. I think it is more or less equivalent to a method call.</p>\n'}, {'answer_id': 43797, 'author': 'travis', 'author_id': 1414, 'author_profile': 'https://Stackoverflow.com/users/1414', 'pm_score': 0, 'selected': False, 'text': "<p>Here's some simplified definitions:</p>\n\n<p><strong>methods/subroutines/voids:</strong>\nperform an action</p>\n\n<p><strong>functions:</strong>\nperform an action and return a value</p>\n\n<p><strong>events:</strong>\nare called when an object is acted upon</p>\n\n<p><strong>handlers:</strong>\nare the functions/methods that handle the events</p>\n\n<hr>\n\n<p><em>PS: this is a perfect example of why SO should support DL/DT/DD tags.</em></p>\n"}, {'answer_id': 43801, 'author': 'John Sibly', 'author_id': 1078, 'author_profile': 'https://Stackoverflow.com/users/1078', 'pm_score': 2, 'selected': False, 'text': '<p>The "Message" term can refer to sending a message to an object, which is supported in some programming languages and not others.</p>\n\n<p>If the object supports the message, then it will execute some code. Otherwise it will just ignore it. This is a more dynamic approach than an explicit function/method call where the object must support that function.</p>\n\n<p>Objective-c, I believe, uses this messaging approach.</p>\n'}, {'answer_id': 43814, 'author': 'martinatime', 'author_id': 1353, 'author_profile': 'https://Stackoverflow.com/users/1353', 'pm_score': 0, 'selected': False, 'text': '<p>I believe that it is a matter of preference at this point. The words that you mention are basically synonyms in today\'s languages and for the most part people will understand what you mean if you say either "method" or "function". If you use "message", which is only used really in OOP, then you may confuse what you are attempting to convey.For example: "I need to create a message to send an email message." Other terms that could be synonymous, and this isn\'t a complete list, are subroutine, action, procedure, operation (although usually mathematical in nature), subprogram, command...</p>\n'}, {'answer_id': 619117, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 4, 'selected': False, 'text': '<p><strong>Message!=Method!=function</strong></p>\n\n<p>in OOP different <em>objects</em> may have different <em>methods</em> bound to the same <em>message</em>.</p>\n\n<p>for example: the message "rotate left n degrees" would be implemented diffrently by diffrent objects such as shape, circle, rectangle and square.</p>\n\n<p>Messages: Objects communicate through messages.</p>\n\n<p>-Objects send and recieve messages.</p>\n\n<p>-the response to a message is executing a method.</p>\n\n<p>-the method to use is determine be the reciever at run-time.</p>\n\n<p>In C++ Methods and Messages are called <strong>function members.</strong></p>\n'}, {'answer_id': 1563498, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p><strong>method</strong> : similar to function in traditional languages</p>\n\n<p><strong>message</strong> : similar to parameter passing in traditional language</p>\n'}, {'answer_id': 6221416, 'author': 'goofballLogic', 'author_id': 275501, 'author_profile': 'https://Stackoverflow.com/users/275501', 'pm_score': 2, 'selected': False, 'text': '<p>In Object Oriented implementations like C#, the concept of a "message" does not really exist as an explicit language construct. You can\'t look at a particular bit of code and say "there\'s the message."</p>\n\n<p>Instead, a method of an object\'s class implies the idea that other objects can send a type of message which trigger the behaviour within that method. So you end up just specifying the method directly, rather than sending a message.</p>\n\n<p>With other implementations like Smalltalk, you can see the message being passed, and the receiving object has the ability to do with that message what it will.</p>\n\n<p>There are libraries which sit on top of languages such as C# which attempt to restore the explicit message passing feel to the language. I\'ve been cooking up one of my own for fun here: <a href="http://collaborateframework.codeplex.com/" rel="nofollow">http://collaborateframework.codeplex.com/</a></p>\n'}]
['https://Stackoverflow.com/questions/43777', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4142/']