You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For this exercise, we will look at how to rewrite (refactor) existing code in different ways, and what benefits each new structure offers.
Some reading
How to write better code? People have interrogated themselves on this question a lot and they came up with a set of useful principles to guide their craft.
One of them is DRY, another one is the single responsibility principle (part of SOLID).
Another good read at this stage is PEP 8, the style guide for python code.
Let's refactor!
According to what you have been reading, do you see ways to improve the methods in times.py?
Review your changes
Run your script. Does it still behave as expected?
Do your tests still pass? Do they still map to the new methods you have created?
Are your docstrings still reflecting the behaviour of your methods?
Final tasks
Commit your changes!
Create a pull request from your branch to the original friend-group repository and use the text in the description to link your PR to this issue Answers neuroinformatics-unitrse-best-practices-playground#3.
Think of the benefits and drawbacks of this approach compared to the original version.
If you have time, think of other changes you consider useful and try them.
The text was updated successfully, but these errors were encountered:
Exercise 3
For this exercise, we will look at how to rewrite (refactor) existing code in different ways, and what benefits each new structure offers.
Some reading
How to write better code? People have interrogated themselves on this question a lot and they came up with a set of useful principles to guide their craft.
One of them is DRY, another one is the single responsibility principle (part of SOLID).
Another good read at this stage is PEP 8, the style guide for python code.
Let's refactor!
According to what you have been reading, do you see ways to improve the methods in
times.py
?Review your changes
Run your script. Does it still behave as expected?
Do your tests still pass? Do they still map to the new methods you have created?
Are your docstrings still reflecting the behaviour of your methods?
Final tasks
Commit your changes!
Create a pull request from your branch to the original friend-group repository and use the text in the description to link your PR to this issue
Answers neuroinformatics-unitrse-best-practices-playground#3
.Think of the benefits and drawbacks of this approach compared to the original version.
If you have time, think of other changes you consider useful and try them.
The text was updated successfully, but these errors were encountered: