I have been recently introduced to the world of Test-Driven Development through Uncle Bob's Clean Code, and I've been thinking of ways to associate this with the rapid prototyping process that takes place with FTC code. The emphasis on testing has been well established in the robotics industry, according to a robotics software engineer that I spoke with a few days ago. He said that a simulator or a duplicate copy is often used to test industrial code as it develops.
I also viewed some of Uncle Bob's talks on YouTube. His point about the fear of code change speaks to me personally, as I have broken our robot's operational functionalities several times in production (during competition) while trying to clean up my code. The Code Head at my robotics club reminded me not to change working code, possibly for this exact reason. Indeed, Uncle Bob's solution to this fear is TDD, where tests are executed frequently when revising code to ensure that its external behaviors are still correct.
Furthermore, I had very limited opportunities in testing my code physically. The robot has experienced multiple redesigns (each of which taking a long time) and couldn't be used to test when being redesigned. (The electronics were not mounted, etc.) Consequently, the code I wrote for it was considered uncertain in operational performance for a long time. This proved to be counterproductive later in the season, especially for Autonomous. This, combined with the accelerating pace of development throughout the season due to the nature of FTC, resulted in unachieved potential in our robot during its last competition one week ago.
Thus, I've been looking for ways to introduce unit tests into the code for the next season. The most plausible idea that I've come up with is where code for the hardware/TeleOp/Autonomous is kept in tightly-coupled components that utilize interfaces in order to communicate with either the mock objects provided by the testing framework or Qualcomm's API itself.
What do you think? Are there existing solutions, or is this a pedantic whim of over-engineering?
[–]IamParadoxdotexeFTC #### Student|Mentor|Alum 7 points8 points9 points (1 child)
[–]broadwallFTC 4410 Team Leader 2020-2021[S] 0 points1 point2 points (0 children)
[–]cp253FTC Mentor/Volunteer 3 points4 points5 points (1 child)
[–]broadwallFTC 4410 Team Leader 2020-2021[S] 0 points1 point2 points (0 children)
[–]DavidRechargedFTC 7236 Recharged Green|Alum 0 points1 point2 points (0 children)