Archive for the ‘Object oriented design’ Category

My first Smalltalk ah-ha moment

When I first learned Smalltalk (back in the mid-1990’s), the instructor told us that it would take at least five years to become proficient in object oriented design and Smalltalk. Of course, at the time I didn’t believe him. After all, I was an excellent programmer and certainly pick this up quicker then everyone else. Now that I’m back into Smalltak and reading more about it, I’m starting to believe what he said.

A few months ago while reading Smalltalk-80: The Language I had my first Smalltalk ah-ha moment. It came when they talked about using SampleSpace to randomly hand out elements from a set (in the situation in the book, cards from a deck). They break that behavior out into an object that just does that, hand out elements from a set. Doesn’t care what the elements are, just randomly picks one.

Breaking out this behavior neverĀ  dawned on me before. In fact, I implemented the same card dealing logic into a Deck object in Java when I was doing a War simulation (War the card game, not fighting between armies). I was dumbfounded when I realized that by breaking out that behavior there were so many other places it could be used.

Now I understand what the instructor was talking about. He wasn’t talking about learning the language or OOD concepts but about being able to use them to their fullest advantage. Guess I need to resolve myself to the fact that it will take me five years.

Advertisements