Most of the articles that you'll find here are about programming with Java, simply because that's the language that I spend most of my time using. Some of the articles will be applicable to other languages, or programming in general. If an article title doesn't have a link, that means it's in-process; come back in a week or so, and it should be available.

Development Process and Other Vaguely Programming-Related Topics

Practical Git: A Workflow to Preserve Your Sanity

Last updated: 2015-04-27

Git is becoming the source control system of choice for many teams. It has some distinct advantages over centralized SCM tools such as Subversion, particularly for distributed teams and Agile processes. However, it also offers the opportunity for disaster, by giving developers the opportunity to live in their own little world, and will exacerbate any communication problems that a team already has. This article provides tips and techniques for working in a distributed, branchy world.

Git Behind the Curtain

Last updated: 2016-11-11

A blog post that looks at the Git object repository and how it changes when you commit, branch, and merge.

Setting up a Subversion Repository for a Small Team

Last updated: 2012-02-17

A blog post that I wrote about configuring a Subversion repository for access via SSH. This provides an easy and secure way to access a repository, especially for teams that do not want to manage an Apache server.

Tunneling to an HTTP Proxy

Last updated: 2012-06-27

If you're using an unsecured wireless network, as in a coffeeshop or conference hall, anyone in range can listen to your network traffic. And if you connect to a site via unsecured HTTP, they can pull your password or access tokens out of that traffic. This article describes how to set up a remote proxy and an encrypted connection to that proxy, meaning that you only have to worry about network sniffers on the Internet backbone.

Writing Log4J 2.x Plugins

Last updated: 2020-04-05

I recently implemented Log4J 2.0 support for my AWS appenders project. When I started, I was hoping to find some sort of "here's how to implement a Log4J2 appender" posting, either in the project docs or the open Internet. But either my Googling skills are getting worse, or there aren't any other independent postings on the subject. And as for the project documentation ... well, Apache projects aren't exactly known for the quality of their docs. So this is my distillation of how to write an appender, a layout, and a lookup.

Amazon Web Services

Using the Cognito Hosted UI with an Application Load Balancer

Last updated: 2020-08-18

The Application load balancer started life as a way to support micro-service back-ends from a single exposed endpoint. Since then it's added features such as support for Lambda as a back-end, fixed responses, and -- the focus of this article -- the ability to use Cognito or other identity providers to authenticate users before they even get to your application.

Building a Logging Pipeline on AWS

Last updated: 2019-09-25

Moving to the cloud makes logging more difficult: not only do you have multiple instances of the same application, but your virtual machines start up and shut down based on load, and locally-stored logs disappear when that happens. Centralized log aggregation is the answer, and this article shows an implementation based on AWS managed services.

Building a Maven repository by combining S3, Nexus, and Lambda

Last updated: 2016-10-28

A repository server, such as Sonatype Nexus, is incredibly useful if you use Maven (or any tool that uses Maven repositories, such as Gradle or Leiningen). However, you may have decided not to pursue this route due to the problem of credential management, and instead deploy directly to a bucket on Amazon S3. This article describes how to combine the two: publishing to S3, and then republishing to Nexus via an AWS Lambda process. It's also useful as a starter guide for Lambda.

User Management with Cognito IDP

Last updated: 2016-12-28

An example of using Cognito Identity Pools from a web-app written in Java. Covers sign-up, sign-in, and checking the user's authentication token.

General Java Programming

Understanding OutOfMemoryError

Last updated: 2015-04-27

OutOfMemoryError is a frustrating exception: usually it indicates a bug in your code, but sometimes it happens when your have plenty of free space in the Java heap. This article looks at the different causes of OutOfMemoryError, and what you can do about them.

Java Reference Objects

Last updated: 2015-04-27

Reference objects allow you to interact with the garbage collector, specifying levels of reachability between "in use" and "gone." This article is based on a presentation that I gave to the Philadelphia Java User's Group in December 2007, providing an overview of the Java object life-cycle and practical examples of when and why you'd use reference objects.

Byte Buffers and Non-Heap Memory

Last updated: 2017-01-22

Most Java programs spend their time working with objects on the JVM heap, using getter and setter methods to retrieve or change the data in those objects. A few programs, however, need to do something different. Perhaps they're exchanging data with a program written in C. Or they need to manage large chunks of data without the risk of garbage collection pauses. Or maybe they need efficient random access to files. For all these programs, a java.nio.ByteBuffer provides an alternative to traditional Java objects.

Writing a Java Micro-benchmark

Last updated: 2014-07-10

A micro-benchmark is designed to evaluate the performance of a short piece of code, typically in comparison to other code that provides the same functionality. While they can be valuable, they're only valid within the context of a particular execution environment. This article discusses how to compensate for the environment and interpret results.

Effective Logging

Last updated: 2015-04-27

This article covers techniques to make logging more useful as a debugging tool, and less intrusive to the logical flow of your program code.

In Defense of Parameterized Types

Last updated: 2009-01-17

Parameterized types, aka Generics, have received a lot of negative press. In this article, I gloss over their bad features, and show how they can make our programs more concise and error-free.

Enum: Not Just a Constant With a Pretty Face

Last updated: 2015-04-27

The typesafe enum pattern was made part of the Java language with the 1.5 release. This article looks at programming techniques that exploit the fact that enums are in fact Java objects, not simply named constants.

Java Serialization

Last updated: 2015-12-10

Java's built-in serialization mechanism has a bad reputation; everybody seems to have a story of serialization gone wrong. But I don't think it deserves that reputation. This article shows how, with a little care, Java serialization can be a useful tool for short-term data persistence.

JUnit and Testing

Creating Mocks and Stubs with Reflection Proxies

Last updated: 2015-04-27

Reflection proxies, introduced in JDK 1.3, allow you to write a class that implements only part of an interface. This can be very useful with unit tests, when you don't want to go to the time and trouble to implement a fully-functional collaborator, or where you need to stub out classes that aren't in a freely available mock objects package.

Refactoring Unit Tests

Last updated: 2015-04-27

Unit tests are often used to support refactoring mainline code, but tests themselves are candidates for refactoring. This article examines techniques for doing just that.

So You Think You're Covered?

Last updated: 2015-04-27

Coverage tools are great for telling you about code that you haven't tested. They're not so good at telling you what tests to write or what mainline code needs to be written. This article looks at the limitations of these tools, and how you can work around them.

JSP, J2EE, and Web Development

JSP Refactoring via Static Includes

Last updated: 2015-04-27

A large, monolithic JSP is the same as a large, monolithic method; refactoring can make both easier to manage. This article describes a technique similar to "extract method", in which portions of the JSP are extracted into statically included fragments.

Creating a Micro-View with JSP Taglibs

Last updated: 2009-03-18

The traditional MVC implementation, where the controller creates a model containing all the data for a page, breaks down with complex pages where the markup changes depending on model data. This article looks at an alternative, in which a JSP tag creates a model that applies only to its body.


Asynchronous Operations in Swing

Last updated: 2020-09-12

This article looks thread management in a Swing GUI. There's more to success than simply spinning up background threads for long-running operations: you need to get the results of these operations back to the user, control the sequencing of not-quite-independent operations, and provide feedback to the user while the operation is running.

A Controller-based Approach to Swing Applications

Last updated: 2015-04-27

Far too many Swing applications follow the anti-pattern of subclassing a JDK container class in order to add components. This article describes an alternative, in which a controller class builds the UI and manages external interaction with its components.


Practical XML: Output

Last updated: 2015-04-27

XML output is surprising tricky to get right. Between entity escape rules and incompatible encodings, it's a wonder that there's any well-formed XML in the real world. This article describes some of the pitfalls, shows how to use the APIs built into the JDK, and then presents a simpler alternative.

Practical XML: Parsing

Last updated: 2015-04-27

Describes how to use the JDK's DOM parser, including validation using both DTD and XML Schema.

Practical XML: XPath

Last updated: 2015-04-27

XPath is a way to select portions of an XML document, modeled on the paths of a filesystem, with the addition of tests on the content and attributes of each node. This article describes how to work with XPath from Java, and work around the pitfalls you'll find there.

Copyright © Keith D Gregory, all rights reserved

This site does not intentionally use tracking cookies. Any cookies have been added by my hosting provider (InMotion Hosting), and I have no ability to remove them. I do, however, have access to the site's access logs with source IP addresses.