Thursday, December 1, 2011

Processing.js Horror

Processing.js reminds me of RPG code. The fill() function in the code below is a mystery. fill() offers no hint of what context the fill is to apply to.
if(count <= 90) {
      letter = char(65+counter);
      if(letter == 'A' || letter == 'E' || letter == 'I' || 
         letter == 'O' || letter == 'U') {
           fill(204, 204, 0);
      } else {
        fill(255);
      }
    } else {
      fill(153);
      letter = char(48+counter);
    }
By running the code, one can see that the fill does indeed apply to the letter. It appears that fill() can be called either before or after the letter is created but who can be sure? In this code, a letter is created and the fill is defined but we never see how the two are brought together. Object oriented development avoids this problem.