Reading Week - No Class

Reading Week - No Class

Lecture 14

Topic 10: Basic of Collections
slated for Lectures 13, 14

Lecture 14

Lecture 13

Topic 10: Basic of Collections
slated for Lectures 13, 14

Lecture 13

Lecture 12

Topic 9: Event Driven Programming (Java vs Javascript vs MaxMSP)
slated for Lectures 9, 10, 11, 12

Lecture 12

Lecture 11

Topic 9: Event Driven Programming (Java vs Javascript vs MaxMSP)
slated for Lectures 9, 10, 11, 12

Lecture 11

I. Recap of the roles (M, V, C)

II. What does it look like for an app to modify itself?
Examine and run App.java (http://www.cse.yorku.ca/course_archive/2010-11/W/1720/LectureEgs/) to see what this might look like
But be careful in your thinking - this app only overwrites the text, which still needs to be compiled into bytecode. The app is not really changing itself during run-time.

III. Establishing the Parallels
- what the java compiler does cf. what a (compliant) browser does
javac
- compiles "text" into bytecode (provided the text adheres to the java programming standard)
browser (any compliant browser)
- inteprets "text" and renders it (provided the text adheres to the html standard)
- what does "render" mean? it means provide a visual/graphical manifestation of the encoded information.

About html (see http://www.w3schools.com/html/default.asp for a basic html tutorial)
- for any text file that adheres to the html standard, the following is true:
- the file consists of a set of one or more elements
- each element has a start tag and an end tag. In between is the element's content. (In the element examples below, the formatting is a bit wonky since it is tricky to represent raw html in html, which is the format of this document)

< p > Here is some content that is tagged as a paragraph element < /p >


- An exception to this - empty elements, which are closed in the start tag (e.g., < br / > )
- the rendering process requires that the file be "parseable" into elements, but sometimes there is leniency if an end tag is missing, the browser will still render the page for you)
- html elements can have attributes, attributes are always specified in the start tag
- each element has its set of specific attributes, but the id attribute is standard for most elements. The id attribute serves to identify an element, so that it can be referred to by some other element.

Example of an element and its attributes:
This is an element that is an anchor for a hypertext link:
< a > Here is an anchor < /a >

It doesn't do anything, since it is missing the attribute the specifies the hypertext reference (specifies the destination)

here the href and id attributes have been added

< a href="http://www.w3schools.com/tags/tag_a.asp" id="anchor1" > Here is an anchor < /a >


how does a browser afford interactivity?
-through the use of the anchor element (the basic mechanism of hypertext interactivity)
-through the use of the script element
-the contents of a script element are understood by the browser to be statements in the programming language called ECMAScript (more specifically, one of its dialects, such as JavaScript or ActionScript)

JavaScript and Java are not the same - it just happens that one is the prefix of the other. This naming is unfortunate, since it causes quite some confusion.

JavaScript
- lightweight (small memory footprint, minimalist syntax and formatting) -
- interpreted, not compiled

Java
- not lightweight
- compiled, not interpreted





Lecture 10

Topic 9: Event Driven Programming (Java vs Javascript vs MaxMSP)
slated for Lectures 9, 10, 11, 12

Lecture 10

(continuation from L9)

I. Model-View separation - key points
a. observer/observee roles
b. events can be identified (in the sense of "happenings"), but they are not explicitly represented as objects

II. Events - explicitly represented
The example application EventGeneratorExample_F demonstrates that all sorts of events are being continuously dispatched by the root widget of the GUI. It is a separate matter as to whether any entity is actually listening to the events. This code example sets up a controller (EventTracker_F) which installs itself on the view and relays information about the occurrence of various events: window events (such as activated, deactivated, opened, closing, closed, iconified, deiconified) mouse moved events, mouse events (press, release, click)

III Observer/Observee roles for the view/model (respectively). The Model is the observee, the view is the observer (of the model)

IV. The Controller in Model-View-Controller
- who might observe the view? the controller observes the view in the sense that it's role is to accept input from the user and figure out what this means to the model

-an extensive explanation on the black board tracing the steps involved in DrawVersion7.java

Lecture 9

Topic 9: Event Driven Programming (Java vs Javascript vs MaxMSP)
slated for Lectures 9, 10, 11, 12

Lecture 9

it is assumed that students have downloaded, run, and examined the code examples in the package "packageForL9L10"