Lab 0:  Processing Polyglots
Bard College – Computer Science – Object-Oriented Programming

Create an image of an object using only a colleague’s textual description and (polyglot) code.

POLYGLOT: “a program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it.”  

Although polyglots are a bit of an esoteric, artistic programming endeavor they do have applications and security implications.

Part 0 (before lab)

  1. Choose one specific everyday object, preferably one you can see (in person or online).
  1. Without ever explicitly naming the object, write down an English language description of the object using sentences of the form:
  •    The object is a kind of _____________________________________.
  •    The object has  _____________________________________. 
  •    The/A _____________________________________ is a kind of ______________________________.
  •    The/A _____________________________________ has  _____________________________________.
  1. On the provided graph paper, draw a depiction of your object. Keep this picture secret.
  1. Give both sheets of paper to your instructor (with your name on both).
  1. The instructor will give you someone else’s description to use for the final piece of the lab.

Warm-up

Create a sketch recreating one of “Computing Unplugged” pictures we saw this week.

Part 1

  1. In a new Processing sketch, recreate your partner’s object based purely upon their written description (communication is allowed only for handwriting or vocabulary clarification) under the following constraints:
  1. Use at least two different shape primitives (e.g. line, rect, quad,  ellipse, curve).
  1. Use at least two shades of gray (in addition to the background color).
  1. The program must run in both Python & Java Processing modes: a POLYGLOT. 
  • (note: typically we won’t see semicolons in Python programs, however that syntax is valid). 
  1. BONUS: Allow resizing; so the picture looks correct with arbitrary size() inputs.
  1. In a comment at the top of your program, in addition to the standard header, write a paragraph reflecting on what was easy to visually depict, what was difficult, and what was ambiguous.

Learning Objectives

  • Understand the Processing coordinate system & shapes.
  • Understand color spaces.
  • Create a static image with code.
  • Write a specification.
  • Implement a specification.
  • Think about inheritance and composition relationships.
  • Write a Polyglot.
  • Program under constraints.

Submission (due September 9th, 2021)

  • Your program should start with a comment that includes your name, email, date, assignment description, collaboration statement, and reflection (this part doesn’t have to be a polyglot).
  • Bring a hardcopy of your program (the source code, not the graphics) to your next lab period. 
  • Also turn-in the original textual description.