Chapter 32
Trinity
32.1 Constraints
- The application is divided into three parts: the model, the view and the controller:
- the model represents the application's data;
- the view represents a specific rendition of the data;
- the controller provides for input controls, for populating/updating the model and for invoking the right view.
- All application entities are associated with of one of these three parts. There should be no overlap of responsibilities.
32.2 A Program in this Style
1 #!/usr/bin/env python 2 import sys, re, operator, collections 3 4 class WordFrequenciesModel: 5 """ Models the data. In this case, we're only interested 6 in words ...
Get Exercises in Programming Style now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.