Getting Started, Object & Data

Jusung Kim
2 min readNov 29, 2020

--

I have finished the chapter named Getting Started

From there, I practiced how to type codes for a circle and drawing circles when I move my mouse. I also learned that basic information of processing programs such as saving, exporting, and locating my codes.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Objects

a thing that has properties and can do stuff(function)

Object-oriented programming is the marriage of all the programming fundamentals: data and functionality.

class(human being template) vs object(instances of the idea of a human being)

You can reduce the code variables(car color, car location, car speed → the car object) = an object can greatly simplify the main parts of a Processing sketch (i.e. setup() and draw()).

Class Name: The name is specified by “class WhateverNameYouChoose”. We then enclose all of the code for the class inside curly brackets after the name declaration. Class names are traditionally capitalized (to distinguish them from variable names, which traditionally are lowercase).

Data: The data for a class is a collection of variables. These variables are often referred to as instance variables since each instance of an object contains this set of variables.

Constructor: The constructor is a special function inside of a class that creates the instance of the object itself. It is where you give the instructions on how to set up the object. It is just like Processing’s setup() function, only here it is used to create an individual object within the sketch, whenever a new object is created from this class. It always has the same name as the class and is called by invoking the new operator: “Car myCar = new Car();”.

Functionality: We can add functionality to our object by writing methods.

Using an object: The details

Step 1. Declaring an object variable

Objects — complex data dypes (data & functionality) : Primitive(only store data)

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Data

Strings and Drawing Text ← first??

--

--

Jusung Kim
Jusung Kim

No responses yet