LCC 6310 Computation as an Expressive Medium

Slides:



Advertisements
Similar presentations
Object Oriented Programming in Java George Mason University Fall 2011
Advertisements

Chapter 2: Your First Program! Hello World: Let’s Program  All programs must have the extension.java  Our first program will be named: HelloWorld.java.
Software. What Is Software? software –Also called Computer programs –Are a list of instructions –Instructions are called code –CPU performs the instructions.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
OOP & JAVA. HelloWorld.java /** * The HelloWorld class is an application that * displays "Hello World!" to the standard output. */ public class HelloWorld.
IAT 800 Foundations of Computational Art and Design ______________________________________________________________________________________ SCHOOL OF INTERACTIVE.
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C,
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
Hello, world! Dissect HelloWorld.java Compile it Run it.
CSE 131 Computer Science 1 Module 1: (basics of Java)
IB Computer Science II Paul Bui
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 18: 0xCAFEBABE (Java Byte Codes)
Lecture 1 Introduction to Java MIT- AITI 2004 What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word.
LCC 6310 Computation as an Expressive Medium Lecture 1.
CSCI 273: Processing An Introduction. Programming Languages –An abstract "human understandable" language for telling the computer what to do –The abstract.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
Java Lecture 16: Dolores Zage. WWW n Was a method for distributing passive information n added forms and image maps n interaction was only a new way to.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Java Bytecode What is a.class file anyway? Dan Fleck George Mason University Fall 2007.
Lecture 1 Introduction to Java MIT-AITI Ethiopia 2004.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Java Spring PImage Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
May 9, 2002Serguei A. Mokhov, 1 Kickstart Intro to Java Part I COMP346/ Operating Systems Revision 1.6 February 9, 2004.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Board Activity Find your seat on the seating chart Login – Remember your login is your first initial your last name and the last three numbers of your.
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
CSCI Processing CSCI Introduction to Algorithm Design An Introduction.
Compiling and the Java Virtual Machine (JVM). The syntax of Pseudocode is pretty loose –visual validation encourages a permissive approach –emphasized.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Mini University July, 2005 A Little Taste of Java (but don’t tell your folks) (they might think there’s caffeine involved)
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Lecture 1. Introduction to Programming and Java MIT- AITI 2003.
A Look at Java. Categorize Java Which paradigm? Which paradigm? Scripting? Scripting? Declarative or procedural? Declarative or procedural? Which generation?
Java Basics 1 Brief History of Java and Overview of Langauge.
LCC 6317/4720 Interactive Narrative Lecture 1 January 10, 2005.
CSc 201 Introduction to Java George Wells Room 007, Hamilton Building
CS 106 Introduction to Computer Science I 01 / 22 / 2007 Instructor: Michael Eckmann.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
CS 106 Introduction to Computer Science I 01 / 22 / 2008 Instructor: Michael Eckmann.
OOP Basics Classes & Methods (c) IDMS/SQL News
ITP 109 Week 2 Trina Gregory Introduction to Java.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
Learning Plan 6 Java Programming Intro to Object Oriented Programming.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
IAT 265 Multimedia Programming for Art and Design ______________________________________________________________________________________ SCHOOL OF INTERACTIVE.
Chapter 1 Coding Introduction.
Lecture 1b- Introduction
The need for Programming Languages
CS216: Program and Data Representation
Introduction to.
LCC 6310 Computation as an Expressive Medium
CompSci 230 Software Construction
Introduction to Java Dept. Business Computing University of Winnipeg
Getting Started ARCS Lab..
Chapter 1 Coding Introduction.
Java Intro III.1 (Fr Feb 23).
Introduction to Algorithm Design
Lecture 19: 0xCAFEBABE (Java Byte Codes) CS201j: Engineering Software
Introduction CSC 111.
IB Computer Science II Paul Bui
LCC 6310 Computation as an Expressive Medium
Chap 1. Getting Started Objectives
Chap 4. Programming Fundamentals
Zorah Fung University of Washington, Winter 2016
Presentation transcript:

LCC 6310 Computation as an Expressive Medium Lecture 1

Overview Go over the syllabus Brief introduction to me and my work Art, programming and Java

Syllabus

Background Ph.D. in Computer Science Expressive AI: Artificial Intelligence-based art and entertainment Worked in industrial research labs (Intel, Tektronix) doing HCI research New at Georgia Tech – arrived in January

AI & Art The Senster, 1970 Black and White, 2000 Edward Ihnatowicz Peter Molyneux (Lionhead)

Work Façade – interactive drama Terminal Time – interactive video Illustrate these ideas by describing three AI-based artworks. I’ll talk briefly about Office Plant #1, and in more depth about Terminal Time and Façade. This talk is primarily structured as a computer science talk – if you are more interested in conceptual, aesthetic, or art theoretic issues, please ask at the end. Terminal Time – interactive video Office Plant #1 – robotic sculpture

Façade Dramatic world inhabited by computer controlled characters (believable agents) The user (player) plays a protagonist within the story, first-person point of view The player experiences a story with a dramatic arc Collaborator: Andrew Stern, independent artist and researcher

Terminal Time Collaborators: Goal trees (ideology) Historical events Audience feedback Audio-visual elements Collaborators: Steffi Domike, Design Department, Chatham College Paul Vanouse, Art Department, SUNY Buffalo

Office Plant #1 Creates a background presence Sorts incoming email into social and emotional categories Behavior is a function of the email received Switch to video at the end of this slide. Collaborator: Marc Bohlen, Media Studies, SUNY Buffalo

Combine AI research and art Expressive AI Artistic practice AI research Wrestling with meaningful human experiences suggests new AI research directions… AI methods and technology suggest new audience experiences…

Some directions I’m someone to chat with about… Interactive story (particularly procedural approaches) Robotic sculpture Video games as a cultural practice (design and technology) Meta-art (generative systems)

Introduce yourselves

Programming languages Abstract, “human understandable” language for telling computer what to do The abstract language must be translated into the low level language understood by the machine This translation is accomplished by an interpreter or compiler We will be learning the compiled language Java

A simple Java program Human readable?!? class PrintLoop { public static void main(String[] args) { for (int i = 0; i < 10; i++) System.out.println("i = " + i); } Just prints the numbers 0 to 9 on the screen

“Human readable” is relative class PrintLoop { public static void main(String[] args) { for (int i = 0; i < 10; i++) System.out.println("i = " + i); } Java compiler translates this into…

Java VM assembly code public static void main(java.lang.String[]); 0: iconst_0 1: istore_1 2: goto 30 5: getstatic 8: new 11: dup 12: ldc 14: invokespecial #23 17: iload_1 18: invokevirtual #27 21: invokevirtual #31 24: invokevirtual #34 27: iinc 1, 1 30: iload_1 31: bipush 10 33: if_icmplt 5 36: return test.PrintLoop(); Code: 0: aload_0 1: invokespecial #43; 4: return

Object Oriented vs. Procedural Languages Procedural (e.g. C) We create some data representing an image (array of pixels to draw on the screen) We write a procedure than can be passed the image and will draw it Object Oriented (e.g. Java) We create a class that contains an image AND a routine draw it The data and the behavior (ability to draw) are in one "container"

A couple of Java’s relatives Smalltalk 80 Alan Kay and the Dynabook (PARC) C++ Managing big C programs: Bjarne Stroustrup

Smalltalk 80 Alan Kay and the Dynabook (PARC) Developed idea of a general purpose computer to be used by normal people! Highly interactive interface Included concept of windows! Smalltalk 80 – end users could create their own tools

Smalltalk 80 Includes objects Objects contain data and procedures Procedures in objects are called methods All computing is done by sending a message to an object asking it to perform one of its method Objects are defined by classes

C++ Managing big C programs: Bjarne Stroustrup Started as "C with Classes" idea borrowed from Simula 67 & Smalltalk Goals Organize programs as classes with inheritance No performance penalty compared to C Thus somewhat dangerous!!! C++ is converted into C

Java Designers started with C++ Programming embedded systems Smaller Simpler Safer Programming embedded systems Toasters, microwave ovens, TV set top boxes Reliability very important--avoid costly recalls Web programming Incorporated into web browsers at critical moment

The virtual machine Since Java was designed to run on embedded systems, it was designed around a virtual machine “Write once, run everywhere” PC Mac Cell Phone Java VM Java VM Java VM Windows OS X Phone OS x86 G3/4/5 Processor Java Machine “Java OS” Java VM

Steps for running a Java program “Source Code” HelloWorld.java Java compiler javac HelloWorld.java Generic “Byte Code” HelloWorld.class OS-specific JVM java HelloWorld Execute program OS-specific “Object Code”

Structure of Java programs Create one or more Java source files Compile each source file into a class file An application consists of these class files (not a single file like a .exe) To run the program, send one of the class files to Java This entry file must have method called main public static void main(String[ ] argv)

Sample application File: HelloWorld.java public class HelloWorld { public void greet() { System.out.println("Hello World!"); } public static void main(String argv[]) { HelloWorld hw = new HelloWorld(); hw.greet();

Java file and class names Source code files must have the ".java" extension. The file name should match the class name. The class name should start with a capital letter. This naming convention is enforced by most reasonable compilers. A file containing class HelloWorld {…} must be named HelloWorld.java Compiled bytecode has the ".class" extension

Compiling HelloWorld HelloWorld.java HelloWorld.class javac public class HelloWorld { public void greet() { System.out.println("Hello World!"); } public static void main(String argv[]){ HelloWorld hw = new HelloWorld(); hw.greet(); HelloWorld.class javac javac HelloWorld.java 0xCAFEBABE ... javac is the Java Compiler

Executing HelloWorld HelloWorld.class java HelloWorld java is the Java 0xCAFEBABE ... java HelloWorld java is the Java Virtual Machine C>java HelloWorld Hello World! C>

Object Oriented Programming OOP is all about programming using something called an object. Objects are created from classes. An object is called an instance of a class. Objects do useful stuff by calling methods on them. Let’s look at classes and objects in more detail.

Previously... public class HelloWorld { public void greet() { System.out.println("Hello World!"); } public static void main(String argv[]) { HelloWorld hw = new HelloWorld(); hw.greet();

A Class class Greeter { String greeting; A class will be used to define how objects made from this class will operate class Greeter { String greeting; public Greeter(String newGreeting) { greeting = newGreeting; } public void greet(String name) { System.out.println(greeting + ", " + name);

Field class Greeter { String greeting; A class typically will have one or more fields which are the data items which the object holds class Greeter { String greeting; public Greeter(String newGreeting) { greeting = newGreeting; } public void greet(String name) { System.out.println(greeting + ", " + name);

A Constructor class Greeter { String greeting; Classes can have Constructors which contain code only run when an object is created. Useful for initialization class Greeter { String greeting; public Greeter(String newGreeting) { greeting = newGreeting; } public void greet(String name) { System.out.println(greeting + ", " + name);

A Method class Greeter { String greeting; Once created an object can be asked to run a "method" which will do something normally involving data stored by the object (plus sometimes data passed in.) class Greeter { String greeting; public Greeter(String newGreeting) { greeting = newGreeting; } public void greet(String name) { System.out.println(greeting + ", " + name);

Another Class This class is just being used to hold a main method. Here we make two Greeter objects and use them class Driver { public static void main(String args[]) { Greeter g1 = new Greeter("Hello"); Greeter g2; g2 = new Greeter("Good morning"); g1.greet("Bob"); g2.greet("Mary"); g1.greet("Sam"); g2.greet("Joan"); } C>java Driver Hello, Bob Good morning, Mary Hello, Sam Good morning, Joan C>

OOP OOP consists of designing a bunch of classes most of which are used as templates to make objects The objects are used to hold data They are initialized with constructors and perform useful functions by being asked to run their methods