DOC PREVIEW
UMD CMSC 433 - What Makes Java Different

This preview shows page 1-2-3-4-5-6-7-49-50-51-52-53-54-55-99-100-101-102-103-104-105 out of 105 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 105 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Crash course in Java, by William Pughhttp://www.cs.umd.edu/~pugh/java/crashCourse© 1998 by William Pugh, [email protected]://www.cs.umd.edu/~pugh/java/crashCourseWhat Makes Java DifferentDay 1, Session 1What makes Java Dif ferent•Java is specified2•KISS principle applied•Semantics are architecture insensitive•Safe/Secure•A modern programming language•Fewer bugs?•Libraries Galore!•Speed•The Hype1Crash course in Java, by William Pughhttp://www.cs.umd.edu/~pugh/java/crashCourse© 1998 by William Pugh, [email protected] is specified•Pascal/C/C++ isn’t•1000*1000•(-5)/10•int a[10]; for(int i=0;i<=10;i++) a[i] = 0;•delete p; q = new foo(); x = p->key; p->key = 0;•*(int *)(random()) = 03•The Java specification (is intended) to completely specify the behavior of all programs•Not just “correct” programs•Caveat - multi-threading, random numbers, ...•specified but has multiple valid implementations•All run-time errors must be caught•Can make promises about what might happenKISS principle applied•Many useful features were removed from C++•Makes language easier to learn and implement•operator overloading•user-definable coercions•templates•multiple inheritance•multiple supertypes still allowed•structs/unions•unsigned integers•stand-alone functions4•Not essential2Crash course in Java, by William Pughhttp://www.cs.umd.edu/~pugh/java/crashCourse© 1998 by William Pugh, [email protected] are architecture insensitive•Not sensitive to:•size of machine word•floating point format (must use IEEE 754)•Big-endian/little-endian5•Compiled to machine-independent byte-code•Many C/C++ programs break•when moved to machine with •different word size•different endianSafe/Secure•Can strictly limit access of a chunk of code (relies on language being specified, even for buggy programs)•Default behavior for untrusted code:•Can’t access files•Network connections are restricted6•Can verify compiled codes!•Denial of service attacks possible•and hard to prevent•Security bugs possible•Java is one of the smaller security risks on the net•Downloadable executables•Security Risks3Crash course in Java, by William Pughhttp://www.cs.umd.edu/~pugh/java/crashCourse© 1998 by William Pugh, [email protected] Risks•If you run an program in an insecure mode•It can do anything you can do•It can set up a spy to watch what you do7•This includes•Erase your hard disk•Shut down your computer•Infect you with a virus•Make your Internet connection dial long distance•Add some Quicken wire transfers•All C/C++ programs run in an insecure mode•Signed code -- A solution?Signed code -- A solution?•Provides "proof" of who wrote the code•You might trust big companies•Allow you to track down perpetrators8•Can be signed by third parties•If a web page erases your hard disk•allows you to easily determine who did it•but subtle attacks might be hard to catch•No protection against bugs•or malicious exploitation of bugs•Active-X and Java code can be signed•Privileges bestowed to signed code4Crash course in Java, by William Pughhttp://www.cs.umd.edu/~pugh/java/crashCourse© 1998 by William Pugh, [email protected] bestowed to signed code•You can set policies about which signatures give what privileges9•In Active-X, all or nothing•In Java•version 1.1 - applet sandbox or full power•version 1.2 - finer controlA modern programming language•Includes many features that PL researchers have been advocating for years (but never caught on in mass-market)•strong type system•multi-threading and synchronization•garbage collection•exceptions•class Class•class Object10•Not an embarrassment to academic CS•Adapts ideas from: C++, Smalltalk, Lisp, Modula-3, Objective-C5Crash course in Java, by William Pughhttp://www.cs.umd.edu/~pugh/java/crashCourse© 1998 by William Pugh, [email protected] bugs?•Many bugs are memory management bugs11•Pointers also cause problems•No guarantee that shipping Java programs won’t hit Exceptions/Errors•But the bugs won’t propagate farLibraries Galore!•Java has a huge collection of libraries•Utilities (collection classes, Zip files, Internationalization)•Graphics/Media (2D/3D, Sound, Video)•Graphical User Interfaces•Networking (sockets, URL’s, RMI, CORBA)•Threads•Databases•Cryptography/Security12•Increasing in each version (1.0 → 1.1 → 1.2)•No other programming environments •with libraries this complete•cross-platform•Huge improvement in programmer productivity6Crash course in Java, by William Pughhttp://www.cs.umd.edu/~pugh/java/crashCourse© 1998 by William Pugh, [email protected]•Initial JVM’s are slow, but situation has improved•JVM’s that do Just-in-time compilation•Native code compilers•need to allow for dynamically loaded code•Byte code optimizers, shrinkers and obsfucators•Sun’s Hotspot JVM•How bad is it really?How bad is it really?•Prime number sieve - primes less than 100,000•Sun Solaris JDK 1.1.6 70 seconds•Sun Solaris JDK 1.2beta3/JIT 27 seconds•Sun Solaris gcc -O4 21 seconds14 •Developers use a different coding style for Java•Lots of little methods/objects, run-time type dependent stuff•This is a good thing; better programmer productivity?•But makes it hard to generate efficient code7Crash course in Java, by William Pughhttp://www.cs.umd.edu/~pugh/java/crashCourse© 1998 by William Pugh, [email protected] Hype•Cover of Businessweek !?!?•Incredibly important to where Java is today15•good tools•wide availability of tools and support•lots of libraries•excessive hype•overhype backlash•C++ was born in the early 80’s•took a decade to mature•The downside•Hasty decisions have been cast in stone•A number of poor designs exist in the libraries•difficult to fix without breaking code•Religion, heat and flamesThis slide intentionally left blank168Crash course in Java, by William Pughhttp://www.cs.umd.edu/~pugh/java/crashCourse© 1998 by William Pugh, [email protected]://www.cs.umd.edu/~pugh/java/crashCourseBasicsDay 1, session 2Basics•Mostly C/C++ syntax: statements18•Mostly C/C++ syntax: expressions•Hello World example•Naming conventions•Values•Object operations•Special Objects•Object/memory allocation•Garbage Collection•Other notes•What is missing?9Crash course in Java, by William


View Full Document

UMD CMSC 433 - What Makes Java Different

Documents in this Course
Trace 1

Trace 1

62 pages

Reflection

Reflection

137 pages

Testing

Testing

25 pages

Paradigms

Paradigms

10 pages

Testing

Testing

17 pages

Java RMI

Java RMI

17 pages

Java RMI

Java RMI

17 pages

Java RMI

Java RMI

17 pages

Trace 1

Trace 1

46 pages

Jini

Jini

4 pages

Final

Final

15 pages

Java RMI

Java RMI

13 pages

Testing

Testing

16 pages

Load more
Download What Makes Java Different
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view What Makes Java Different and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view What Makes Java Different 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?