I have three words for you: Model, View, Controller. You want to split your application framework up such that it makes solid distinctions between these three categories of code.
Model refers to the underlying data in your system. It includes your classes that embody any and all collections/associations of data.
View refers to the various ways in which data is rendered either to users or other systems. It includes your filters, formatters, mungers, etc.
Controller refers to the mechanisms that mediate interactions between all players in the system, namely Users, the Model, and the View. It's job is to accept input from Users, load things from the Model, feed that stuff through the View, hand the result to Users, and repeat.
If you do a good job making these distinctions, then you will be able to plug the components of your system together in myriad unpredicted ways, making it highly flexible and extensible.
As an example, think of an Apache/mod_perl web application framework for delivering finance reports... The Model will consist of the classes that embody various financial thingies. The View will consist of the classes that accept things from the Model and format them into pretty HTML for PHBs to look at in Internet Exploiter. The Controller consists of the Apache handlers that parse the incoming URLs, load the requested objects, pipe them through the appropriate View classes, and then forward the results of the View to the User.
|