A class is a template; an instance is one concrete object created from that template
Object-oriented programming (OOP) organizes code around classes and instances. A class is a reusable definition (template) specifying the properties (variables) and methods (functions) an object of that type has. An instance is a specific object created from the class using the new keyword — each instance has its own copy of the properties. Multiple independent instances can be created from one class; they share structure but hold independent data. In Processing, define a class with class ClassName { ... }, create instances with ClassName obj = new ClassName();, and call methods with obj.methodName(). This structure is essential for generative systems with many agents (particles, circles, cells) that each need their own state.
Examples
A Circle class defines x, y, radius, fillColor, and a drawMe() method. Creating 100 Circle instances gives 100 independent circles, each with its own position and color, all drawn by the same drawMe() code. Without OOP, you’d need 100 sets of separate variables.
Assessment
Explain the difference between a class and an instance, then write pseudocode for a Dot class with x, y, size properties and a draw() method, and show how to create 10 instances in a loop.