1 / 16

CS451 Lecture 4: Introduction to Java

CS451 Lecture 4: Introduction to Java. Yugi Lee STB #555 (816) 235-5932 leeyu@umkc.edu www.sice.umkc.edu/~leeyu * Acknowledgement: This lecture is based on material courtesy of Monash University. Why Java? Application?. Java can support what we are interested in ...

renate
Télécharger la présentation

CS451 Lecture 4: Introduction to Java

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS451Lecture 4: Introduction to Java Yugi Lee STB #555 (816) 235-5932 leeyu@umkc.edu www.sice.umkc.edu/~leeyu *Acknowledgement: This lecture is based on material courtesy of Monash University CS451 - Lecture 4

  2. Why Java? Application? • Java can support what we are interested in ... • Systems characterized as those which are typically commercially useful; • Systems which allow interaction with the user; • Dynamical web pages which allow interaction only between user and page, but not page source. • interaction which involves the exchange of data between remote user and local data source; • Distributed Web-based applications. CS451 - Lecture 4

  3. simple object-oriented distributed interpreted robust secure architecture-neutral portable high performance multithreaded dynamic buzzword-compliant language! (The Java Language: A White Paper) Why Java? What’s Java? CS451 - Lecture 4

  4. Green Project (1990) Consumer device operating software Requirements: small size, robust, real-time performance Oak Originally used C++, then realized a new language was needed Original requirements same as for current language Java (1993) Intended market never eventuated WWW starting to takeoff Language design "based on" many current OO languages (e.g., C++, Eiffel, Smalltalk, Cedar/Mesa, Objective C) JDK 1.0 (1996), JDK 1.1, JDK1.2, JDK1.3 What’s Java? CS451 - Lecture 4

  5. The Java Virtual Machine (JVM). Code is compiled into machine independent byte code. Like some other languages it has a garbage collector Prevents pointer arithmetic Prevents operator overloading Inbuilt security Support for threads and exceptions as part of base language. Provides a large collection of classes that support and simplify many common programming activities What distinguishes Java from other OO languages? CS451 - Lecture 4

  6. Intentionally created to be syntactically similar to C/C++ Eliminates traditionally troublesome features of C/C++ Pointer arithmetic Multiple inheritence Implicit type coercions Explicit memory management Preprocessor Eliminates features of C/C++ struct typedef union enum operator overloading Features included as part of base language: Threads Exception handling Java - Simple CS451 - Lecture 4

  7. Systems are built from sets of classes Classes are instantiated at runtime to give objects Objects communicate via messages Everything* is part of a class OO concepts supported: Encapsulation Inheritance Polymorphism Dynamic Binding Logical cluster of classes == package Java - Object-Oriented CS451 - Lecture 4

  8. Network programming support built into JDK class library: TCP sockets UDP packets IP addresses URLs Security features designed into language Java's network programming facilities are one of the language's best features. Java - Distributed CS451 - Lecture 4

  9. Source code is initially compiled (javac) into architecture-neutral byte-codes Byte-codes are interpreted by the java virtual machine (java or Netscape) Seamless linking stage JIT compilers lead to a large performance increase in compilation and runtime execution Java - Interpreted CS451 - Lecture 4

  10. Strongly-typed language Compile and runtime checking No pointer arithmetic Exception handling Automatic memory management Java - Robust CS451 - Lecture 4

  11. Generally very difficult to trick Java's security mechanisms Depends very much on the program loader (e.g., Netscape) The SecurityManager class defines the protocol used by the program loader Java - Secure CS451 - Lecture 4

  12. Byte-codes are architecture neutral Performance suffers by using bytecodes Primitive type sizes are explicit - not architecture dependent Strings and characters are (16-bit) Unicode compliant GUI libraries give a native graphic library-independent mechanism for creating quality graphical interfaces Java - Architecture-neutral/Portable CS451 - Lecture 4

  13. Interpreting leads to quicker development cycle Depends what you compare it to "Slightly faster than VB" JITC help greatly in this respect Can use native code for mission-critical performance sections of code Java - High performance CS451 - Lecture 4

  14. Based on well-known 20 year old Hoare monitor synchronization Thread support built into language Thread synchronization primitives supplied Garbage collector runs permanently as a low priority background thread Java - Multithreaded CS451 - Lecture 4

  15. Class linking, layout, name resolution and object references not resolved until run-time Runtime Type Information (RTTI) available Class class for dynamic instantiation Java - Dynamic CS451 - Lecture 4

  16. 1. Performance (particularly for Swing graphics) 2. No templates/generic container classes 3. Poor debugger 4. Some poor or inconsistent design decisions (naming, IO Libraries) 5. No multiple inheritance? 6. No operator overloading? 7. Doesn't run on Windows 3.1 8. Requires JVM for each machine 9. Even though claimed as stable, new releases of JDK are issued regularly. 10. Many systems slow to support new versions of JDK The Top 10 Worst Things About Java! CS451 - Lecture 4

More Related