I got a lesson today in how loose coupling provides flexibility to applications in the face of change. Interestingly enough, I got the lesson from myself. As I've reported, I moved www.windley.com to a new server last Saturday. One of the things on my TODO list was to "fix" my newsletter since I was sure it was broken.
My newsletter is created from a special RSS feed on my blog. I created a category in Radio called "newsletter" and set it up so that it doesn't generate HTML, just RSS. Whenever I write an article on my blog that I want in my newsletter, I just check the "newsletter" category. The newsletter process is run from a cron job three times a week. It parses the RSS and turns it into a nicely formatted text file which automatically gets sent to the mailing list.
I had put "fix newsletter" on my TODO list since I was sure that moving my blog to its new home and leaving the newsletter process on the old server had broken it. Much to my surprise, when I read mail this morning, there was Monday's newsletter. It worked because the newsletter process reads the RSS feed over the network using a URL. It doesn't care where the RSS file lives as long as it can get it over the net.
"So what," you may be saying, "that's how it should work." To which I say, "yes, provided you've done things right." I can just as easily imagine that I would have simply grabbed the file from the file system, since the program and the file it needs were both on the same machine. The result would have a tight coupling. I called this "serendipitous" flexibility since I can't claim I thought of it ahead of time. Its a perfect, if simple, example of how following some simple guidelines results in more flexibility and agility.