Functions or Classes for Views

This is a classic beginner question that gets asked at some point after completing the tutorial. Sadly there is no right answer to this question and the community is fairly evenly split from what I can tell in it's preferences.

Personally I am a fan of class-based views and I typically reach for FormView or TemplateView from the generic classes to further reduce amount of boilerplate I need to write. That said they do confuse newer devs who don't yet know the method names or attributes required to achieve what they would like.

Function-based views are generally easier to understand what is going on, it's clear a request comes in and then gets processed.

The key with both variations is minimise the complexity (or at least be happy with the complexity you choose). Function-based views can get unwieldly if they get too long and refactored functions are not placed in a logical file. Class-based views do benefit from namespacing of helper functions, but the complexity can creep in with Mixins and the inheritance hierarchy.

You can mix them in a project, do not feel chained to one or the other! My final advice is to start with function-based views, then try class-based views once you feel like it!