![]() | Calling a method instead of sending a message |
|
17 Jan 2011, 22:27
Mark Mayfield (1 post) |
I’m curious why in chapter one the concept of “calling a method” is advocated rather than “sending a message”? In the Pragmatic Programmer’s article “OO in One Sentence: Keep It DRY, Shy, and Tell the Other Guy”, Andy Hunt and Dave Thomas stress “[A]s an industry, we’ve come to think of software in terms of function calls. Even in OO systems, we view an object’s behavioral interface as a set of function calls. That’s really not a helpful metaphor. Instead of calling software a function, view it as sending a message.” |
|
23 Jan 2011, 09:46
Paolo Perrotta (38 posts) |
Hello, Mark. I took some time to reply (sorry), so you might already have read further into the book. The Methods chapter uses the “message passing” concept a lot – it even opens with it. I agree that “passing messages” is a useful metaphor, but I stopped shy of using it in chapters that don’t focus much on methods, because that’s not how many programmers think – especially the programmers coming from static languages. I hope I struck the sweet spot between “the usual way of thinking” and “a new way of thinking”. If you read further and have comments about this trade-off, I’d love to hear them. |
| You must be logged in to comment |

