Introduction
Code refactoring challenges are well known to software engineers, but not so much to data scientists, although data scientists can also benefit greatly from practicing such challenges. By practicing them, especially by applying SOLID principles, you will learn to write code much better; Modular, high-quality, object-oriented code. Mastering SOLID principles as a data scientist can substantially elevate the quality and manageability of data science projects. This is particularly crucial in teams where the majority of data scientists are statisticians and mathematicians by background, who may be less familiar with programming fundamentals than software engineers.
There are many refactoring challenges available online. Perhaps the most famous is the Golden Rose Said. Another fun refactoring kata is the Tennis refactoring katawhich we will address in this article.
These challenges are often called katas. In the context of a “refactoring kata”, the word “kata” is borrowed from martial arts, where it refers to a structured practice routine. In martial arts, a kata is a sequence of movements and techniques that are practiced repeatedly to improve skill and fluidity.
Gonna https://github.com/emilybache/Tennis-Refactoring-Kata and select “Use as template” from the top right green button.
Clone the template and enter the repository on your terminal. So, cd
in it piton directory, create a virtual environment and install the dependencies. To test if everything works, run pytest. You can copy and paste the following commands into your terminal.
cd python
python -m venv .venv
source .venv/bin/activate # on mac or linux
# .venv\Scripts\activate # on windows
pip install -r requirements.txt
pytest