SD Times (Java Watch) Articles.
JavaWorld Articles.
IBM Developer Works Articles.


Dr Dobb's Journal (recent)

I started writing for DDJ again in March of 2011. The old C Chest columns aren't online, unfortunately, but here are links to the recent articles:

Agile Certifications Are Actively Destructive
Endless Flexibility, The Enemy of Agile
The Anti Anti Agile Manifesto
Getting the Point of Points
There's No Room for Deadlines
Test-Driven Design
Antagonism and Agile
The Agile Holocracy
You Can't Impose An Agile Process
Scrum's Flawed Notion of Product Owner
OO as a Prerequisite to Agile
Scrum != Agile
Saying No To Properties August 21, 2012
Fixing the enum in C# July 23, 2012
Testing OO Systems, Part 2: Testing Servlet Implementations July 10, 2012
Testing OO Systems, Part 1 May 15, 2012
Type-Safe File-Based Configuration April 23, 2012
Custom Configuring Java Apps: Extending log4j March 27, 2012
Solving the Configuration Problem for Java Apps February 21, 2012
GData: Accessing Google-Application Data August 29, 2011
Implementing Secure Login, Part 2 July 26, 2011
Secure Login in AJAX Applications July 01, 2011
Getting Started With the Cloud: Logging On With Google OAuth May 23, 2011
Getting Started with Google Apps and OAuth April 19, 2011
The [Cloud] Ecosystem (March 16, 2011)

Java Watch (SD Times)

I wrote the bi-monthly JavaWatch column for SD Times from May 2004 to September 2006. We ended up deciding to kill the column primarily because there wasn't much Java to Watch any more. Not that the language had gone away, but Java had become a mature enough platform that finding something interesting to write about twice a month was difficult.

Here are all the columns:
You've Gotta Have Faith (2004-05-15)
When Hiring, Smarts Beat Skill Lists (2004-06-01)
Good Tech Support Yields Better Software (2004-06-15)
More Thoughts on Tiger (2004-07-01)
Java Still Struggles with Persistence (2004-07-15)
JavaOne, Community and Dumb Ideas (2004-08-01)
From JavaOne to JavaOne-Half (2004-08-15)
The Dark Underbelly of Community (2004-09-01)
First, or Best, to Market? (2004-09-15)
Schizophrenic Development (2004-10-15)
The Protection Racket Shakedown (2004-11-01)
Reading About Design Patterns (2004-11-15)
Do we really need the JCP? (2004-12-15)
Open-Source Context (2005-01-01)
Teach Your Programmers Well (2005-01-15)
The Prince of Purity (2005-02-01)
Tools that work Against You (2005-02-15)
Is Software Engineering and Oxymoron (2005-03-15)
Java Annotation (2005-04-01)
What's not Coming in Mustang (2005-04-15)
The Terror of Code in the Wrong hands (2005-05-01)
XML Digital Signatures in Mustang (2005-05-15)
Finding PathFinder (2005-06-01)
JavaOne and Stalinist management (2005-06-15)
A Cautionary Tale (2005-07-01)
Visual Java (2005-07-15)
The Law of Lines (2005-08-01)
Java Studio Creator (2005-08-15)
Learning UML 2 (2005-09-01)
Requirements Gathering (2005-09-15)
A UI Designer's Reading List (2005-10-01)
A Conversation with Creator's Creator (2005-10-15)
Jumping Off the Bandwagon (2005-11-01)
Coordinating the Evolution of Java (2005-11-15)
Culture Clash (2005-12-01)
JasperReports Disappoints (2005-12-15)
A Bolshevik Take on Computer Security (2006-01-01)
I Text, You Text, We All Text for iText (2006-01-15)
The Next Big Thing (2006-02-01)
Scripting and Java (2006-02-15)
AJAX is No Panacea (2006-03-01)
Two Sides to AJAX Toolkits (2006-03-15)
The End of the World as We Know It (2006-04-01)
A Culture of Fear (2006-04-15)
Stomping the Bugs (2006-05-01)
The Clearinghouse Model (2006-05-15)
A Taxonomy of Coding Errors (2006-06-01)
Rent Before You Buy Into Offshoring (2006-06-01)
A Sleepy JavaOne (2006-06-15)
The Google Web Toolkit (2006-07-01)
TestNG is A-OK (2006-07-15)
There's No Avoiding Politics (2006-08-01)
The Next Big Thing (2006-08-15)
just Say No to XML (2006-09-01)
The Finesse of FitNesse (2006-09-15)

JavaWorld

Here are links to the source code (and articles) that appears in my Java Toolbox column in JavaWorld. This is the most recent version of the code, which incorporates fixes any bugs found by myself or a reader.

— Allen        

Installation:

Code is all shipped in .jar or .zip files. If it's a .jar file, it's executable. Download it and run it with java -jar to see a demo.

All my code is in the package com.holub, so the code for the com.holub.asynch package unpacks into the directory .../src/com/holub/asynch. I strongly recommend that you keep it there. Otherwise, updates, bug fixes, and the like will be much harder to install. (Not to mention that the code won't compile without changing all the import statements.) Just put the .../src directory on your CLASSPATH and you'll be ready to go.

Recent Articles and Miscellanea

January '04: More on Getters and Setters This article shows you one way to build user interfaces without resorting to getter and setter functions. In particular, it shows you how to use the Gang-of-Four Builder design pattern to attach various sorts of user interfaces (HTML, JComponent, etc) to a "business object," without putting any getter/setter functions in that business object. The associated code is in this .zip file.
November '03: Create client-side user interfaces in HTML, Part 2 This article presents the source code described in Part I.. The code shows you how to customize a `JEditorPane` to support custom tags and also explains the Gang-of-Four Factory Method design pattern in depth.

Find a .jar file containing all the code on the software page. This jar also contains an updated version of the Date_selector (now named DateSelector) class covered a few months ago.

October '03: Create client-side user interfaces in HTML, Part I This article presents the documentation for a class that lets you use HTML to specify the layout of a client-side user interface. It's helpful in writing classes that can present both client- and server-side user interfaces without them having to know in which environment they're running. This month is primarily documentation. The code will be presented next month.
September '03: Why getter and setter methods are evil This article discusses accessor methods ("getters" and "setters"), and explains both why you shouldn't use them, and how to design your code so that they won't be necessary. Cunningham CRC cards are also discussed.

The discussion group attached to this article is an eye opener. Though the article discusses a concept that's been an integral part of OO for 25 years, many readers attacked both the article and me personally with a viciousness that's outside my previous experience. This "discussion" is a sorry commentary on both the lack of professionalism found in many members of the programming community and also the state of knowledge present in those programmers.

Before perusing this discussion, you may want to get some perspective by reading Unskilled and Unaware of It: How Difficulties in Recognizing One's Own Incompetence Lead to Inflated Self-Assessments by Justin Kruger and David Dunning (Journal of Personality and Social Psychology, 77:6 [December 1999], pp. 1121-1134).

August '03: Why extends is evil This article helps you make informed decisions about when it's appropriate to use extends, focusing on why overuse of extends can make your code unmaintainable. In particular, the article discusses the "fragile base class" problem and suggests ways to achieve the same goals that you can achieve with extends, but without the maintenance problems.
July '03 Solve the date-selection problem once and for all This article describes a date-selector widget, shown at right. The implementation uses the Gang-of-Four Decorator design pattern heavily, and is a good example of how you might use Decorator in real code. (It's also a pretty useful widget.) Get the code from the software page.
Jan. '02 When it comes to good OO design, keep it simple This article lies somewhere between an opinion piece and a product review. It briefly describes how I design an object-oriented (OO) system, discusses the tools that don't work for this purpose and why they fail, and looks at Whiteboard Photo, a program that makes whiteboard-based documentation possible.
Feb. '01 Warning! Threading in a multiprocessor world This article discuss serious counterintuitive problems that can arise when you program threads in a multiprocessor environment. In particular, it describes why the popular double-checked locking algorithm doesn't work.

Archive management


July '00: Modify Archives Part 1 This article is the first of a two-part series that vastly simplifies the modification of .zip or .jar archive files. Though Java provides a rich set of .zip APIs, they are much to low level to be useable out of the box. These articles fix the problem.

The current article presents several useful classes:

Tester Provides support for building unit tests.
D Provides an easy way to create debugging diagnostics that are removed from the production code.
FastBufferedOutputStream Provides an unsynchronized version of BufferedOutputStream that is much faster to use in situations where two threads don't simultaneously access the stream (which is to say, almost always). Also provides an efficient way to access the underlying buffer if it hasn't been flushed to the underlying stream yet.
DelayedOutputStream Provides an OutputStream that delays the creation of the underlying file until it's first accessed. Supports delayed creation of temporary files, so that you don't have to worry about creating files that aren't used.

Here's the code. October '00: Modify Archives Part 2 This article This is the second part of the archive article in which the actual archive-management classes are presented. Here's the code.

Building User Interfaces for Object-Oriented Systems

July '99: What is an object? This article is the first of a series on UI design in an OO world. It covers the basics, what exactly is an object, and what would an UI architecture for an OO system look like. I discuss model/view/controller (and it's flaws as an application-level architecture) and explain why it's not particularly object oriented. August '99: XMLOutputStream No real article this month, just a short opinion piece on the proposed XMLOutputStream September '99: Implementing the Visual-Proxy Architecture This article is the second in the "UI design in an OO world" series. It shows you how to apply the theory laid out in the first article to implement a UI that doesn't violate OO principles by using get/set methods. I implement a simple forms-based I/O system using an architecture that I call "visual proxy." Here's the code from the article. (Note that this code is a bit different than what's published in the article: I've added an argument to the User_interface's visual_proxy() method and I've also moved the Employee example into a inner Test class of the Form class. Once you compile the code, you can run the test with java com.holub.ui.Form\$Test. (Leave out the backslash if you're running under Windows). October '99: The Incredible Transmogrifying Widget This article is the third in the series. It shows you both how to make a general-purpose proxy that allows a "business" object to create a UI without having to do any UI programming, and also demonstrates how to write a proxy that adapts to its environment by changing the way that it displays itself based on the screen real estate available to itself. The code is an expanded version of the one presented in the article in that it works correctly in both an applet and an application. (The Bag proxy, when in button mode, pops up a frame containing the list. This frame is a standard JFrame for an application, but it's a JInternalFrame if you're a JApplet.) The applet-context detection is automatic. You program the widget in exactly the same way in both contexts. November '99: Menu Negotiation In OO systems, where an object presents its own user interface, it's sometimes necessary for an object to add or remove items from the menu bar. This article discusses the Menu_site interface (and implementation), which allows a visual proxy to negotiate for space on the menu bar.

Here's the code January '00: Useful Stuff This article is a catch-all that discusses various utility classes that I'll need to build next month's article (which is an RPN calculator implementation that demonstrates some of the principles that I've been discussing in previous articles). In particular, I cover:

Assert An implementation of an "assertion" that lets you implement pre- and postconditions.
Tester A class that aids in putting together automated unit tests.
Bit_bucket The Java equivalent of /dev/null, it throws away characters.
Std A "singleton" wrapper around standard input and output that makes it easy to access these two streams.
Log A convenient class for logging diagnostic messages.
Align A utility containing various methods for aligning text.
Scrollable_text_area A JTextArea that has scroll bars around it.

Here's the code March '00: User interfaces for object-oriented systems, Part 6: The RPN calculator. This article finishes up (for now) the UI series by presenting a small RPN calculator that demonstrates the OO UI-implementation principles discussed in previous articles in the series. The calculator is pretty useful in it's own right (I use it for my own desk calculator).

Here is an exectutable .jar file that contains the sources as well. [Netscape might refuse to download the jar since it's not signed. If it does so, then right click on the foregoing link and select "Save Link As."] This file contains all the sources for the program, including code presented in prior articles.

If you have a Java 2 installation, you can run the calculator with:

    java -jar rpn.jar
    
(In Windows, you can also double-click on "rpn.jar" in an explorer window.) If you're running a pre-1.2 JDK, you'll have to put the jar on your CLASSPATH. If space is a premium and you just want to use the calculator as a calculator you may want to yank the .java files out of the .jar using WinZip or some other zip utility.

Java Threading

Allen's 9-Part series on threading is now a book: Taming Java Threads, published by APress. The book largely supplants the articles listed here.

Allen also spoke on threads at the 1999 and 2000 JavaOne conference (and regularly does in-house presentations on the subject). Find a considerably expanded version of the notes for his threads talk in the Publications section. September '98: Threading Architectures This article is Part 1 of the Threads series. It discusses threading architectures on various platforms and why you, as a Java programmer, need to know about this stuff. October '98: Common multithreading Pitfalls (Deadlock, etc.) This article is Part 2 of the Threads series. It discusses pitfalls of programming threads, specifically deadlock and nested-monitor lockout.
November '98: Semaphore, Lock_manager, and Mutex This article (Part 3 of the threading series) discusses a few solutions. It presents an implementation of an exclusion semaphore and a simple lock manager that you can use to avoid a few common deadlock scenarios. Here is the code. December '98: Condition Variables and Counting Semaphores This article (Part 4 of the threading series) discusses a few more solutions. It presents an implementation of a condition variable that you can permanently set to a true or false state (unlike java's wait()/notify() mechanism, which leaves the condition permanently false. It also presents an implementation of a Dijkstra counting semaphore. Here is the code. January '98 (No article this month.) February '99: Timers This article (Part 5 of the threading series) shows you how to get operations to execute at regular, timed intervals. It talks about both the Swing Timer class and my own roll-your-own timer called Alarm. It also talks about how to do the equivalent of suspend(), resume(), and stop(), without calling these (deprecated in Java 2) methods. Here is the code. March '99: Observer and the Mysteries of the AWTEventMulticaster This article (Part 6 of the threading series) talks about the "observer" design pattern (used by AWT/Swing for it's event model, for example), focusing on the problems that arise when trying to implement observer in a multithreaded world. The source code presents a roll-your-own multicaster that you can use for safe multithreaded notifications. April '99: Reader/Writer locks, Singletons, JDK 1.1 Class-Unloading Bug This article (Part 7 of the threading series) talks about the reader/writer lock, which lets you safely access a global resource from multiple threads with simultaneous reads, but serialized writes (and simultaneous reads and writes not permitted). Also talks about the "Singleton" design pattern again, focusing on the problems that arise when trying to implement Singleton in a multithreaded world. Doug Schmidt's "double-checked locking" strategy for creating singletons is discussed. Finally, discusses a bug in the 1.1 vm, which is too aggressive about unloading classes. The source code includes the reader/writer lock, the bug fix, and a class called Std, which demonstrates the Singleton pattern by providing an easy-to-use wrapper for standard input, output, and error. May '99: Blocking Queues, Thread Pools, An OO Look at Threads This article (Part 8 of the threading series) looks at Threads from the perspective of an OO designer — in terms of synchronous and asynchronous messages rather than flow of control. It talks about two ways to implement asynchronous messages: the one-thread-per-method method and thread pools. Thread pools are demonstrated by building an efficient, general purpose, server-side socket listener. The source code includes the Blocking_queue and Thread_pool sources along with a few small examples from the article. (Note that the Blocking_queue in this zip file differs a bit from the one discussed in the article. I've added an enqueue_final_item() method that closes the queue automatically when the final item is dequeued. I needed this functionality for the June '99 column and figured I might as well give it to you now. I've also fixed a bug in the is_empty() method.) May '99: Reactors, Active Objects, and Consoles This article (The Ninth and last article of the threading series) Continues to look at Threads from the perspective of an OO designer — discussing two more architectural solutions to OO-threading problems. Reactors are single-threaded round-robin schedulers that let you have complete control of preemption. Active objects are asynchronous schedulers that cause asynchronous requests to be processed sequentially on a background (of foreground) thread. The source code includes the Synchronous_dispatcher and Active_object sources along with the Console class, that implements PrintWriter in such a way that multiple threads can safely write to the console without the lines getting tangled up.


IBM DeveloperWorks

Allen's series for IBM DeveloperWorks takes you step by step through the entire OO Design process.

The OO-Design Process

I've put the entire series into a single file for you. This file also updates the series a bit.

Here are the links to the original articles on the IBM DeveloperWorks site: Part 1, Part 2, Part 3, Part 4, Part 5, Part 6, Part 7, Part 8.

1. July '00: Getting started: How to prioritize This article is the first of a series on the OO-design process. It discusses the process in very broad terms, focusing on the development philosophy and environment of design. 2. August '00: Beginning to design software. This article continues the series, introducing the formal "problem statement." A simple first attempt at a problem statement for the Bank-of-Allen project is presented. 3. September '00: Refining the problem definition This article continues the series, refining the "problem statement" started last month. 4. December, '00: Verifying the analysis This article continues the process, discussing prototypes and mock ups, and how to use them to verify your problem statement. 5. January, '01: Use cases, an introduction This article Introduces the notion of formal use-case analysis, presenting a general form that you can use for specifying your use cases. 6. March, '01: Use-case planning This article is the first of three that develops an actual use case for the Bank of Allen project. This installment is a bit lightweight, but the next two will be more meaty. (The editors at IBM decided that short is better for some reason.) 7. April, '01: Use-cases applied, Part 1 This article is the second of three that develops an actual use case for the Bank of Allen project. This installment delves into the the meat of things, filling out the first half of the items in the template that I presented in Part 5 8. May, '01: Use-cases applied, Part 2 This article finishes up the discussion of formal use cases, filling out the last half of the items in the template that I presented in Part 5 This month's stuff is really the heart of the use case: the scenarios and workflow. You'll find examples of UML activity (workflow) diagrams here.

Misc. Articles

October '00: If I were king: A proposal for fixing the Java programming language's threading problems This article is an updated version of the last chapter of my book Taming Java Threads. It presents an extensive proposal for updating java's threading model to make it more usable for real multithreaded applications.