Wednesday, November 11, 2009

A Quick Tip: Operations are not Methods.

In the industry of software development people always use the terms Operation and Method interchangeably. Often time this is true, other times it's not!
To begin let's define what the two terms exactly mean --in terms of Object Oriented Design?

[From Fowler's UML Distilled]

Operation:
      An operation is something that is invoked on an object --the procedure declaration.
Method:
    A method is the body of the procedure.
I guess it's obvious how related and close the two terms are. But sometimes they can be quite different.
For example if you have A super class Employee that defines an abstract operation Work() and 3 sub classes of Employee (Manager, Programmer, and SalesRep) that override the inherited operation Work() then in this case you have 1 operation and 3 methods. 1 defined operation in the base class and 3 different implementations.

No comments: