Search code examples
oopobjectmethodsoperation

Definition of operation and method in OOP


I'm searching for a concrete definition of operation and method independent of the programming language.

In my understanding:

Operations just specify which functionality an object supports without any implementation. It seems to be like a prototype in a C header.

Methods specify the concrete implementations an object supports. It seems to be like an implemented C function.

Question:

Why do we speak of abstract methods? In my opinion abstract methods should be the same like operations.


Solution

  • Searching pascal.computer.org for operation gives numerous and varied definitions. In the context of this question, the second seems most fitting.

    in programming, a defined action that can be performed by a computer system

    That definition sounds vague in isolation, but ties nicely into the definition of method.

    implementation of an operation

    ...which is exactly as stated in the question. However, I think these formal definitions differ from colloquial usage. The term operation is somewhat rare in OOP. I would use it in the context of a mathematical operation, especially as the action of a mathematical operator, but not as a substitute for a method definition. Abstract method would be a more common phrase in that case.

    Likewise, while method is a quintessential OOP term, it is not typically used to call out an implementation. Concrete method would be the inverse of abstract method. I think the lesson is that while academic definitions exist, programmers don't necessarily speak that way. This is no different to common conversation diverging from the dictionary.

    See also: What's the difference between a method and a function?