Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 2.41 KB

README.md

File metadata and controls

60 lines (41 loc) · 2.41 KB

CleanCode_CheatSheet

Deploy CleanCode

As this bundle of data analysis code grew to the medium size collection of a python scripts, it is perfect for a little Clean Code exercise. The following steps where applied in order to create an easy to use and clean python application.
>> Go straight to that clean python application & user instructions >>

STEP 1

Original state, collection of python scripts

Some steps to create a nice ditigal working environment for a clean start:

  • initialise a git repository for version controll and link it to a remote URL
  • create and/or activate your virtual environment for this project
  • move working files like *.ipynb out of this repository or at least
  • create a .gitignore file do hide certain files like notes.txt from git version controll

Initialise git and clean up working files

  • draw diagram to plan code structure
  • tea break ☕





STEP 2

Refactoring of code functionality into seperate function.

Now its about time to dig into this code collection and start cleaning!

  • delet unused imports
  • restructure and refactor code as planed
  • create python classes and modules to include all previously scattered processing functionality
  • get rid of redundant / duplicate code
  • make all function names camelCase
  • rename variables to show there intention
  • delet unnecessary functionality
    like the processing of global max, global min, global mean and global average values in the example code
  • deleted unnecessary columns from dataframe
    like algo, dm tools, target and
    size values in the example code
  • more tea ☕




STEP 3

Writing unittests with pytest for individual functions.

  • write unittests
  • solve bugs 🐞
  • add main.py script to inherit all processing functionality
  • add command line interface for easy handling
  • solve more bugs 🐜
  • add documentation to functions and classes
  • write requirements.txt to collect used python libraries
  • write basic user instructions in README.md file for your git repository