Mapa mental
Best Practices
Conteúdo do mapa
Best Practices
Testing
- Practice that confirms that our code is behaving correctly and the way its supposed to. Normally used for complex functions when updating and making them more efficient you would like to run a set of tests already created.
- Assert is one of this ways, is a function that will test a condition an if its true then nothing will happen, otherswise it will send and assertion error
- https://cs50.harvard.edu/web/2020/weeks/7/
- Unit Testing
- In python there is a library called unit test, that includes a test runner and different functions to test
- Django Testing
- In tests.py we can actually setup tests for our app, which will include the creation of a database exclusively for tests. To run the tests.py use the command py manage.py test
- Browser Testing
- You can test the javascript or parts of your html in your webpage by using libraries such as selenium and simulating a person using but way faster.
CI/CD
- Continuous Integration * Frequent merges to main branch * Automated unit testing Continuous Delivery: * Short release schedules
- GitHub Actions
- Github actions will let us run tests like style tests or any other kind of test for example when we are pushing into a repository and let us know the result, all of this is written in YML language, a configuration language. Github actions would cover the continuous integration part of CI/CD
- Docker
- Docker its in charge of containerization, which creates enviroments that have all the necessary packages for an app to run exactly as in the enviroment where it was created, also containers are lighter in weight compared to a vm since we are not running a guest os for each container. This part is the continous deployment part of the CI/CD
- Take note that in production enviroments we dont use SQLite as in the CS50 course, we use instead POSTGRESS, MS SQL SERVER, among others. so we would have to create another container to work with our databases. Thanks to docker compose we can tell docker that we want our two containers to talk to each other and we can do that by writing some commands in YML.
Use Patterns
- Use patters WHERE NEEDED
Dependency Injection
- Thanks to interfaces we can actually abstract our dependencies and tell for example a user not to require a lognotification but a INotification, if in the future we would like to change the lognotification into web notification then we just have to change the element that is deriving from the interface instead of the whole code involving notification
Informações
- Descrição
- Mapa Mental sobre Best Practices, criado por Julio Sebastian Cardoza Boulangger em 04-05-2021.
- Criado por
- Julio Sebastian Cardoza Boulangger
- Visualizações
- 1
- Avaliação