The Red Penguin

Refactoring our code

Friday 31 July 2020

Code refactoring is the process of restructuring existing computer code — changing the factoring — without changing its external behaviour.

At the moment, we have too many things in the same class. We will refactor the code in order to split it into two classes DeckGUI and DjAudioPlayer which are respectively concerned with the GUI controls and Audio Player functionality.

The DjAudioPlayer class will have a public API that allows a user to tell it to load a track, change the gain, speed, and position and also start and stop playback.

The DeckGUI will be a GUI component which, itself, contains other components.

Ultimately, what we want to be able to do is instantiating two or more copies of each class so we can control two or more audio tracks.