Archive for the ‘Java’ Category

Multiple Dispatch and the Visitor Pattern

Saturday, June 14th, 2008 Posted in Code Design, Design Patterns, Java, Lisp | No Comments »

Following from my yakking about the state machine pattern, I've run into situations since where I've had a class which must react differently to different inputs, and thought how, rather than write a huge switch statement, or huge else-if with ...

UTF-7 with JavaMail

Saturday, June 14th, 2008 Posted in Java, Protocols | No Comments »

Java has a pretty cool api for handling email called JavaMail. There are classes for constructing and sending multipart email as well as classes for connecting to mailboxes and processing the messages therein. I hit a bit of a problem, however, ...

Doctype Declaration with XMLC

Sunday, March 23rd, 2008 Posted in JSP, Java, XMLC | No Comments »

Enhydra XMLC is a neat alternative to Java Server Pages (JSP). XMLC takes a page of plain old HTML and generates a java class capable of producing the same HTML. By marking important elements in the HTML with id and ...

LazyList not lazy enough

Tuesday, October 16th, 2007 Posted in JSP, Java, Struts | No Comments »

Today I was writing a jsp for Struts in which I needed to define a text field for an indexed property of the form bean. The property was a string list which could be any length, depending on what was ...

State Machine Inputs

Friday, October 12th, 2007 Posted in Code Design, Java | 1 Comment »

The other day I was thinking about state machines. More specifically, the best way to write a class such that when some "input" method of the object is called, the object acts differently depending on which state it is in. The ...