proj-plbook-plChJavaLang

Difference between revision 42 and current revision

No diff available.

Table of Contents for Programming Languages: a survey

Java

Because it is so well-known, Java gets its own chapter.

Java Attributes

Java Pros

Java Cons

JVM Pros

JVM Cons

Java Best practices and style guides

Java Respected exemplar code

Java Retrospectives and whitepapers

Java Opinions

Java Opinionated comparisons

Java Popularity

Java Tours and tutorials

Java Specs

Java Implementations

Java also attempted to be a platform to run 'applets' in the web browser. It wasn't so successful. Some reasons given have been:

Variants:

Java Popular libraries outside of stdlib

frameworks:

Java Features

Links about features:

Safety

Java guarantees no segfault/null pointer error crashes. This simple idea is an innovative one, particularly in light of its high performance and usage of an intermediate bytecode representation; in fact, this safety property is present in the JVM itself, not just at the Java level; the JVM won't run bytecode that might cause a segfault.

No implicit narrowing conversions [25]. However, "It can catch people by surprise that Java's narrowing conversions may not preserve the sign. For example, the following is broken:

class TimestampedObject? implements Comparable<TimestampedObject?> { long timestamp; int compareTo(TimestampedObject? other) { return (int)(timestamp - other.timestamp); } ... }

ErrorProne? catches this: https://errorprone.info/bugpattern/BadComparable " [26]

Closures with immutable upvalues

http://lambda-the-ultimate.org/node/4735#comment-75278

Pass-by-?

Primitives are passed by value; object references are passed by value.

(it is often said that objects are 'passed by reference' in Java, but as [27] points out, that's not quite correct, as you cannot write a 'swap' function in Java)

Gotchas

Internals and implementations

Core data structures: todo

Number representations

Integers

Floating points todo

array representation

Java arrays are typically stored with a length header [29].

Java array lengths are immutable (once set; you can have a data type of an array of uncertain length)

java vectors (resizable arrays) use arrays internally to have a block of memory to grow into [30].

Java multidimensional arrays are stored as a row of pointers, where each pointer points to a columnar slice [31] [32]

Java array have a maximum size [33], typically close to Integer.MAX_VALUE, typically around 2^31.

string representation

Java strings are arrays of chars. [34]

Since Java arrays are typically stored with a length header, this means they are 'Pascal-style' strings.

Representation of structures with fields

todo

Internals and implementation links

Java tools

Implementations

Links