Tag: java

Java 9 Gets an Interactive Shell

With the release of Java 9, an interactive shell (otherwise known as a REPL – read, eval, print loop) is now available. Many languages like Python, Ruby, PHP, and MySQL have had interactive shells since their inception. Javascript got a REPL with the introduction of node (although the developer consoles in browsers have offered a

Running a Standalone HTTP Server

When developing and testing a new HTML page, it can be accessed locally by opening it as a file from a browser. But Chrome and Firefox will issue an error if the Javascript in the page tries to make an AJAX call (due to enforcement of browser sandbox security). To work around this there are

Java Immutability for Collection-Typed Properties

Immutability is an important tool for writing more reliable code. Several of the core classes in Java are immutable (String, Integer, etc). But the principle of immutability can also be applied to specific areas of application code to improve the reliability and predictability there. An immutable object can be trusted to carry unchanging data between

Counting Words in Java with a Mutable Counter

One of the hallmark features of the Java programming language is the immutability of basic “wrapper” data types like String and Integer. Immutable types are inherently concurrency safe and have other properties that can improve code quality, but sometimes immutable types can be costly because of their inherent unchangeability. Immutable types are safe for concurrent

Previewing Files in tar and zip Archives

Open source software is often distributed as archived code: compressed tar balls (.tar.gz) or as .zip files. A developer might download and install a number of these archives directly in a project they’re working on, or the archive may be installed indirectly via a software module manager like Maven. But sometimes the developer may want