Review of Last Week(s)
- Marks from midterms – any questions or concerns?
- What did you get done? What are your major problems/concerns going forward? (Project updates)
- Notes and thoughts from the class…
- Laser cutter 2pm-ish
- Quick look at Processing assignments? Anyone wanna show anything?
- Quick look at Physical computing assignments? Anyone do anything fun?
- Final project presentations on May 14th. This is, as ever, outlined in the Module Handbook.
- NOTE! You lucky ducks have until May 28th (“Week 14″) to polish up any remaining ‘things’ that you’d like to be evaluated as part of the project. If these are large, dynamic or physical, they need to be documented (however you please) on your blog. If they can be submitted, they need to be submitted to the SACS office.
- Week 10: Statistics, algorithms and guest
- Week 11: Individual meetings – SIGN UP HERE – Max/MSP scripting with java and javascript
- Week 12: PRESENTATIONS!!! 20 mins each, go through concept, ideas, context, show what you have completed. There will be new people in the audience, so START FROM THE BEGINNING
- For those using Basic Techniques as a starting point for your final projects – Make sure you’re describing what you accomplished for your Basic Techniques
Rationale
First week back after a the March-no-class-so-you-can-work-on-your-projects-time, so we’re going to try and spend a good amount of time just catching up and making sure everyone is on track to finish with a gold.
Then – if we have time – a short look at a new topic, just so we cover it – object orientation and OpenFrameworks. As we’re all starting to look at more complex systems, it’s the right time to look at the idea of ‘object orientation’ – or the encapsulation of functional and memory aspects of your program into specified structures. At the end of this discussion we’ll look at a computing language that is specifically designed for this kind of object oriented work – C++ (via OpenFrameworks).
OOP = Object Oriented Programming
The conceptual basis for object orientation, is not that difficult, although it is couched in a certain language that we should be familiar with, and is often addressed in an entirely over-explained way (especially in programming textbooks). The simplest understanding is an analog to language, or words – which linguists will tell you are at once a thing, as well as often a reference to a thing. Most generally:
- Imagine the idea of a chair. This idea of a chair is a ‘class‘ – that is, it is your general concept of something that has no ‘specific’ manifestation (yet!)
- Class functions or methods refer to things that that class can general do or provide. Chairs can generally be used for sitting, or for propping open doors, or for hitting people over the head. These are functions of the class “chair.”
- Class fields or variables refer to properties of a class. Chairs could have a specific design, material, or upholstering.
- Imagine a specific chair. Having just the idea of a chair, is not particularly useful. Let’s say we’re talking about the Poul Kjaerholm chair (probably my favorite modernist chair). This chair is an ‘object‘ which is an ‘instance‘ of the class chair.
- functions or methods would be the same as for all chairs (above), but also might include elements specific to this chair. E.g.: Give-off expensive seeming leather smell.
- fields or variables would then be ‘filled in’ during an instantiation of a the object (E.g.: design: Kjaerholm, material: leather)
- Objects as ‘variable’ type:
- Creating an object from a defined class is much like creating a variable
- You must give it a name, and you must declare it (i.e.: ‘make’ one)
- Functions and fields are accessed via the dot operator
- Definining a class:
- Make a constructor (always with the same name of the class) -
- A method that defines what happens when you make an object, initialization
- Define the Class’ internal variables
- Define the Class’ functions and methods
- Make a constructor (always with the same name of the class) -
- You can have arrays of objects/classes! use tha [ ] operator
- Further conceptual info from Sun
Max/MSP
- There is a sort of ‘class’ structure to every instantiation of a Max object, more or less
- Particularly class-like structures are uses of poly~ objects, or Java/Javascript implementation in Max
Processing
- Processing allows the use of Classes, as well as their definition by the user (you)
- Reference for Processing Classes
- Reference for Processing Objects
- Example
- class_functions
- class_intro
- class_example (ball!)
- classes in the Video library, etc.
OpenFrameworks
- OpenFrameworks, unlike Max and Processing is a framework – or software framework – basically like a bunch of really big libraries/extensions, but you have to provide the infrastructure on your computer to program with
- On OSX, that infrastructure is XCode – if you don’t have it, you can get it here
- The main difference between a library and a framework, is that a framework requires certain things of you and the way you write your code
- OF is a C++ framework – i.e.: It is a collection of C++ tools (other frameworks!!) that are designed for people like us
- The C++ language is a class-based language. It was the first, or the most popular first, language to come about after OOP really got going – so it’s designed for CLASS structures. It’s often referred to as “C with Classes.” Everything, more or less is a CLASS of something else. (This is also true of Java, Processing, etc., by the way, but most of that is obscured in Processing).
- Why? It can be REALLY fast. Like, RRREALLY fast.
- The basic idea
- C++ programs are assemblages of Class files
- Class files are composed of a ‘header’ (.h) file and a class (.cpp) file
- Headers are used to declare the Class and the methods of the class, but
- .cpp files are used to define these classes and methods
- C++ classes can define static methods (called anywhere, any time) and instance methods (called as methods of an instance of a class, i.e.: of an object)
- General usage and examples
- Download (get the FAT one)
- Every OF application is an instance of ” ofBaseApp” – which handles a bunch of stuff like fullscreen mode and user input, etc.
- Start by copying the folder “emptyExample” and renaming the folder
- Open testApp.cpp and insert code in event handling methods of the OBJECT testApp
- Note that if you want to create ‘global’ variables that can be accessed anywhere in the program – these need to be in the .h file!
- Docs for various methods/functions here
- Key addons:
- OpenCV – computer vision library (same as the one used in Max/MSP/Jitter, but much faster here)
- ofVectorMath – similar to the Shiffman Processing vector library
- NB.: There is very good reason, as OF is based on Processing, to sketch/learn first in Processing and then move/re-implement in OF!
To Do:
- Finish up project work!!!!
- Be communicative about problems you’re having!
- Next week is regular class – a few new topics, but we’ll leave plenty of individual consultation time

