refactoring into low level driver #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The idea is that those interfaces (roomba, position2d, sensors) do not have any logic inside. The only thing they do is transforming data from one format to another or deal with delays and stuff like that.
You can even make all these classes only one class driver if you prefer.
You may notice that once all this is moved (and the schedule and play and song needs still to be moved) then Roomba does not need to include the Api but it will go to the driver and it does not need to have a serial itself either.
So you may think it will all move to the driver and makes no sense. The only things I think will be saved is the move method because it uses a combination of position and sensors to do something intelligent and the demo1 , motors because also it is much more than just transforming data.
The good part is that roomba class then should be pristine and ready to get new methods with lots of intelligence into them.
Also the simulation would get much more simpler and general as we will not simulate at the binary protocol level but at the level of methods like drive so we can ignore lots of details and do a more generic job.