to make a library, or not to make a library?

Hello fellow Processors
I have been working on the "boids" algorithm for quite some time now, and have had some fun with it. I have also started making some generalisations about autonomous agents models. I know there are existing libraries for that purpose, but I kind of prefer to reinvent the wheel.
I was wondering if it is a big step to make my own library.
-Is that far away from just a collection of classes?
-What else would a library consist of?
-Where should I look for guidance?

Answers

  • A library is just a collection of classes that you can add to your project to use some functionality that somebody else wrote. For example, the minim library is just a collection of classes that handle playing sounds for you. The core Processing library contains the code for things like PApplet and PImage, and the core Java library contains the code for things like ArrayList.

    There are any number of ways to create your own library. I would recommend doing it outside of the Processing editor, since that introduces a bunch of dependencies that you probably don't want. Instead, you can use a Java IDE or even just the command line to compile your own classes. Then you can take those classes and put them into a jar, which you can add to your Processing sketch.

  • edited March 2014 Answer ✓

    You can write your library in Processing's own IDE. Just create tabs named w/ extension ".java" for each class and interface.
    When the library is ready to become a ".jar" for distribution, I believe you'll need to use a more adequate IDE though! 8-X

  • Answer ✓

    I would not recommend using the Processing IDE to create a library of any significant size, it just does not have the development tools to support the task.

    I strongly recommend using Eclipse, it is extremely powerful so will take some time to get used to it. The Processing GitHub site has a section explaining how to setup an Eclipse project to create a Processing Library.

    The first step is simply to get an Eclipse project that builds successfully. After that it is just Java programming.

  • Answer ✓

    I would recommend intelliJ over eclipse. I had a lot of problems with eclipse, it's kinda bugged.

  • What problems? What bugs did you find? It is often the case that these "bugs" are a result of misunderstanding how something works, not a result of the thing working incorrectly.

  • Answer ✓

    I use Eclipse daily at work. It has its issues, but it works. I briefly tried IntelliJ, but didn't liked it. I might try it again, but for my work, I would need the paid version (JEE), so it is a kind of dead end. I also tried NetBeans a long time ago, it is also a great IDE.

    Eclipse has the advantage of having lot of plugins developed for it, and to support lot of different languages (but the other IDEs improved with regard to that).
    I suppose I stick to Eclipse because I am used to it... :-)

    Overall, it is still a good choice, but I recommend to try out the two others: they are free, so there is no risk, except spending a bit of time. But each one can find the IDE fitting the most to their way of doing things...

  • Answer ✓

    IntelliJ has multiple cursors now :) And yeah being used to a program is a huge advantage. I'm not used to anything really (except processing ide :) )

  • What problems? What bugs did you find? It is often the case that these "bugs" are a result of misunderstanding how something works, not a result of the thing working incorrectly.

    It's a long time ago so i forgot a lot. I do remember that often i couldn't compile unless i restarted eclipse. And it would point out errors that where not valid, and those errors also disappeared on a restart. I found more people with this problem, and a lot of solutions that didn't work. It really drove me nuts.

Sign In or Register to comment.