I am very fluent in block coding and have used it to write very successful scripts for the past two years in IQ. I am wondering what the benefits are of coding with text rather than coding with blocks, because I know strong coding is much more important in VRC. And what app do you all use for coding?
I use the vex vscode extension and am considering switching to PROS. The advantages of text coding are that it allows you to have more complicated programs that are easier to understand. Variables are much easier to use and while functions do exist in a limited sense in blocks you can do so much more in text. Text coding allows you to use more advanced vex functions and share the programs more easily online. In addition, learning text coding (whether you use Python or C++) allows you to learn extremely popular programming languages, which you will undoubtedly need in the future for your job if you decided to go into a programming related job.
Benefits:
- Better VRC support - most teams, and all high-level teams use C++/Python
- Better general support (e.g. ask the google machine/chatgpt about C++/Python and you’ll get a lot of help)
- Related - The real world uses text-based programming exclusively
-
- This includes things like, functions, classes, function overloading, etc. and the ability to import external libraries (e.g. okapilib, lemlib, JAR-Template, etc.) and all the assorted ecosystem of code organization and reuse.
-
- The ability to comment code (In fairness, IDK if Vex’s Blocks stuff support comments, but every blocks language I’ve run across is terrible about comments)
-
- The ability to use version control systems
Pat yourself on the back for being good with block programming and take the next step in becoming a better programmer by learning a text-based language.
I’m pretty sure you can find examples if you search on the forum…I am almost confident that I’ve seen answers to your question before…
If you are fluent in block coding, you’ll be happily surprised in how easy it will be to transition to text based coding. The parameters you already know in blocks are the things that go in the parenthesis in the text commands of the same name. The big benefit is that doing math becomes easier, and as your code becomes more interesting, you’ll likely want to do more involved math in the code. Especially as you write more generic functions.
The most important thing in coding is understanding what you want your robot to do. Next is in transferring that to some kind of code. Next, you observe actions that your code does over and over and you realize that you could make a single function to do that. Are you already doing that in blocks? If so, you’re already there. If not, no problem. You’ll learn these ideas quickly as you become a more experienced coder.
Here’s a secret from someone who gets paid to code. Programming languages don’t matter. You can teach yourself a new language in a weekend or not learn it and just look up syntax online as you go. The reason someone is valued as a coder (especially in real world things like robots) is understanding what you want the robot to do. How to make it do it robustly. Do that in C. Do it in C++. Do it in python or whatever. Understanding how to make your robot reliably to a thing is the magic. Not knowing parenthesis vs curly brace.
Thank you all for the helpful insight, these are great suggestions, I will download PROS or something like it this weekend and try it out. When it comes down to it tho I will prob learn basic syntax from chatGPT. Thank you again!
I would recommend looking at the PROS documentation instead of chatGOT. After you’ve learned the basic syntax you can look at PROS code releases to learn best practices. Such as here: Spin up - season code request
You don’t need to download anything to get started. You could just go to one of your block programs, and then convert it to text. It would probably take you a couple of minutes to figure it out if you’re pretty fluent already with blocks, the concepts translate nicely. The blocks projects are already converted to text before they run on your bot. The old robotC files would have the c++ at the end of the file if you opened it up in a text editor as well.
I would honestly avoid PROS, and use the Vex tools as a beginner. There might be reasons that some advanced coders might prefer PROS, but starting out, just use the stuff from Vex. I don’t know if there’s a button in V5 code blocks to “convert block to code” like there used to be, but if there is, push that button and see what your code looks like in text. If not, google how to do the lines you want.
If you have a bot, do all the normal stuff. Configure the drivetrain. Learn how to make it move forward and back. Dive forward 1 square, turn 90 degrees, drive forward a square and turn. If you can drive a perfect square with 4 moves, you have control of your robot. Learn how to do motor groups and move multiple motors, if you linked motors somewhere. In a day or two, you’ll have some chunks of code that do stuff and you’ll have the beginnings of commands in C++ or python. Most likely you’ll be programming C in a C++ environment, and that’s fine.
I’d avoid ChatGPT created code at the beginning, as well. My concern is that you’d get big chunks of code that you don’t really understand. You’re better off to start from the beginning and learn from the ground up. Once you’re an expert and you want to save some typing, then consider AI code tools. The value in all of this is to learn it yourself, initially. Don’t skip this step. Competition is months away. Try stuff. Fail. Research. Learn.
Interesting, I’m working on our first prototype of a bot and I think there is a button in V5 that lets you work in text, I’ll look into that soon. @coachdoug80516 the advice is so welcome! You guys have been very helpful, good luck in over under!