Espresso a small cup of java
Download
1 / 27

Espresso! A small cup of Java - PowerPoint PPT Presentation


  • 100 Views
  • Uploaded on

Espresso! A small cup of Java. Erin Adelman - eca41@columbia.edu Aaron Bauman - abd54@columbia.edu Philip Coakley - pwc35@columbia.edu Joya Zuber - jaz49@columbia.edu CS4115 Programming Languages and Translators Professor Stephen Edwards, December 2003. Espresso! is:.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Espresso! A small cup of Java' - lewis-olsen


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Espresso a small cup of java

Espresso!A small cup of Java

Erin Adelman - eca41@columbia.edu

Aaron Bauman - abd54@columbia.edu

Philip Coakley - pwc35@columbia.edu

Joya Zuber - jaz49@columbia.edu

CS4115 Programming Languages and Translators

Professor Stephen Edwards, December 2003


Espresso is
Espresso! 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 semantics

Espresso! Programming Language


Key features
Key Features

  • Simple

Espresso! Programming Language


Key features1
Key Features

  • Simple

  • Educational

Espresso! Programming Language


Key features2
Key Features

  • Simple

  • Educational

  • Object-Oriented

Espresso! Programming Language


Key features3
Key Features

  • Simple

  • Educational

  • Object-Oriented

  • Portable

Espresso! Programming Language


Key features4
Key Features

  • Simple

  • Educational

  • Object-Oriented

  • Portable

  • Efficient

Espresso! Programming Language


Key features5
Key Features

  • Simple

  • Educational

  • Object-Oriented

  • Portable

  • Efficient

  • Scalable

Espresso! Programming Language


A taste of espresso hello world

card HelloWorld {

print(“Hello World!”);

}

A Taste of Espresso!Hello, World!

Espresso! Programming Language


A taste of espresso hello world1
A Taste of Espresso!Hello, World!

Espresso! Programming Language


A taste of espresso data types and objects

number

Java double

string

Java String

number array

Javadouble[]

string array

Java String[]

object array

object

TextBox

Button

CheckBox

List

Image

Oval

Rectangle

A Taste of Espresso!Data Types and Objects

Espresso! Programming Language


A taste of espresso program structure
A Taste of Espresso!Program Structure

card card_name {

statement;

statement;

statement;

}

Espresso! Programming Language


A taste of espresso type declarations
A Taste of Espresso!Type Declarations

number phil = 5;

: double phil = 5;

string joya = “Joya”;

: String joya = “Joya”;

TextBox myTextBox;

: EspressoTextBoxRT myTextBox = new EspressoTextBoxRT();

Espresso! Programming Language


A taste of espresso array declarations
A Taste of Espresso!Array Declarations

number[3] aaron = 5.4;

: double[] aaron = new double[3];

for( int i=0; i<3; i++ )

aaron[i] = 5.4;

Espresso! Programming Language


A taste of espresso assignments
A Taste of Espresso!Assignments

phil = phil + 5;

joya = joya + “ is cool”;

aaron[2] = 5;

erin[0] = “Sneak”;

myButton.setWidth(phil);

Espresso! Programming Language


A taste of espresso sample program

Espresso! 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);

A Taste of Espresso!Sample Program

Espresso! Programming Language


A taste of espresso sample program1
A Taste of Espresso!Sample Program

Espresso! Programming Language


A taste of espresso development
A Taste of Espresso!Development

  • 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!

Espresso! Programming Language



A taste of espresso 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.

A Taste of Espresso!State

public class myApplet extends applet {

Declarations

Initializations

Execute

Draw

Actions

}

Espresso! Programming Language


A taste of espresso state1

card HelloWorld { maintain 5 states:

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);

}

A Taste of Espresso!State

public class myApplet extends applet {

Declarations

Initializations

Execute

Draw

Actions

}

Espresso! Programming Language


A taste of espresso scope
A Taste of maintain 5 states:Espresso!Scope

  • 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.

Espresso! Programming Language


A taste of espresso runtime library
A Taste of maintain 5 states:Espresso!Runtime Library

  • The Runtime Library includes a suite of wrapper classes that build AWT constructs.

  • RTL definitions are loaded into a type table that is used to verify library semantics

  • The library is fully expandable to support new user defined objects and functions.

Espresso! Programming Language


A taste of espresso runtime library definition
A Taste of maintain 5 states:Espresso!Runtime Library Definition

Button::EspressoButtonRT(this){

void setText( String )

String getText( void )

void action ( void )

}

Espresso! Programming Language


A taste of espresso testing
A Taste of maintain 5 states:Espresso!Testing

  • Build language elements one by one, testing as we go.

  • Have others outside the team write Espresso programs.

    • Espresso! is so simple even UBW majors and monkeys can use it!

Espresso! Programming Language


Lessons learned
Lessons Learned maintain 5 states:

  • Start early!

  • Modularity is important for simplicity and effective testing.

  • It is difficult to accommodate four busy schedules.

  • Espresso! requires a lot of caffeine.

Espresso! Programming Language


Future developments
Future Developments maintain 5 states:

  • Expand the Runtime Library to include more object types and methods.

  • Allow the Espresso! programmer some control over the Applet Layout Manager

  • Add keywords to dictate the design of the generated parent website

Espresso! Programming Language