Monday, July 10, 2017

Class based views

Having got the user interface for my circuit simulator up and going, I am now getting back to this literature database project. To begin with, using Django for my circuit simulator accelerated the learning process with respect to Django and most importantly highlighted what I need to learn further. First task on the agenda is to implement class based views instead of function based views which I am currently using. The aim is to make code more usable and more efficient through inheritance and other features of object oriented programming in general.

I read the Django documentation on class based views:
https://docs.djangoproject.com/en/1.11/topics/class-based-views/
https://docs.djangoproject.com/en/1.11/ref/class-based-views/base/#view

The documentation is fairly vast and Django comes with a number of built-in modules for performing a wide range of tasks. However, I will use the base class View in django.views.generic.base.view and develop my class based views from there on. As before, the best way to learn is through coding and so best to generate as much code as possible on my own rather than use built-in modules in the beginning. Migrating to built-in modules at a later stage will be much easier. For that matter, it is hard to know what industry standard code will use anyway.

The first task will be to convert all function based views to class based views and then continue adding functionalities to the web interface.

No comments:

Post a Comment