Category: Techniques

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

Command line uglify-js

Recently I was working on a small project where I wanted to get some jquery-like functionality in an javascript application but I wanted to keep the downloads as slim as possible. I used zepto.js for the query features: the minified copy of zepto is about 1/4 the size of recent versions of jquery 1.x. But