Quote:
Originally posted by Jnadke
6. Debug the robot code. Upload it and go through all the purpose of the subroutines and make sure they do what they were intended to. This should be the longest process of coding the robot. No matter how good of a coding job you think you did, it's better to find out something doesn't work now than on the playing field.
Of course, all these recommendations depend on if you like object-oriented code. My attempt at coding was to make PBASIC object-oriented. It succeeded, but object-oriented isn't what PBASIC is intended to be. Object-oriented means that there are certain areas of the code (functions, subroutines, etc) that are designed to accomplish a specific task. These functions/subroutines are then called by the main code to accomplish these tasks.
C++ and JAVA are object-oriented programming languages. BASIC is not, however (along with many others).
|
If you do steps 1-5 correctly, and use pseudo-code in step 5, step six should actually be one of the shortest steps in the whole process.
As for object-oriented, what you are actually talking about is "modular" or "procedural" programming (it's NOT "functional", despite what many people/books say). Object-oriented would imply that you somehow encapsulated the data and functions into one big "object." The only real way to semi-sorta-kinda-maybe do object-oriented stuff in PBASIC is to use multiple program slots. That way, all the variables are stored in the same place as the functions that manipulate them. Even then, the data can manipulated by any object at will since everything uses one shared block of memory.
In either event, breaking your code into small pieces is a VERY good idea. It will make debugging much easier and will make it far simpler to make changes some time in the future.