+ java vs. javascript jessi style. + java compiled can stand on its own written once, run anywhere...

11
+ Java vs. Javascript Jessi Style

Upload: russell-golden

Post on 25-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+

Java vs. JavascriptJessi Style

Page 2: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+Java

Compiled

Can stand on its own

Written once, run anywhere

Two-stage debugging

Java is an Object Oriented Programming (OOP) language created by James Gosling of Sun Microsystems

Page 3: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+Five Primary Goals

It should be "simple, object-oriented and familiar”

It should be "robust and secure”

It should be "architecture-neutral and portable”

It should execute with "high performance”

It should be "interpreted, threaded, and dynamic"

Page 4: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+Syntax Derived mainly from C++

Source files must be named after the public class they contain

The compiler will generate a class file for each class defined in the source file

The keyword public denotes that a method can be called from code in other classes

The keyword static indicates that the method is associated only with the class and not with any specific instance of that class.

The keyword void indicates that the main method does not return any value to the caller

class HelloWorldApp { public static void main(String[] args) {

System.out.println("Hello World!"); // Display the string. }

}

Page 5: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+Javascript

Most commonly used as part of web browsers

Also being used in server-side programming, game development and the creation of desktop and mobile applications

Supports much of the structured programming syntax from C

Functions are objects, which have properties and methods

Variables can be defined using var

JavaScript is a scripting language that was created by Netscape, originally known as LiveScript

Page 6: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+Javascript

Interpreted

Must be placed inside an HTML document

Different browsers

Runtime-only debugging

Page 7: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+Similarities

Object Oriented languages

Both can run in a browser

Both can run on a server

Both are influenced by the programming community

Both have libraries and frameworks

Page 8: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+Object Oriented Programming

Language model organized around objects rather than actions

Terminology- Class: Defines the characteristics of the Object Object: An Instance of a Class Property: An Object characteristic, such as color Method: An Object capability, such as walk Package: a namespace for organizing classes and interfaces

in a logical manner Inheritance: A Class can inherit characteristics from another

Class

Page 9: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+Libraries and Frameworks

Java

Struts

Tapestry

Maverick

Javascript

jQuery

Prototype

MooTools

Help programmers by providing access to general and purpose-specific code that can be reused over and over again for different products

Page 11: + Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming

+Questions

What is the difference between compiled and interpreted? Compiled means the code is changed into bytecode which

is not readable by humans and any Java Virtual Machine can run it. Interpreted is executed in the same syntax in which it is written

What is Object Oriented Programming? Object-oriented programming is a programming paradigm

that represents concepts as "objects" that have data fields (attributes that describe the object) and associated procedures known as methods.

How are Java and Javascript similar? Refer to slide 7