Splitting Projects#
If you want to do anything slightly more complicated, you easily end up with hundreds of lines of code. Even a simple game is often more than a hundred lines of code. A large effort like the Linux Kernel can even measure in millions of lines of code. That would be a lot of scrolling.
Naturally there are better solutions. There's a tiny project in the example repository. It draws a few things and even animates that circle. All with seemingly 7 lines of code?
This is not a trick, of course, we're just putting our code somewhere else. Processing shows you these extra tabs ("animation", "drawing" ... in the screenshot), but they are honestly just regular files on your hard disk.
Projects can be split up into separate files. In processing, this is done via the tabs at the top of your Processing window:
With this button, you get to create a new "Tab", and you can give it any name you want. Processing treats all these files like one big project — almost as if everything was still in one file. Global variables are global to all other files as well, for example. Your benefit is being able to quickly find what you are looking for.