Machine shop first iteration proposal - griml017/Machine-shop-simulator GitHub Wiki

Prioritized list of refactorings

Below are our prioritized list of refactorings. Our initial plan is to tackle these in this order, but we may need to revise that plan as we move into the refactorings.

Refactoring 0: Extracting Inner Classes to Individual Classes

Issue Being Addressed:

This will address Issue #9. There are classes within the Machine-shop-simulator class that need to be extracted into separate classes (MachineShopSimulator, Task, Job, Machine, EventList).

Planned refactoring

Our plan is to extract the classes Task, Job, Machine, and EventList and create new separate classes for each one.

Technical difficulty

The refactoring will be easy, but due to classes no longer interacting properly after extraction, an additional refactoring will be necessary.

Impact on the code

This helps address the issue, and will impact every part of the program. This has a very large impact on the project. It will improve readability, as well as mobility of the code.


Refactoring 1: Correct Visibility of Fields in Classes

Issue Being Addressed:

This will address Issue #25. The fields in the newly extracted classes are set to private, which restricts access to them from the other classes.

Planned refactoring

Our plan is to use the Encapsulate Field option in Eclipse to add get/set methods along side the private fields in the separate classes.

Technical difficulty

The refactoring will be difficult. It will take proper testing to ensure all the fields are still connecting to each other.

Impact on the code

This helps address the issue raised by the previous refactoring, while maintaining security.


Refactoring 2: Comment Clarification/Removal

Issue Being Addressed:

This will address Issue #14. There are comments in every class that have no purpose, as well as unclear meanings.

Planned refactoring

Our plan is to clear up the comments, by either clarifying the existing comments or by deleting the comments that shouldn't be there.

Technical difficulty

The refactoring will be easy, as long as we have an understanding of what the code is doing.

Impact on the code

This has impact on the readability of the code.


Outcomes

Refactoring 0 and 1: These two steps became intertwined during the refactoring. With each class we separated, we had to adjust the visibility of the fields to retain functionality of the classes. This turned out to be fairly easy, and definitely opened up other refactoring opportunities.

Refactoring 2: This step was fairly easy; most comments were irrelevant and could be removed. Where they were necessary, we were able to simplify them and leave them be. A few comments required modifications of what was happening, but beyond that, the step was easy.