M
M
Mikkkch2020-12-09 19:41:50
Django
Mikkkch, 2020-12-09 19:41:50

Is it bad to write code that is already embedded inside?

Hello, the title of the question may seem incorrect to someone, but it is.

I will summarize the essence of my question in a small example:
Inside Django there is a form that inherits from ModelForm and contains in the metaclass the user model User provided by the framework. This form has a clean_password2 and save method defined. In addition to these methods, the form contains the __init__ and _post_clean methods. Yes, yes, this is UserCreationForm.

Will it be bad practice in which I inherit my form from ModelForm in the same wonderful way, define my model in the metaclass, define one method from the methods in the already existing UserCreation form and add one of my own?

Here, rather, the question is whether it makes sense to inherit from an existing form, if I am not going to use a piece of functionality from it, and I will add the rest of the functionality I need myself, regardless of whether I inherit or not?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dr. Bacon, 2020-12-09
@bacon

Where there is less code to add, then use it.

R
riot26, 2016-12-16
@anasasiakiri4enko

https://learn.javascript.ru/

N
Northerner19, 2016-12-16
@Northerner19

I recommend not a bad online tutorial from Mozilla - https://developer.mozilla.org/ru/docs/Web/JavaScript

R
Rafael™, 2016-12-16
@maxminimus

For a young Padawan to speak fluently in the main web programming languages ​​-
js css html
js first, then css and html,
you need to understand that if you wish, you can not use the possibility of declarative programming of design styles and the structure of the document tree at all,
Flanagan's textbook must be completely digested
and php a little to start - only the basic server functions for working with folders and files,
or better - learn api node.js - and make a server on js
js - a very simple language, nowhere easier, "Lisp in C's skin"
and the most cross-platform - that's it for beginners
do not forget the KISS principle - we value minimalism-simplicity-lightness
without other people's frameworks and libraries, you will get maximum js performance - 3-5 times lower than in C.
In the process of studying, you need to write your own simple client-server application -
chat, drawing, text editor, game, etc. ...
the main thing - without using someone else's code - without libraries , frameworks and ready-made databases,
you should be able to independently create, process, save the data you need for simple functions - reading-writing files, scanning folders, authorization ... offline and mobile first -
you need to understand that the mobile touch screen is the main input tool of the 21st century
and that the browser works in the sandbox
of the bicycle first -
in order to learn how to do it, you have
to gnaw on granite for three to five years, you
will inevitably gain enlightenment after that
and become a real webmaster
or even Jedi or Ninze, if the Force is with you
and there is another way - the dark side of programming:
work on someone else's ready-made standard template-framework
endless circulation in the samsara of the capitalist industry
communication with morons, psychopaths, swindlers, lazy people, etc.
office or freelance suffering
easy replaceability of the programmer
eternal reworking of someone else's code
inability to do the necessary functionality on their own
constant googling of ready-made solutions
depression and despondency
//and the laziest become layout designers-underprogrammers))
normal programmers are divided into two types:
1) engineers - those who can write a template for themselves or for others
2) locksmiths and carders-winders - those who work within the framework of a ready-made template
- both types are needed, it all depends on your abilities and talents

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question