Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
My essential guidelines for better Django development (spapas.net)
4 points by spapas82 on Oct 11, 2022 | hide | past | favorite | 4 comments


Lot's of good points in here. I disagree with generic CBVs though. I find FBVs or vanilla CBVs easier to maintain. I like Luke Plant's article https://spookylukey.github.io/django-views-the-right-way/


Thank you! Both have their pros and cons... I've had very good experience with cbvs on my projects but only after I was able understand every last bit of their design.

The selling point of geberic cbvs to me is that using them (with all their mixin an multiple inhetitance glory) makes it easier to re-use stuff. The parts I need to override are already there, defined by people smarter than me.

This is also possible with functional views as the article mentions but it needs much more effort and discipline to understand what needs refactoring to a function of not. This is actually more difficult and usually results to avoiding the effort and just duplicating code (I guess I'm lazy).

Functional views feel simpler but may become more complex in the end.


I appreciate your perspective and the thought that went into it. I just wish beginners wouldn't feel like they need to grok GCBVs to be productive in Django. Thanks again for writing all these tips down - I definitely picked up a few things!


You are definitely right about beginners. Cbv has a very steep learning curve and will be intimidating for most people; it definitely was for me :)

I'll try to rewrite my guideline about cbvs to be more thoughtful.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: