Closed tiwanari closed 7 years ago
I'm taking a look. just a moment...
@amiq11 Thanks!
This is a wip PR. So please look over it and give any comment:)
Notes for me;
I should...
BlockPreferences
MotorProperty
and SensorProperty
in CarControllerBase
and NxtCarController
NOTE: I checked that we can test each child controller (e.g., NxtCarControllerTest for NxtCarController)
Hey @amiq11 , @myusak ,
Though I know I should add more detailed changes into this PR (e.g., some Javadocs, more blocks we will use), I'm almost fixing the design of this PR. So, please look over it again and give me comments.
I want to discuss some stuff;
CarControllerBase
layer?
com.pileproject.drive.programming.visual.block.car
?BlockPreferencesSchema
?
I may miss something. Please let me know.
So far, I received thoughtful comments to keep the design (packages) and codes clean š I'll apply them to codes :)
Is there any other opinion about the designs? If not, I will concentrate on cleaning up codes and ask you to review again later š
Chages;
machine
package for Controller
s and MachineProvider
s.*.block.(sequence|selection).car
package for *Block
s that use downcast from MachineController
to CarControllerBase
.I want to leave the ControllerBuilder
improvement to other PR.
Hey @myusak, @amiq11
Now, I think this PR is on the real reviewing stage.
Hey @amiq11 @myusak,
If there are no more concerns, I will merge this :)
I applied your comments and fix codes a little.
I want to merge this around the end of tomorrow. Is it okay? Please let me know if you have more opinions or are too busy to check.
Hey @amiq11,
WDYT? Let me know your opinion.
I didn't receive any objection to merging so far. So, let me go ahead :)
Hey, don't skip the commit message and leave it to the github. At least you should add a summary that describes what classes are changed and why so that people do not have to come to this pull request.
Thank you for the comment.
I didn't care about it and very sorry about that.
I added the detail and used force commit (disable the protection of develop
branch temporary).
I promise to keep it in mind.
This PR standardizes the
MachineController
to make it has the union of its children's methods.Background
We talked over the design of controllers again and again offline, and we had two options;
ColorSensor
, thus it doesn't havegetColorSensorValue
or something like that) and keep theMachineController
as it is.MachineController
that has the union of methods of these controllers.They actually have pros & cons and our opinions conflicted. But finally, at present, we decided to choose the latter.
Pros & Cons of the former
Pros
Cons
MachineBase
that provides the same interface to control machines (so, we will have very similar codes in blocks like ForwardSecBlock in each build variant) but we currently can't make the most of it because of the design.Pros & Cons of the latter
Pros
MachineController
interface. Thus, it reduces the duplicated codes not only*.java
but also*.xml
.Cons
RuntimeError
notCompileError
.MachineController
itself if new machines with new methods. So, maybe we should make an another layer for other machines something likeMachineController
->CarController
,DroneController
(i.e., not use theMachineController
as the currentNxtController
's parent).Why we chose the latter
This was a very difficult problem for us but we took the pros of the latter. Maintaining duplicated codes
*.java
and*.xml
is very annoying and we can easily change our mind when a new type of machine comes if we keep the unified codes clean.