What is a natural learning path to create a processing library for a newbie?

Hi everyone,

I am new to processing and only able to code simple applications with processing at this moment. However, I have some ideas for a processing library, and wonder how to start learning toward this goal of creating my first processing library.

I found myself lack of knowledge of comprehending details in libraries Basics in github . Neither the handbook by Reas and Fry and LearningProcessing by Shiffman seemed to teach building libraries. Does it mean a newbie need to learn building libraries for processing from elsewhere, like a course in Java? Is it possible for a newbie to learn building processing libraries within the realm of processing without going out to learn another course of Java? (I am glad to learn Java if it is what takes to build a library)

What would be a natural learning path to take for a newbie who is at the moment just able to create simple apps in processing to create a library for processing?

Thank you

Answers

  • edited October 2015

    This is as far I've got to make a Processing library:
    https://forum.Processing.org/two/discussion/12532/windowjs-cross-mode-alert-confirm-prompt-other-js-api-for-java

    Never advanced further than that yet. :-\"

  • Answer ✓

    The guides for creating libraries are written by programmers so are guaranteed to be unintelligible to newbies ;)

    The first thing to do is keep it simple, don't worry about creating cross mode libraries start by focusing on libraries for Java mode.

    I don't know how much Java you know but to create libraries you must be able to create classes in Java. As you develop and move onto large more complex libraries a good understanding of object orientation would be very helpful.

    Assuming that you have basic knowledge of Java classes then the next step is to setup your development environment. I use Eclipse for all my libraries, it is a powerful beast and can be quite daunting for a newbie but worth the effort to learn. There are several forum members who started as Processing newbies but have written libraries with Eclipse.

    install Eclipse for your system. You will also need a JDK (Java Development Kit) if one isn't installed already.

    Also there is an issue with the instructions for importing the library template project but hopefully that will be fixed before you get that far. If not ask here and I will give the correct instructions for doing it.

  • @quark Thanks and your replies help a lot.

    I did know the basic of Java and making class but never learnt anything related to making a library, so I wonder whether it requires a lot more to learn beyond making classes before making a library.

    I head of Eclipse and looked into an online course of it but does not seem to relate anything to making a library. I will keep exploring here...

    If possible I would prefer to go straight into information on how to make a simple processing library without leaving processing3. so I did some search and found a video teaching making a processing library while staying inside Processing using a library template.

    a brief version of the video

    However, this video was done 2 years ago and the template he created was in window environment (I am with mac). I have no way to check whether it is working or not for mac.

    I wonder whether you could have a look and see whether this method can equally and easily apply to processing3 in mac environment, and also whether this method is feasible for common processing libraries.

    Thank you very much

  • @GoToLoop thanks for your reply

  • @quark, I am going through a course on Eclipse, and realized that it is very powerful tool to have. Thanks for introducing it.

    I have a quick question: if we can use eclipse to create processing libraries, then it should indicate that we can write and run processing codes just like writing normal Java codes in Eclipse, right?

    Thanks

  • What kind of library do you want to create?

  • I don't think there is a kind for it, it's more like a pet of my own with a bunch of functions I use often in processing.

  • Why don't you just put those functions in a class that you then add to your sketches? Creating a library just for that seems like overkill, especially if you aren't familiar with general Java programming.

  • Answer ✓

    then it should indicate that we can write and run processing codes just like writing normal Java codes in Eclipse, right?

    Up to a point that's true, except in Java everything must be inside a class and Processing hides that from you. Also I Processing you have such as

    void setup(){
    }
    
    void draw(){
    }
    
    void mouseClick(){
    }
    

    In Eclipse you must specify the access modifier i.e.

    public void setup(){
    }
    
    public void draw(){
    }
    
    public void mouseClick(){
    }
    
  • There was this thread about re-using code in processing. Don't know if and how it evolved...

    https://forum.processing.org/two/discussion/6431/adding-additional-options-for-code-reuse

  • Answer ✓

    Now you have installed Eclipse you might want to try creating a library.

    The instructions are here and I suggest Option B Download Package

    Follow step 1 to download the package but DO NOT FOLLOW STEPS 2 & 3

    instead select File > Import from the menus. In the dialog box that opens expand the General tab and select the Existing Projects into Workspace option. Then click Next

    In the next dialog box choose the second option Select Archive File and browse to and select the zip file you downloaded. Then click Finish

    A new project called processing-library-template will appear in the Project Explorer window.

    You can then move on to the Set Up and Compile instructions.

  • @KevinWorkman Thanks, it is a clever solution.

  • @quark Great, I will try to open and run processing in Eclipse and then try to create libraries there. Thanks a lot.

  • @GoToLoop @_vk Thanks, I will read them later.

  • edited November 2015

    @quark

    I followed processing official site's instruction to run processing on Eclipse exactly a few times, but the same error occured. (I tried two different versions of Eclipse as well)

    This is the code and imported file on the latest Eclipse IDE for Java Developver Neon Milestone 2 (4.6.0M2)image

    However, when I clicked it to Run As, there is (none applicable); and when I clicked it to Run directly, there is pop up window saying The selection cannot be launched and there are no recent launches.

    As for the process of import core.jar, I did exactly to import core.jar from Processing library. Everything is done as the instruction said. I even tried to bring in other files in processing library. Still not working

    I really have no idea where is going wrong.

    Thank you

  • edited November 2015

    Got no experience w/ Eclipse. But I'd start w/ something not dependent on anything but regular Java API.
    Those 2 library links I've posted above rely on Java API only btW. :>
    Mostly JOptionPane and other related swing classes. ~O)

  • @GoToLoop I'm sorry I don't understand what you mean

  • edited November 2015

    You said you're having problems for Eclipse to recognize external libraries like Processing.
    Just maybe you should start by compiling some library which just relies on regular Java API instead.

  • Thanks @GoToLoop, but all I want the most at the moment is first to be able to use processing inside Eclipse.

  • Well, I thought you wanted to create a library for Processing 1st. 8-|

  • Sorry, I didn't make myself clear. As I am more familiar with processing than java, and many functions I wrote in processing, so the library I want to make for processing is full of functions written in processing at the moment. Now I see Eclipse would be a great tool to use with processing, so I want to learn to use processing in Eclipse as soon as possible. Thanks for your help anyway.

  • I have sorted out the problem of running processing code in Eclipse. And more questions followed but diverged from this topic now. So, I opened another discussion for this new direction. Thanks everyone!

Sign In or Register to comment.