CS 331 - 4/23/081 A Quick and Caffeinated Overview Presented by Chris Start O bject Oriented Programming Languages:

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
Date: Subject:Distributed Data Processing Name:Maria Br ü ckner.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
Lab#1 (14/3/1431h) Introduction To java programming cs425
The Java Language. Topics of this Course  Introduction to Java  The Java Language  Object Oriented Programming in Java  Exceptions Handling  Threads.
got ? Research Project – April 1998 Hang Xia, Mark Wang, Richard S. Chang Updated: R Norman, August 1999.
IC211 Object Oriented Programming Overview of Java.
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
Introduction to Java Kiyeol Ryu Java Programming Language.
For more Lectures and Notes Visit
Introduction to Java.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Suma D Event Driven programming using java(CSE210) Overview of java Packages and interface Exception handling Multithreading Input/output.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
BA22001 Introduction to Java Instructor: Jingwu He.
CSCI 224 Introduction to Java Programming. Course Objectives  Learn the Java programming language: Syntax, Idioms Patterns, Styles  Become comfortable.
Introduction to Java Kumar Harshit. Objectives ( 목적지 ) At the end of the lesson, the student should be able to: ● Describe the features of Java technology.
Lecturer PEN PHIROM Tel : Web site: Lecturer PEN PHIROM Tel :
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
Introduction to Object Oriented Programming CMSC 331.
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
 Programming Language  Object Oriented Programming  JAVA – An Introduction  JAVA Milestones  JAVA Features.
Computer Programming 2 Why do we study Java….. Java is Simple It has none of the following: operator overloading, header files, pre- processor, pointer.
We will talking about story of JAVA language. By Kristsada Songpartom.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
Object-Oriented Programming Chapter Chapter
Java Example Presentation of a Language. Background Conception: Java began as a language for embedded processors in consumer electronics, such as VCR,
Introduction Mehdi Einali Advanced Programming in Java 1.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
CPSC Developed by a team lead by James Gosling from Sun Microsystems – 1995 WORA (write once, run anywhere) – it is cross platform – no recompiling.
1 Introduction to Java. 2 * 10% Assignments/ class participation * 10% Pop Quizzes * 05% Attendance * 25% Mid Term * 50% Final Term.
การเขียนโปรแกรมภาษา จาวา Java Programming อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 1.
Introduction to Programming 1 1 2Introduction to Java.
ISBN Chapter 12 Support for Object-Oriented Programming.
Introduction to JAVA Programming
JAVA TRAINING IN NOIDA. JAVA Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically.
Object Oriented Programming CMSC 331. Concept of Abstraction “An abstraction is a view or representation of an entity that includes only the attributes.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Object Oriented Programming in
Java™ 2 Platform Getting Started.
Before You Begin Nahla Abuel-ola /WIT.
Chapter 1 Introduction to Computers, Programs, and Java
Introduction Enosis Learning.
Chapter 1 FOUNDATIONS OF JAVA
PROGRAMMING IN JAVA. INTRODUCTION TO JAVA  Java is a general purpose computer programming language that is concurrent, class-based, object- oriented.
Introduction Enosis Learning.
Advanced Programming Fall 2017.
(Computer fundamental Lab)
Java History, Editions, Version Features
Introducing Java.
Chap 1. Getting Started Objectives
Lecture 10 Concepts of Programming Languages
M S COLLEGE ART’S, COMM., SCI. & BMS
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

CS /23/081 A Quick and Caffeinated Overview Presented by Chris Start O bject Oriented Programming Languages:

CS /23/082 Background  Who made it? : James Gosling  Working for? : Sun Microsystems since 1984  When? : in June 1991  Originally called: Oak, Green, then Java (from list of random words)  Why? (originally): needed a safe, reliable language for consumer electronics (toasters, TVs, microwave ovens) C was not object oriented, which was necessary C++ was too large/complex and unreliable  Products never marketed  In 1993 w/explosion of WWW and graphical browsers, Java was found useful for Web Applets embedded into HTML code

CS /23/083 Different Versions for Different Applications  Java 1 was a single version for everyone  Java 2 : J2EE, J2ME, J2SE, built for different types of platforms Java EE: Enterprise Edition for large “enterprise” applications Java ME: Mobile Edition was very stripped down for mobile applications Java SE: Standard Edition for most users

CS /23/084 History Timeline  JDK 1.0 (January 23, 1996)  JDK 1.1 (February 19, 1997)  inner classes added to the language (nested classes, classes completely defined within the body of another class)  JavaBeans reusable software components - manipulated visually in a builder tool group objects to be moved together  J2SE 1.2 (December 8, 1998)  Swing graphical API integrated into core classes  Sun's JVM included w/JIT compiler  J2SE 1.3 (May 8, 2000)

CS /23/085 More History…  J2SE 1.4 (February 6, 2002) first release of the Java platform developed under the Java Community Process  assert keyword  Java Web Start included (Java Web Start was first released in March, 2001 for J2SE 1.3)  J2SE 5.0 (September 30, 2004)  Java SE 6 (December 11, 2006) Updates 2 & 3 released during 2007 Updates 4 & 5 released in 2008  Dramatic performance improvements for the core platform

CS /23/086 Not Historical… Yet  Java SE 7 early planning and development stages started up in August 2006; to be tentatively released in January 2009  JVM support for dynamic languages, following the prototyping work currently done on the Multi Language Virtual Machine  new library for parallel computing on Multi- core processors

CS /23/087 Syntax:  Mostly derived from C++, but is exclusively object-oriented (unlike C++ which is structured, generic, and OOP)  Almost everything is an object and all code is inside a class Numbers, Boolean values, characters are not objects for performance reasons

CS /23/088 Java Characteristics…  Predefined container classes (ArrayList) can only contain objects  Primitive type (int) must be placed in a wrapper class Pre Java 5.0  myArray.add(new Integer(10)); Post Java 5.0  myArray.add(10); boxing (post Java5)implicitly converts primitive types to objects when put in object context

CS /23/089 Hello, World example: 1. Code is saved as HelloWorldApp.java 2. Javac compiler converts to bytecode producing HelloWorldApp.class 3. HelloWorldApp.class is launched and run Used JDK6 Update 6

CS /23/0810 Philosophy 5 Primary goals: use object-oriented programming methodology platform independence contain built-in support for computer networks designed to execute code from remote sources securely easy and safe to use

CS /23/0811 Platform Independence  able to write code, compile it once, and run on any platform/system How? Virtual Machines and the JIT compiler Java compilers convert Java Language to bytecode (simplified Virtual Machine instructions) Virtual Machine, written in native code for host hardware, interprets bytecode for execution

CS /23/0812 JIT: Just In Time Compiler Vs. Static Compilation  The Java bytecode is interpreted/converted to native machine code by the JIT compiler. Early versions of JIT ran slow compared to code natively compiled to machine code – got reputation of running slowly  Translates the Java language code directly into native machine code No bytecode stage Good performance compared to original JIT Lose portability (not cross platform anymore!) Can be useful to provide a bytecode and a faster, optimized native version

CS /23/0813 Dynamic Compilation (Sophisticated VM)  VM can optimize and recompile critical parts of the program  Can be faster than static compilation, recompiles code based on what is happening  Combination of JIT and dynamic compilation take advantage of speed without losing portability

CS /23/0814 Java’s Memory Management  All Java objects are explicit heap-dynamic Allocated with new but no deallocation  Ex.: myArray.add(new Integer(10));  No Pointers! Everything done by reference No access to hardware No access to absolute memory addresses No function pointers to call functions dynamically  Virtual functions with inheritance to get dynamic binding of member to objects

CS /23/0815 Automatic Memory Management : Garbage Collection  Users don’t have to deallocate  Java runtime responsible for deallocation from heap  Lack of references to an object allows object to be freed  Memory leaks can still happen if user keeps references to variables that they no longer need/use  Will not free resources other than heap memory Ex.: files, lock on a shared resource…  finalize method similar to C++ destructor Called when garbage collector is about to free resource

CS /23/0816 Comparing to C++ : Simplicity  Unlike C++, Java suppresses several features (such as operator overloading and multiple inheritance) for classes to simplify the language to "save the programmers from themselves" to prevent possible errors and anti- pattern design

CS /23/0817 Inheritance  Supports single inheritance  final methods cannot be overridden in descendant classes Bindings can be statically bound to methods of subclass  Abstract class: interface

CS /23/0818 Abstract class: interface  Partial support for multiple inheritance  No constructors or nonabstract methods  Only method declarations (not definitions) and named constants  Not inherited, implemented by class All methods must be implemented if defined by interface  “virtually” takes place of second parent class public interface Comparable { public int compareTo(Object b); }

CS /23/0819 Dynamic Binding  In C++ a method must be defined as virtual to allow dynamic binding  In Java, all methods are dynamic unless defined as final  Allows easier integration and logical flow in inheritance structure and deployment  Methods defined as static or private use static binding and disallow overriding

CS /23/0820 Nested Classes  Hidden from all classes in their package, except for nesting class  Nonstatic classes nested directly in another class have implicit pointer to nesting class Gives access of all nesting class’s methods to nested class  Static classes do not have pointer, cannot access members of nesting class Static nested classes are like C++’s nested classes

CS /23/0821 History tidbit: Implementations  Microsoft used to ship a version of Java Virtual Machine (MSJVM) Had proprietary components which if used would not run on Sun’s JVM Sun sued MS for breach of trademark Since October 2001, Java is not shipped w/Windows, installed separately

CS /23/0822 Conclusions :  Started as a language to program toasters (microwave ovens, TVs, etc)  Became popular because: Portable (especially across WWW) Easy to use (programmer’s like its design) Free and easy to obtain  Relatively safe to program in (less reliance on the expertise of the programmer)

CS /23/0823 Conclusions Continued…  More consistent to principles of object-oriented programming than C++  Lack of functions = does not support procedural programming  Dynamic binding is the “normal” way to bind method calls to method definitions  Uses interfaces as simple form of support for multiple inheritance

CS /23/0824 References :    Sebesta, Programming Languages. 8th Edition. 