Browse files

Begin CBV vs. FBV narrative with an introductory blurb

  • Loading branch information...
estebistec committed Feb 23, 2013
1 parent e329626 commit 34e29c62e5c3c072ab49fb089ecb3d34a8d48ae7
Showing with 28 additions and 0 deletions.
  1. +28 −0 docs/topics/class-based-views/index.txt
@@ -18,6 +18,34 @@ reusable views which suits your use case. For full details, see the
+Why class-based views?
+At their core, class-based views are intended to solve the same problem as
+function-based views: process requests and return responses. What makes class
+views different from function views is the approach they provide to solving
+that problem in different contexts where view functions may not suffice. That
+approach, as you could guess by the name, is modularity and extensibility via
+Python classes. The cost is potentially lost clarity around a views flow of
+control. However, there are situations where for a sufficiently complex view
+the flow of control can be unclear and the implied flow-control offered by
+a well documented base-class becomes appropriate. These are differences we'll
+demonstrate below.
+Finally, class-based views are not limited to the generic class-based views,
+which are simply Django's traditional generic views implemented as classes.
+However, those generic views do provide good examples for shallow inheritance
+and view composition via mixins.
+TODO continue...
+When should I use class-based views?
Basic examples

0 comments on commit 34e29c6

Please sign in to comment.