Difference between messages and methods

Difference between messages and methods

January 14, 2023 | oop, diff

Summary fc #

A method is tied to a particular object. You find this in languages like Java and C++ where the method is bound early to the object at compile time.

A message is an abstraction whereby the actual method that’s being called depends on runtime conditions. The object’s method is late-bound, thereby offering greater flexibility to the executing program.

In Smalltalk, for example, an object may receive a message to invoke a non-existent method. This causes a “does not understand” exception and the object can, if it wishes, define a new method to satisfy the message! How f*cking cool is that?!

This is the true meaning and value of object-oriented programming, not the bastardization you find in Java, C#, C++, Scala, etc.

ref

Details #


No notes link to this note

Go to random page

Previous Next