12/08/2008

Kent Beck demonstrates the expressive power of talking about smalltalk

I asked a question, the other day, about whether an object should access its own properties directly, or via getters/setters. One of the responses, in the beginners' list, pointed me to a draft of Kent Beck's book - Smalltalk Best Practice Patterns


Now, I must be honest and say that I don't fully understand what Kent is talking about - yet. However, it is interesting to see some of the Smalltalk jargon put into a new context, and I am finding that really helpful. However, what really caught my eye was this sentence.

The other advantage of code written to reveal intention and conceal implementation is that it is much easier to refine by inheritance.
.
This highlights the problem I have been having. I am always trying to understand the implementation, instead of focusing on the intention. Now, clearly, if you are learning a new language, looking at implementation is important - if only to pick up coding style - but I am slowly beginning to understand that productivity in Smalltalk comes - at least in part - from treating objects as black boxes, and relying on understanding the intention.


in other words, you program with the assumption that the object does exactly what it says on the label. I am going to try that as an approach and see if it helps to clarify things.

No comments: