AI

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

[ad_1]

A step-by-step illustration of how one can use SOLID to unravel a refactoring problem

Picture 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 significantly better code; code that’s modular, of top quality and object-oriented. Mastering the SOLID rules as a knowledge scientist can considerably elevate the standard and manageability of information science initiatives. That is notably 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 accessible on-line. Maybe probably 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 known as katas, Within the context of a “refactoring kata,” the phrase “kata” is borrowed from martial arts, the place it refers to a structured apply 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 high proper button.

Clone the template and enter the repository in your terminal. Then, cd into the python listing, create a digital surroundings and set up the dependencies. To check if every thing works run pytest. You’ll be able to copy-paste the instructions beneath 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]

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button