On Tue, Sep 4, 2012 at 12:35 PM, Chris Cunnington smalltalktelevision@gmail.com wrote:
This is quite a useful demo for me to better understand Altitude and the Strategy pattern. I can see now that people are supposed to write locator classes as subclasses of ALAbstractLocator as needed, which is what the blog post shows. Once I saw what was supposed to happen it was simple to change it to work with the latest version of Altitude.
Hi guys,
I'm a little late to respond here, as I've been on vacation. :-)
I've gone back and forth on this a couple of times. The first iteration had multiple Locator classes, but I didn't bother to have an abstract superclass because only #pathForResource: and #resourceForPath: are actually needed.
Then I came up with a away to factor out the commonality into a single class called ALLocator, which would be customized by various strategies. But the very first time I needed to customize the way urls are constructed, I found the strategy patterned didn't give me the flexibility I needed.
So now we both options. ALAbstractLocator shows what protocol locators are expected to support. ALDigestLocator provides a default implementation, which can be customized via strategies. In cases where we want more customization than ALDigestLocator allows, we can create an alternate concrete locator class.
Colin