Burger progress
I’ve worked a little with Burger this morning – see here. Doing the dishes, I realized that some features didn’t belong to one class, but to another, which I had to rename to make its purpose more clear. This is what software design is about: allocating responsibilities to classes, so that they form units that do one thing, or a small number of things. In addition, you want each class to collaborate with as few other classes as possible, so you constantly prune the classes’ dependencies.
(These two things are called “low coupling” (fewest number of dependencies) and “high cohesion” (a clear and concise set of responsibilities) and are excellently defined in the book Applying UML and Patterns by Craig Larman, as part of the set of design patterns known as “GRASP”, or “General Responsibility Assignment Software Patterns”.)
Now I’m sure of which class should be responsible for escaping the characters ’<>&"’ in the process of generating an RSS feed for the blog. Basically, a Page object has a filename, a Collector object (for collecting the blog entries that should be on the page) and a Template object for transforming the page to HTML, XML or whatever.
In addition, there can also be one or more Transformer objects for a Page object, for transforming the entries prior to page assembly. There will be a character-escaping transformer, for example, for assembling a page with an RSS feed. I’m also thinking of having another transformer for summarizing the entries in the RSS feed, so that the link would have to be followed to read the entire text.