4 ms·
>> Is there REALLY a difference between a "method," a "procedure," and a "function" proper? Yes. These words closely follow the evolution of programming paradi
by psyklic 11y ago
>> Is there REALLY a difference between a "method," a "procedure," and a "function" proper?
Yes. These words closely follow the evolution of programming paradigms.
Early in computing, code was organized loosely as "blocks of named code", or procedures. These often used ad hoc methods to receive inputs and produce outputs, e.g. by directly writing to various globals, registers, and memory regions. You can imagine that this would result in complex programs, since each procedure may have many intertwined dependencies.
To better organize code, a stricter procedure was developed -- the function. These blocks of named code declare their inputs, using them to produce an output. Although this was the ideal, in practice there still tended to be many undeclared dependencies via globals. Again, this led to hard-to-read, obfuscated code.
So, object-oriented programming introduced methods. These are procedures or functions that belong to a class. Meaning, in addition to their inputs, they can only read and modify particular methods and attributes. Hence, the dependencies of the function beyond its inputs are much more precisely understood and organized. In theory at least.