We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Possible to author "helper" sketches
Page Index Toggle Pages: 1
Possible to author "helper" sketches? (Read 301 times)
Possible to author "helper" sketches?
Oct 7th, 2008, 1:23am
 
First off, I wasn't sure how to even phrase this in Processing-lingo, let alone search for it.  Or know if this is the correct forum for it (hope so).  So I apologize if this has been addressed (and I'm guessing it has), feel free to point me to that thread...

I'm pretty familiar with Python and MEL, and enjoy Processing a lot in my 'after hours development'.  One thing that I feel is limiting me is the ability to author any kind of larger set of data that I can reuse in other sketches.

Sketches in processing seem pretty inclusive:  About all they *seem* (to my knowledge) to be able to import is other libraries.  I'd like to be able to author 'helper sketches', and "import" their functions and classes into my other sketches... thus building a 'depot' (for lack of a better word) of reusable code.  Copying and pasting code from sketch to sketch I find really tedious.

Is this doable?  It seems that authoring an actual 'library' for processing needs to be authored outside of Processing itself, and presumably in Java (for which I have no knowledge other than Processing itself).

Thanks
Re: Possible to author "helper" sketches
Reply #1 - Oct 7th, 2008, 3:48am
 
You can write separate functions and classes and store them in a "depot"; then select Add File... (under Sketch menu) and bring em in. You'll get a new tab for each function/class you import.

(What would be a good functionality to add though is the ability to add multiple files with Add File...)
Re: Possible to author "helper" sketches
Reply #2 - Oct 7th, 2008, 4:51am
 
AH, I see that, thanks! (never really paid attention to it before).  
But its still making a copy of the depot code and inserting that copy in the sketch, which is specifically what I'm trying to avoid (the duplication of code).  What happens when your depot code is updated...?  Now you have to go back and re-add them every time to each sketch that points to them?  Ugh...

Any other ideas?  Appreciate it.

(BTW, love your book!)
Re: Possible to author "helper" sketches
Reply #3 - Oct 7th, 2008, 12:59pm
 
Lol! Sounds familiar...
See my suggestion: Easier code reuse in Processing

I just noticed I should submit this suggestion in the bug database to be taken in account, but I expected a bit more feedback before doing so.
I think I will do the move... But if you want to criticize/improve my idea before, you are welcome!
Re: Possible to author "helper" sketches
Reply #4 - Oct 7th, 2008, 7:02pm
 
That looks to be exactly what I'm after.  Yes, if there is any way to promote this concept as a future improvement, I'd sign on the dotted line right away! Wink

thanks
Hint: make use of Hardlinks (also ntfs!)
Reply #5 - Oct 9th, 2008, 11:07pm
 
Hi,
i am solving problems like this by using the slim but perfect
Link Shell Extension by Herrmann Schinagl:
http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
that gives you the ability to use those evergreat Hardlinks with the ntfs file System (thus Windows Explorer).

Maybe the Hardlink-solution is so ideal for this problem, that it should be considered for processing's library/import-system natively?

blausand
Page Index Toggle Pages: 1