Introducing Java - Lecture Slides | CS 2220, Study notes of Software Engineering

Material Type: Notes; Class: Engineering Software; Subject: Computer Science; University: University of Virginia; Term: Fall 2006;

Typology: Study notes

Pre 2010

Uploaded on 03/09/2009

koofers-user-mg4-1
koofers-user-mg4-1 🇺🇸

5

(1)

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
cs205: engineering software
university of virginia fall 2006
Introducing
Java
David Evans
www.cs.virginia.edu/cs205
Don’t forget to email your registration survey –
if you haven’t yet, please do it today
2
cs205: engineering software
Course Announcements
Assistant Coaches:
Drew Abott and Dan Marcus
Lab hours: after class today, Sunday 7-
8:30pm
Office Hours
Posted time conflicts with cs202
New time is 10:30-noon on Thursdays
My door is almost always open – feel free
to stop by outside of office hours
3
cs205: engineering software
Why so many
programming languages?
4
cs205: engineering software
Fundamental Differences
All equivalently powerful!
Universal languages: all capable of simulating
each other
Fundamental differences
Expressiveness: how easy it is to describe a
computation
“Truthiness”: likelihood that a program means
what a programmer things it means
Safeness: impact of programmer mistakes
There is usually a conflict between
expressiveness and truthiness/safeness
5
cs205: engineering software
Pragmatic Differences
Performance of available compilers,
interpreters
Tools available
Libraries
Portability
Availability/cost of programmers
6
cs205: engineering software
What is Java?
A. Island in Indonesia known for coffee
and volcanoes
B. A Programming Language (Java)
C. A Portable Low-Level Language (JVML)
D. A Platform (JavaVM)
E. A (semi-)successful marketing strategy
JavaScript is not related to Java or Java
F. All of the above
pf3
pf4

Partial preview of the text

Download Introducing Java - Lecture Slides | CS 2220 and more Study notes Software Engineering in PDF only on Docsity!

cs205: engineering software

university of virginia fall 2006

Introducing

Java

David Evans

www.cs.virginia.edu/cs

Don’t forget to email your registration survey –

if you haven’t yet, please do it today

cs205: engineering software 2

Course Announcements

• Assistant Coaches:

Drew Abott and Dan Marcus

  • Lab hours: after class today, Sunday 7- 8:30pm

• Office Hours

  • Posted time conflicts with cs
  • New time is 10:30-noon on Thursdays
  • My door is almost always open – feel free to stop by outside of office hours

cs205: engineering software 3

Why so many

programming languages?

cs205: engineering software 4

Fundamental Differences

  • All equivalently powerful!
    • Universal languages: all capable of simulating

each other

  • Fundamental differences
    • Expressiveness: how easy it is to describe a

computation

  • “Truthiness”: likelihood that a program means

what a programmer things it means

  • Safeness: impact of programmer mistakes
  • There is usually a conflict between

expressiveness and truthiness/safeness

cs205: engineering software 5

Pragmatic Differences

  • Performance of available compilers,

interpreters

  • Tools available
  • Libraries
  • Portability
  • Availability/cost of programmers

cs205: engineering software 6

What is Java?

A. Island in Indonesia known for coffee

and volcanoes

B. A Programming Language (Java)

C. A Portable Low-Level Language (JVML)

D. A Platform (JavaVM)

E. A (semi-)successful marketing strategy

  • JavaScript is not related to Java or Java

F. All of the above

cs205: engineering software 7

Java History

  • 1991: “Stealth Project” formed at Sun
    • Computing for consumer electronics market
  • James Gosling tasked with selecting a

programming language for project

  • Started with C++, but found inadequate
    • In later classes, we’ll talk about why
  • Developed extensions and subtractions that led

to new language “Oak”

  • 1993: Web arrives
  • 1995: Sun releases HotJava browser and Java PL, Netscape incorporated into browser

cs205: engineering software 8

Buzzword Description

“A simple, object-oriented,

distributed, interpreted,

robust, secure, architecture

neutral, portable, high-

performance, multithreaded,

and dynamic language.”

Later in the course, we willdiscuss how well it satisfies [Sun95]

these “buzzwords”.

cs205: engineering software 9

Non-Buzzword Description

  • Java sacrifices expressiveness for safety and “truthiness” - A Java program is ~5x larger than the

corresponding Scheme or Python program

  • Java sacrifices performance for safety and

“truthiness”

  • A Java program is ~2x slower than the

corresponding C program (but 5x faster than the

corresponding Scheme/Python program)

Caveat: these numbers are “guesses” and gross simplifications. Real numbers depend on the program (and programmer!).

cs205: engineering software 10

Java Programming Language

  • Syntax
    • Similar to C++
    • Designed to be easy for C and C++ programmers to learn
  • Semantics (what programs mean)
    • Similar to Scheme
    • Designed to make it easier to reason

about properties of programs

cs205: engineering software 11

Programming Systems

Scheme Interpreter

Scheme Program

C++ Compiler

C++ Program

Machine

Object Files

cs205: engineering software 12

  • Portability
    • If you can implement a Java

VM on your machine, then

you can run all Java programs

  • Security
    • A VM can limit what programs

can do to the real machine

  • Simplicity
    • VM instructions can be simpler

than machine instructions

Java VM

Java Compiler

Java Program

Java Virtual Machine

.class Files

Machine

Why use a virtual machine?

.java Files

cs205: engineering software 19

Charge

  • Problem Set 1 (Due Monday)
    • Lots of new concepts, but only a few lines

of code

  • You are not expected to understand everything in the provided code (yet)
  • Take advantage of scheduled lab hours:
    • Now
    • Sunday, 7-8:30pm