frameworkers/furnace — Issue #2: Improve separation of concerns between actors in response generation
Author: andrewfhart
Created: 2012-02-06 05:16:02+00:00
State: open

Currently there is an awkward division of labor between the Furnace class, the Controller class, and the HtmlResponse class. These three classes have distinct roles which should roughly map to:

* Furnace: provide high level orchestration of the response generation process, but be agnostic as to the type of response generated

* Controller: orchestrate data and processing elements needed for the response

* HtmlResponse: provide all processing related to zones, layouts, and view rendering needed to structure the HTML markup of the response

At the moment, the Furnace class contains logic for verifying the existence of a view file and for processing the layout file. This is properly the domain of the HtmlResponse class. The controller class contains logic for determining the 'active zone' and for compiling the content of all zones into a single ResponseChunk object. Both of these functions more appropriately belong with the HtmlResponse class.

Refactoring these classes will pave the way for much cleaner implementations of additional response classes (e.g.: XmlResponse, JsonResponse, etc) and should also make it easier to remember where certain functionality lies.