Delete Icon
This forum is now read-only. Please use our new forums at
0 points
Submitted by Samuel Laaja
8 years ago

Why are "functions" inside objects called "methods"?

In every method exercise so far, methods are explained as “like functions” or “similar to functions”, since they even use the same keyword and syntax. The only difference I have gathered is that they are used inside an object, while functions are not. Is this really the only reason for calling them “methods”?

I’d find it more helpful to just call them “functions inside objects”, since that’s more descriptive expression.

Answer 5052ffd8d618140002039158

4 votes


It’s just traditional terminology that has been around for many years in object-oriented programming. You could equally ask why children that are attending school are called students instead of just children. The term method bears more information, because you know immediately that there’s some object that this method belongs to (and if the object is obj, you have to call that method using dot notation obj.methodName()), while you can call other functions without prepending an object and a dot to them.

3117 points
Submitted by Alex J
8 years ago