I've used p5 a lot for a fairly wide range of project sizes, largest being about 2-3k lines. It definitely got some major downsides. The use of globals my biggest gripe for large projects and testing. Some of the p5 libraries, the p5.sound especially, are horrible with performance, at least with what I was doing.
That being said, the API for p5 is excellent. Since it is based on Processing, the ease of use has been thought through extensively. I definitely don't think I would ever want to use vanilla canvas API. I think the Processing foundations mission of making a library accessible for artists and designers fits perfectly with p5.
Everything you said though is spot on. In the end, it's all about trade-offs.
Cameren, I agree wholeheartedly about the issue with globals! Have you got a chance to play around with p5 instance mode [p5js.org/examples/instance-mode-in...]? It helps somewhat with this issue.
Yes, I have used instance mode. My P5-Electon Quickstart Template uses p5 instance mode. It definitely solves the problem of globals, but at the cost of readability p.ellipse vs just ellipse. While it is pretty much required in order to build a well structured application, something about it just feels not in the spirit of p5.
Overall, for a vast majority of projects made with p5, I think instance mode is not necessary. Globals really don't matter when you're quickly iterating and building a cool art piece with a code base you are not going to maintain.
I think that reduces the problem by a little bit, but you are still mutating the variables scoped to the main function. Atm i dont think theres any actual functional way
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I've used p5 a lot for a fairly wide range of project sizes, largest being about 2-3k lines. It definitely got some major downsides. The use of globals my biggest gripe for large projects and testing. Some of the p5 libraries, the p5.sound especially, are horrible with performance, at least with what I was doing.
That being said, the API for p5 is excellent. Since it is based on Processing, the ease of use has been thought through extensively. I definitely don't think I would ever want to use vanilla canvas API. I think the Processing foundations mission of making a library accessible for artists and designers fits perfectly with p5.
Everything you said though is spot on. In the end, it's all about trade-offs.
Cameren, I agree wholeheartedly about the issue with globals! Have you got a chance to play around with p5 instance mode [p5js.org/examples/instance-mode-in...]? It helps somewhat with this issue.
Yes, I have used instance mode. My P5-Electon Quickstart Template uses p5 instance mode. It definitely solves the problem of globals, but at the cost of readability
p.ellipse
vs justellipse
. While it is pretty much required in order to build a well structured application, something about it just feels not in the spirit of p5.Overall, for a vast majority of projects made with p5, I think instance mode is not necessary. Globals really don't matter when you're quickly iterating and building a cool art piece with a code base you are not going to maintain.
I think that reduces the problem by a little bit, but you are still mutating the variables scoped to the main function. Atm i dont think theres any actual functional way