# Creating complex programs (merging programs)

**URL:** <https://discourse.processing.org/t/creating-complex-programs-merging-programs/42347>\
**Category:** Project Guidance\
**Created:** [July 5, 2023, 9:09am UTC](https://discourse.processing.org/t/creating-complex-programs-merging-programs/42347 "2023-07-05T09:09:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cuvner](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cuvner](https://discourse.processing.org/u/cuvner)\
**Post date:** [July 5, 2023, 9:09am UTC](https://discourse.processing.org/t/creating-complex-programs-merging-programs/42347/1 "2023-07-05T09:09:23Z")

</div>

Hello,  
Im developing some software that is getting complex fast.

- Arduino with capacitve touch input
- Serial comms
- Particle system
- Projection mapping

My question is about program structure and best practise. I have all this working in seperate programs; I want to combine them all.

Should I create seperate files in one sketch folder and convert them all to classes?

My thinking is use a serial comms sketch and instanciate the other programs as objects. I realise theres many ways to do the same thing but I would like to know what others do when structuring bigger more complex programs. Is there a standard JS rule to keep to?

Thanks in advance to any advice  
Chris

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [July 5, 2023, 5:56pm UTC](https://discourse.processing.org/t/creating-complex-programs-merging-programs/42347/2 "2023-07-05T17:56:18Z")

</div>

Hello!

I think that’s the right way.

Make a tab / file for the main functions setup and draw,  
a tab Tools and a tab for each class.

With a class you can encapsulate the variables and functions so that they are separated, even though you instantiate only one object per class, that’s okay.

You can add new tabs / files (((in the processor IDE, not js))) in the bar where the Sketch’s name is written: There is a small arrow pointing down 🔻. In the local menu choose New Tab etc.

Welcome back, cuvner! 😉

Chrisir
