Home Machine Learning Fixing a Tennis Refactoring Problem in Python utilizing SOLID | by Tomer Gabay | Feb, 2024

Fixing a Tennis Refactoring Problem in Python utilizing SOLID | by Tomer Gabay | Feb, 2024

0
Fixing a Tennis Refactoring Problem in Python utilizing SOLID | by Tomer Gabay | Feb, 2024

[ad_1]

A step-by-step illustration of the best way to use SOLID to resolve a refactoring problem

Photograph by Lucas Davies on Unsplash

Introduction

Code refactor challenges are well-known by software program engineers, however much less so by information scientists, although information scientists can even extremely profit from practising such challenges. By practising these, particularly when making use of the SOLID rules, you discover ways to write a lot better code; code that’s modular, of top quality and object-oriented. Mastering the SOLID rules as an information scientist can considerably elevate the standard and manageability of knowledge science tasks. That is significantly essential in groups by which most information scientists are statisticians and mathematicians by origin, who could have much less familiarity with programming fundamentals than software program engineers.

There are lots of refactoring challenges out there on-line. Maybe essentially the most well-known one is the Gilded Rose Kata. One other enjoyable refactoring kata is the Tennis Refactoring Kata, which we’ll deal with on this article.

Typically these challenges are referred to as katas, Within the context of a “refactoring kata,” the phrase “kata” is borrowed from martial arts, the place it refers to a structured follow routine. In martial arts, a kata is a sequence of actions and strategies which might be practiced repeatedly to enhance talent and fluency.

https://github.com/emilybache/Tennis-Refactoring-Kata (MIT license)

Go to https://github.com/emilybache/Tennis-Refactoring-Kata and choose “Use As Template” within the inexperienced prime proper button.

Clone the template and enter the repository in your terminal. Then, cd into the python listing, create a digital atmosphere and set up the dependencies. To check if all the pieces works run pytest. You possibly can copy-paste the instructions under into your terminal.

cd python
python -m venv .venv
supply .venv/bin/activate # on mac or linux
# .venvScriptsactivate # on home windows
pip set up -r necessities.txt
pytest

[ad_2]