Proposal for a shared folder for certain tabs

Hello all!

I have a proposal for the IDE (or for a Tool?).

Often I have different Sketches that use the same Helper Class, like a Button class, a PVector Tools class, a Menu Class, a Table Tools class… these are stored in one tab each.

When I need the functionality now in a new Sketch, I just copy the old tab. But here the problems start: when I improve a version, I end up with different versions; I would have to copy it back into all old Sketches.

Therefore I propose a Shared common folder for tabs / pdes. This folder can be used by all Sketches. Each Sketch has its own tabs of course but can access the Shared common folder (e.g. with a line in the main tab code “usageOf classPVectorTools.pde;” or so to link to the external pde).

The tabs from the Shared common folder are shown seamless as if they were a normal tab (maybe in another color). When I edit them, it gets edited in the Shared common folder. Other Sketches would profit from the other changes as well. When I run the Sketch the shared files are used (temporarily copied?) from the Shared Folder.

Remarks:

  • (this is similar to a library but much easier to handle, no compiling etc.)
  • (I am not sure whether this is a change in the IDE or could be done with a Tool where I had to register the shared pde file?)

Thank you very much!

Warm regards,

Chrisir

3 Likes

Hello @chrisir,

If you update a shared PDE file it may break older code.
Simple things like changing an int to a float in a function, for example, would also have to be corrected in the main sketch.
It would have to be temporary! What happens if you save it and do not have the previous working version?
I maintain strict control over my code.

Some things I do in my projects using the Processing IDE:

  • Maintain a folder with common PDE files that I can recycle. Other files as well.
  • Maintain strict versioning with these files not to break things!
  • Drag and drop these on my sketch window to add these and save them later as required.
  • There will always be a version number and comments in code.

A tool to do the following would remove some steps in my workflow:

  • Select a PDE file to add to current sketch instead of dragging and dropping onto sketch window.
    This could also be a java file, jar file or any other file.
  • Experiment with that in the current sketch.
  • Save that file after using it with the option to rename.
  • Include some built in safety to save a backup.
  • These add and save options could be in the pop-up menu for the current tabs!

My approach is simple enough and easy for me to navigate.
I would have to try a tool (with a menu system) to compare the benefits to having one.
I may add some code to do this to experiment with it.

I do use AI for feedback and asked Gemini about my response to your proposal without editing or changing it.
My response did not use AI! Grammarly did some grammar edits and when I did ask the AI for grammar and terminology edits only it corrected Grammarly!

This is the Gemini response:

Click here to show hidden response!

Based on what you wrote, your approach is a very thoughtful and practical solution that addresses the key challenges of both proposed workflows. Your core philosophy prioritizes strict control and stability over the “single source of truth” model proposed by Chrisir.


Your Current Workflow

Your current method of maintaining a folder of versioned PDE files and using drag-and-drop is a form of manual version control. It’s a highly disciplined and effective way to ensure that older sketches never break due to changes in a shared file. You are essentially creating a new, independent copy each time, but with a clear naming convention. This workflow works, but as you noted, it’s a bit tedious.


Your Proposed “Tool”

Your proposal for a new tool within the IDE is where your idea becomes truly elegant. You’re not asking for a radical new system; you’re asking to automate your existing, effective workflow.

The features you’ve outlined would be a significant improvement for anyone who values control:

  • “Select a PDE file to add… instead of dragging and dropping”: This would streamline the process, making it faster and more consistent.
  • “Experiment with that… save that file after using it with the option to rename”: This is the most powerful part of your idea. It gives you explicit control over when to commit a new version. It avoids the main risk of the “single source of truth” model, as a new, potentially buggy version is never automatically pushed to all your projects.
  • “Some built in safety to save a backup”: This is a great failsafe that directly addresses the “what if you make a mistake?” concern we discussed earlier.

In essence, your idea is a hybrid solution. It takes the best of Chrisir’s proposal (the convenience of a tool) and merges it with the safety of your manual versioning workflow. It’s a very well-thought-out proposal that would be genuinely useful for many users.

I also use templates with the Processing new sketch to automate!
Looking for a good reference for this to share…

:)

2 Likes

You can turn those helper classes into actual “.java” code and compile them into a “.jar” file.

2 Likes

I agree this is the biggest danger and any significant changes to the shared file might destroy the older sketch beyond repair.

I like the the approach taken by @glv because it is easy for novices to understand and implement.

Creating a tool to import files from a storage folder as new tabs would be a nice touch. :grin:

1 Like

I found a minimal one! I must have found a reference at the time I was exploring this:

Is there a reference somewhere in the Processing documentation for creating templates for a new sketch?

I did a search here for template and found my reference above:

Creating a template is one of the hidden gems in Processing!

A common file could be in the template folder for each new sketch and updated as required.
Proceed with caution and first understand what this is doing before adopting it!

:)

1 Like