java buzzwords. java! java is a language characterized by buzzwords –buzzword: a trendy word or...

22
Java Buzzwords

Upload: cory-franklin

Post on 13-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Java Buzzwords

Page 2: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Java!

Java is a language characterized by buzzwords– buzzword: A trendy word or phrase that is used more

to impress than explain

From Sun Microsystems, the developers of Java:

What do all of those terms mean?

“Java is a simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high performance, multi-threaded, and

dynamic language.”

Page 3: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

A programming language – a vocabulary and set of syntactical (grammatical)

rules for instructing a computer to perform specific tasks

– you can do most anything in any programming language

– a particular language encourages one to do things in a certain way

Question: Is this a fair characterization?

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 4: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Based on popular languages called C and C++ C: old, pretty bare bones language C++: newer, more complicated language Start from C and add some of C++’s more useful

features

“Java omits many rarely used, poorly understood, confusing features of C++ that in our experience bring more grief than benefits” (Gosling)

Question: Is Java really all that simple?

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 5: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

The object-oriented paradigm– problems and their solutions are packaged in

terms of classes– the information in a class is the data– the functionality in a class is the method– a class provides the framework for building objects

Object-oriented programming (OOP) allows pieces of programs to be used in other contexts more easily

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 6: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

A distributed system is one where multiple separate computer systems are involved

– the Internet is a very large distributed system• interconnected collection of computer networks • heterogeneous components • large number of services: WWW, file services,

audio/video channels Java was designed for the web

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 7: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Java a high-level language High-level languages must be translated to a

computer’s native tongue, machine language Interpreted high-level languages are translated to an

intermediate form and then converted to machine language and run– Java bytecodes– bytecode (class) file is executed by a Java

bytecode interpreter

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 8: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Programs will have errors, but a good program degrades reasonably

A robust program may not do exactly what it is supposed to do, but it should not bring down other unrelated programs down with it

Reliability– early (compile time) checking – dynamic (runtime) checking– eliminating situations that are error prone.

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 9: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Security– techniques that ensure that data stored on a

computer cannot be read or compromised Java is intended for use in networked/distributed

environments– a program is running on your computer … what is

to stop it from erasing all of your data, accidentally or otherwise?

Java enables the construction of virus-free, tamper-free systems– authentication based on public-key encryption

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 10: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

A language is architecture-neutral if it does not prefer a particular type of computer architectures

Example:– not too hard to construct a program that will run

faster on a Macintosh than on a PC, and vice-versa – each have their own respective strengths and

weaknesses A particular program is never entirely architecture

neutral though Question: When is being architecturally neutral a bad

thing?

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 11: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Program once, run anywhere A program is portable if it will work the same (more

or less) on many different computer systems– platform-independent

Much effort is currently spent porting non-portable code

Java has no "implementation dependent" aspects HTML is also portable or platform-independent

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 12: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Performance: speed in completing some task– performance is everything to most computer and

software manufacturers! Think about this …

– if the transportation industry kept up with the computer industry, one would be able to now buy a Rolls Royce that could drive across country in 5 minutes for $35

However … – it would crash once a week, killing everyone on

board

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 13: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

A thread is a part of the program that can operate independently of its other parts

Multi-threaded programs can do multiple things at once– example:

• download a file from the web while still looking at other web pages

Question: What is the problem with multiple agents working at the same time?– synchronization

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 14: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Dynamic: actions that take place at the moment they are needed rather than in advance– antonym: static

A dynamic program can – ask for more or less resources as it runs– use the most recent version of some code that is

available Question: Why is being dynamic a good thing?

– upgrades

“Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture-neutral, portable, high performance, multi-threaded, and dynamic

language.”

Page 15: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Decision Trees

Page 16: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Trees

Hierarchical data structure Set of elements or nodes

– one node as root– every other node has a single predecessor (parent)

and zero or more successors (children)– nodes without successors are called leaf nodes

Nodes are connected by edges The level or depth of a node is the number of edges on

the path to the root The depth of the tree is the number of edges on the

longest path from root to any leaf A complete tree has all leaves at same level, all other

nodes have the same number of children

Page 17: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Example tree structure

leaf leaf leaf leaf leaf

root

leaf

depth of tree = 3

edge

Page 18: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Decision trees

A decision tree begins with a decision you need to make– start with an initial decision node– ask a question

Structure for investigating options and the possible outcomes of choosing those options– result of a decision can be another decision– outcome is a terminal node

Tree should have unique paths from the decision node to each of the terminal nodes. – help you to choose between several courses of

action

Page 19: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Examples

Real life decision trees

– which route to take to class?– which {cell phone, computer, camera} is

best for me?– what to wear?– where to go on vacation?

Page 20: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

He received thePhysics Prize in 1921.

Try the MedicinePrize in 1962.

Would you prefer a humanitarian?

Would you like toread about a scientist?

Would you like toread about Einstein?

Try A. Solzhenitsyn,Literature 1970.

Look up the Peace Prize in 1991.

A Decision Tree

yes

yes

yes

no

no

no

Page 21: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

A decision tree for sorting

yesa b?

b c? a c?

no

yes no

a b ca c?

a c b c a b

yes no

yes no

b a cb c?

b c a c b a

yes no

Page 22: Java Buzzwords. Java!  Java is a language characterized by buzzwords –buzzword: A trendy word or phrase that is used more to impress than explain  From

Binary trees

Nodes have at most two children In a complete binary tree of depth 3,

– how many nodes are in the tree?– how many leaves are in the tree?

In a complete binary tree of depth 4,– how many nodes are in the tree?– how many leaves are in the tree?

How many nodes in a depth d tree? How many leaves in a depth d tree?