prisonerjohn / processing-web

0 stars 0 forks source link

[CLOSED] Example code on 2darray tutorial doing unecessary function calls #87

Open prisonerjohn opened 10 years ago

prisonerjohn commented 10 years ago

Issue by BernardoFBBraga Thursday Mar 28, 2013 at 00:24 GMT Originally opened as https://github.com/processing/processing-web/issues/87


The last example on http://processing.org/learning/2darray/ is doing 101 unecessary function calls every draw() loop. Once for background(0) and 100 times for stroke(255) (once for each cell)

Both the " stroke(255); " and " background(0); " lines could be on the setup funcion

prisonerjohn commented 10 years ago

Comment by shiffman Friday Mar 29, 2013 at 02:49 GMT


While this is technically true, it's just a stylistic choice I'm making. I prefer to have stroke(255); in the display() method of the object since it is tied to how the object is drawn. While there is nothing else drawn but the objects in this particular example, if one were to add additional elements with different strokes, we'd want to keep the stroke() calls with all the shapes to avoid confusion.