DOC PREVIEW
Columbia COMS W4115 - Espresso

This preview shows page 1-2-3-25-26-27 out of 27 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Espresso! A small cup of JavaEspresso! is:Key FeaturesSlide 4Slide 5Slide 6Slide 7Slide 8A Taste of Espresso! Hello, World!Slide 10A Taste of Espresso! Data Types and ObjectsA Taste of Espresso! Program StructureA Taste of Espresso! Type DeclarationsA Taste of Espresso! Array DeclarationsA Taste of Espresso! AssignmentsA Taste of Espresso! Sample ProgramSlide 17A Taste of Espresso! DevelopmentSlide 19A Taste of Espresso! StateSlide 21A Taste of Espresso! ScopeA Taste of Espresso! Runtime LibraryA Taste of Espresso! Runtime Library DefinitionA Taste of Espresso! TestingLessons LearnedFuture DevelopmentsEspresso!Espresso!A small cup of JavaA small cup of Java•Erin Adelman - [email protected]•Aaron Bauman - [email protected]•Philip Coakley - [email protected]•Joya Zuber - [email protected] Programming Languages and TranslatorsProfessor Stephen Edwards, December 200301/14/19 Espresso! Programming Language 2Espresso! Espresso! is:is: A simple and efficient way for programmers of all levels to create java applets.An educational language to familiarize novice programmers with java syntax.Similar to Tcl and Java in syntax and semantics01/14/19 Espresso! Programming Language 3Key FeaturesKey FeaturesSimple01/14/19 Espresso! Programming Language 4Key FeaturesKey FeaturesSimpleEducational01/14/19 Espresso! Programming Language 5Key FeaturesKey FeaturesSimpleEducationalObject-Oriented01/14/19 Espresso! Programming Language 6Key FeaturesKey FeaturesSimpleEducationalObject-OrientedPortable01/14/19 Espresso! Programming Language 7Key FeaturesKey FeaturesSimpleEducationalObject-OrientedPortableEfficient01/14/19 Espresso! Programming Language 8Key FeaturesKey FeaturesSimpleEducationalObject-OrientedPortableEfficientScalable01/14/19 Espresso! Programming Language 9A Taste of A Taste of Espresso!Espresso!Hello, World!Hello, World!card HelloWorld {print(“Hello World!”);}01/14/19 Espresso! Programming Language 10A Taste of A Taste of Espresso!Espresso!Hello, World!Hello, World!01/14/19 Espresso! Programming Language 11A Taste of A Taste of Espresso!Espresso!Data Types and ObjectsData Types and Objectsnumber–Java doublestring–Java Stringnumber array–Java double[]string array–Java String[]object arrayobject–TextBox–Button–CheckBox–List–Image–Oval–Rectangle01/14/19 Espresso! Programming Language 12A Taste of A Taste of Espresso!Espresso!Program StructureProgram Structurecard card_name {statement;statement;…statement;}01/14/19 Espresso! Programming Language 13A Taste of A Taste of Espresso!Espresso!Type DeclarationsType Declarationsnumber phil = 5;: double phil = 5; string joya = “Joya”;: String joya = “Joya”;TextBox myTextBox;: EspressoTextBoxRT myTextBox = new EspressoTextBoxRT();01/14/19 Espresso! Programming Language 14A Taste of A Taste of Espresso!Espresso!Array DeclarationsArray Declarationsnumber[3] aaron = 5.4;: double[] aaron = new double[3];for( int i=0; i<3; i++ ) aaron[i] = 5.4;01/14/19 Espresso! Programming Language 15A Taste of A Taste of Espresso!Espresso!AssignmentsAssignmentsphil = phil + 5;joya = joya + “ is cool”;aaron[2] = 5;erin[0] = “Sneak”;myButton.setWidth(phil);01/14/19 Espresso! Programming Language 16A Taste of A Taste of Espresso!Espresso!Sample ProgramSample ProgramEspresso! program (21 lines)card HelloWorld { Image baby; baby.setSource("http://www.columbia.edu/~adb54/baby.jpg"); Oval myOval; number cx = 150; number cy = 90; number cwidth = 100; number cheight = 50; myOval.setX(cx); myOval.setY(cy); myOval.setWidth(cwidth); myOval.setHeight(cheight); myOval.setColor(red); Rectangle myRectangle; myRectangle.setX(cx + 7); myRectangle.setY(cy + 30); myRectangle.setWidth(20); myRectangle.setHeight(20); print("Hello, World!", cx+10, cy+25);}Java program (106 lines)import java.awt.*;import java.awt.event.*;import java.applet.*;import java.net.*;import java.util.*;public class HelloWorld extends Applet implements Runnable{ Image img; Graphics g2 = null; Image I2; int sx; int sy;…… public synchronized void paint(Graphics g) {g = getGraphics();I2 = createImage(getWidth(), getHeight());Graphics temp = I2.getGraphics();temp.setColor(getBackground());temp.fillRect(0, 0, getWidth(), getHeight());temp.drawImage(img, 0, 0, this);temp.setColor(Color.white);… …01/14/19 Espresso! Programming Language 17A Taste of A Taste of Espresso!Espresso!Sample ProgramSample Program01/14/19 Espresso! Programming Language 18A Taste of A Taste of Espresso!Espresso!DevelopmentDevelopmentCreate and analyze sample applets with desired Espresso! functionality. Java applet control flow and event handling are confusing.How can we abstract this applet architecture from the user?A robust back end!01/14/19 Espresso! Programming Language 1901/14/19 Espresso! Programming Language 20A Taste of A Taste of Espresso!Espresso!State State The walker and Code Generation class work together to maintain 5 states:–Declaring–Initializing–Executing–Drawing–Action ListeningEach state represents a section in the generated applet file.DeclarationsInitializationsActionsDrawExecutepublic class myApplet extends applet {}01/14/19 Espresso! Programming Language 21A Taste of A Taste of Espresso!Espresso!State State card HelloWorld { Image baby; baby.setSource("http://www.columbia.edu/~adb54/baby.jpg"); Oval myOval; number cx = 150; number cy = 90; number cwidth = 100; number cheight = 50; myOval.setX(cx); myOval.setY(cy); myOval.setWidth(cwidth); myOval.setHeight(cheight); myOval.setColor(red); Rectangle myRectangle; myRectangle.setX(cx + 7); myRectangle.setY(cy + 30); myRectangle.setWidth(20); myRectangle.setHeight(20); print("Hello, World!", cx+10, cy+25);}DeclarationsInitializationsActionsDrawExecutepublic class myApplet extends applet {}01/14/19 Espresso! Programming Language 22A Taste of A Taste of Espresso!Espresso!ScopeScopeThink GloballyEspresso! has a single scopeVariables can be declared at any time in Espresso!, but will all be initialized globally in the generated Java file.01/14/19 Espresso! Programming Language 23A Taste of A Taste of Espresso!Espresso!Runtime Library Runtime Library The Runtime Library includes a suite of wrapper classes that build AWT


View Full Document

Columbia COMS W4115 - Espresso

Documents in this Course
YOLT

YOLT

13 pages

Lattakia

Lattakia

15 pages

EasyQL

EasyQL

14 pages

Photogram

Photogram

163 pages

NumLang

NumLang

6 pages

EMPATH

EMPATH

14 pages

La Mesa

La Mesa

9 pages

JTemplate

JTemplate

238 pages

MATVEC

MATVEC

4 pages

TONEDEF

TONEDEF

14 pages

SASSi

SASSi

16 pages

JTemplate

JTemplate

39 pages

BATS

BATS

10 pages

Synapse

Synapse

11 pages

c.def

c.def

116 pages

TweaXML

TweaXML

108 pages

Load more
Download Espresso
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Espresso and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Espresso 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?