3 ms·
http://lukeplant.me.uk/blog/posts/djangos-cbvs-were-a-mistake/ http://lukeplant.me.uk/blog/posts/djangos-cbvs-were-a-mistak... http://lukeplant.me.uk/blog/posts
by shabda 14y ago
http://lukeplant.me.uk/blog/posts/djangos-cbvs-were-a-mistake/ http://lukeplant.me.uk/blog/posts/djangos-cbvs-were-a-mistak...
http://lukeplant.me.uk/blog/posts/class-based-views-and-dry-ravioli/ http://lukeplant.me.uk/blog/posts/class-based-views-and-dry-...
IMO, CBVs are good, but for many cases FBV are simpler to code and easier to understand.
- emperorcezar 14y agoDefining a get method on a class is just as simple and allows for future expansion.
- po 14y ago…future expansion that I will probably never use. And I disagree that it's just as simple. I think that CBV's encourage me (and my team, because I'm not working in a vacuum) to think about the problem all wrong. You may like thinking of the problem that way but for me it's like trying to think of a song while another song is playing. I usually think of Django views as a function, not a method on a class. Django's FBV's are far from perfect and I think they really could benefit from some small changes to the way things are done, but I agree with the above links that CBV's were a step in the wrong direction.
- emperorcezar 14y agoI'll have to just disagree with you here. I don't find the following any more difficult then a functional view class MyView(View): def get(self): return stuff It's one more line, and is much more explicit in what it handles.