1.4-Software-Development-Principles

Refactor Stars

Introduction

The provided zip file contains two files. You may need to use the SaxionApp library as well. The resource “hyg_v38.csv” contains a catalog of stars and their positions. The class StarCatalog draws 521 stars on your screen and highlights the Orion constellation.

The program already works, but doesn’t apply KISS or DRY.

Assignment

Create a unittest

Confirm that after running the class has counted 521 stars that were drawn to the screen. The actual catalog contains 119626 stars. (You may want to confirm that as well at a later time.)

Rewrite the run() method

The class provides a single run method that does everything. This is not KISS. Separate the logical responsibilities while making sure that the code keeps working.

Without thinking too hard about it, I would identify four different activities that can be implemented in different support methods.

Warning: Don’t worry too much about the calculations at first! The code takes some effort to draw the stars in their location based on the data. If you can figure out some parts of that calculation, that’s great, but you may leave them alone.