4 ms·
I have been a faithful follower of Class Based Views for years just until recently when I got completely immersed into the FBV way of thinking thanks to Luke Pl
by julianwachholz 5y ago
I have been a faithful follower of Class Based Views for years just until recently when I got completely immersed into the FBV way of thinking thanks to Luke Plant's excellent write up about Django Views - The Right Way:
https://spookylukey.github.io/django-views-the-right-way/ https://spookylukey.github.io/django-views-the-right-way/
- glomph 5y agoThanks!
- culopatin 5y agoI’m learning Django for a personal project and I’ve followed the CBV because that’s what the resources I’m using pushed. Now I’m reading this thinking “ah crap” lol
- grizwaldo 5y agoSimilar experience. CBVs didn't exist when I started using Django, but I switched over to using them almost exclusively when they were introduced. Reading Luke's articles brought me back to FBVs, now I avoid CBVs whenever I can and feel happier for it. The CCBV site from the original post seems nice and handy though.
- jmconfuzeus 5y agoSame here. I find that FBVs are more explicit and easier to deal with. That's why it's easier to onboard junior devs in a project built with FBVs. Many people say that CBVs is Django on Rails but Rails doesn't use multiple inheritance or complicated MRO.
- greenie_beans 5y agowow, i've been using django for like a year and a half, and this articulates a lot of the pains i've had. thank you for sharing!
- adrianh 5y agoI’m one of the creators of Django and I’d personally never write a class-based view. It requires too much knowledge on part of the developer and is generally an abstraction for the sake of abstraction. Simple functions are much clearer!
- nicbou 5y agoI think they're great when you need to extend a bunch of views at the same time without changing their core logic. It was trivially easy to add authentication, caching, multiple response types and other magic without bothering the rest of the dev team.