Refactoring

Atualizando o codigo se encontram muitas coisas que foram feitas fora de padrao e outras apenas esboçadas e nunca mais acabadas..

Tem muitas dicas e ideias que ficaram registradas nas issues do github, como por exemplo essas sugestões feitas pelo Carsten:

In fact, I'd like to do a major refactoring of the API to bring it closer to standards for django applications.

If there's plans for a useable release soon, I propose that API refactoring to be done after that. Once the refactoring have been done, it will be very difficult to merge old code, so it should be done as a "Big Bang" right after the release.

Here's a non-complete list of things that I think should be refactored:

The division into many Django apps with only one model in each is non-standard - they should be collected into one or at most two apps - with the repository being the exception, as it provides the git-annex interface.
Utility functions should not be in models.py - they should be factored to modules named "utils.py" or (if generic enough) be split out into separate libraries
Signals should be collected in files called "signals.py"
The git-annex library in repository/models.py should be factored out to a separate library. Their use (i.e. knowledge of git-annex paths, etc) should probably be isolated to the serializers, or to internal methods of the models
Better encapsulation, including of the file handling mentioned in this ticket
Enforcement of PEP-8 (high priority) and PEP-257 (lower priority)

Reasons to do this:

It will make the code somewhat easier to maintain, and
make it easier to avoid violations of DRY.

Reasons not to:

The subsequent database migration must be written and tested very carefully, as many tables will get new names. Of course, for new installations that will not be a problem
This refactoring will not make any changes to the API's functionality at all, so it won't actually bring the project further except for making the foundation more secure.

Também na wiki tem varias ideias de melhorias que vale a pena olhar.

Vamos que vamos!

Previous Post Next Post