Course Info

#Programming Fundamentals 1

This is an introductory Programming module and assumes no prior knowledge of programming.

In this module, we will introduce you to the Java programming language through the Processing Development Environment (PDE) and then IntelliJ.

First, we will work through non-complex problems that will introduce you to the basic constructs of programming languages i.e. Sequence, Selection and Loops. You will also learn to use variables, different data types, manipulate the data, logical operators and methods. This will be done using processing.org

Then, using IntelliJ, we will progress to more complex problems that will briefly introduce you to object-oriented programming and data structures. You will do a deeper dive into both of these areas in the semester 2 module, Programming Fundamentals 2.

Basic Animation

  • We will use the following built-in functions to animate our drawings:
    • setup()
    • draw()

A note on the setup() function

  • setup() is called once when the program starts and should not be called again.
  • setup() can set the screen size and background colour.
  • There can only be one setup() function for each sketch.

A note on the draw() function

  • You should never call the draw() function.
  • Processing automatically calls the draw() function straight after the setup() call.
  • draw() continuously executes the code contained inside it.
  • There can only be one draw() function for each sketch.

Animating Ellipses

In your PDE, enter the following code: Animating Ellipses Using the File, Save as… menu options, save this sketchbook with the following naming convention: labXX_stepYY, where XX is the number of the lab and YY is the number of the step.

Run the code. As you move your mouse around the canvas, you should have animation similar to the screen shot below. Animating Ellipses - Multiple Circles Can you explain why there are multiple circles drawn? Why not just one circle?