Refactoring Proposal, Iteration 1 - Athear/Machine-shop-simulator GitHub Wiki
Large Class
This will address issue #16. The class MachineShopSimulator is used as a giant encapsulation of multiple subclasses. Many of these sub classes should be their own classes.
Planned Refactoring: Our plan is to extract all the subclasses and to make them their own classes.
Technical Difficulty: Even though just moving all the subclasses into their own classes seems simple enough, we believe that this will be fairly challenging since it will most likely break the program. It will take a fairly good amount of understanding of how the program works to get this done properly.
Impact on the code: This will help address the large class smell. It will clean up the code and make it more eligible and also hopefully bring awareness to other issues that need to be refactored in the future.
Inappropriate Intimacy
This will address issue #30. There are many classes that interact in unnecessary ways. This issue ties into our planned refactoring for issue #16.
Planned Refactoring: As we move all the subclasses into their own separate classes, we also plan to fix inappropriate intimacy issues among the classes.
Technical Difficulty: This will be fairly difficult and time consuming, but will be interlinked with other issues we are focusing on, so we won’t have to spend all our time focused directly on this.
Impact on the code: This will have a huge impact on the code. It will make the logic of the code as a whole easier to follow.
Data Classes
This will address issue #10. The classes task and machine don’t have any functions and only contain constructors and fields. They seem to serve no purpose but that of storing information for the rest of the code.
Planned Refactoring: We plan on finding if there is functionality that could be moved to these classes, or if they should be integrated into another class.
Technical Difficulty: This on its own would be a time consuming task. However this will tie into the two previous issues stated that we plan to address. Because of this we believe that it will be of fairly easy difficulty.
Impact on the code: This will address the data class smell. It will clean up the classes a bit and make the code more eligible.
Large Methods
This will address issue #33. The method inputData() is very large and does many different things. It contains things such as nested for loops that make the code hard to read.
Planned Refactoring: Our plan is to break this function down into many smaller methods.
Technical Difficulty: We believe that this will be a fairly easy task. However, it may be a bit time consuming and require some unit tests to be written.
Impact on the code: This will address the large method smell. This will clean up this part of the code making it easy to understand.