Since the bug was easy to spot and fix, I've solved that first before refactoring. If I would have considered the bug to be difficult to solve, I would have considered refactoring first and debugging later.
The tcTrain::move() method covers some 170 lines of code that needs to be broken up to different methods.
First, I'll review the existing methods for tcTrain:
The tcTrain:move() method is based on some different states:
That method will call some new methods:
- tcTrain;:waitingState
- tcTrain::readyState
- tcTrain::runningState
- tcTrain::openingState
- tcTrain::loadingState
- tcTrain::closingState
- and also some other helper methods/functions.
I'll remove the method tcTrain::getRouteVectorTracks().
The first step will be porting the code to the new methods without breaking anything...
No comments:
Post a Comment