Skip to main content

You don't have to start with patterns

Posted by daniel on September 22, 2004 at 8:06 AM PDT

Refactoring can take you where you need to go.

You are coding along and notice that you have a fairly lengthy
case statement that you have used more than once. It
occurs to you that the State pattern might be a better approach and
so you start to refactor your code. In today's href="">Weblogs, Vincent Brabant
praises Joshua Kerievski's book href="">Refactoring to Patterns
as "The best book I readed concerning Patterns."

You don't start coding and decide what pattern to use. You notice,
in the process of adding functionality to a program that you have a
situation in which applying a pattern can simplify the code or better
express what is being done.

Joshua posted versions of the book as it grew over time and many
people contributed comments on his refactorings. We're pleased to
announce that he will be leading a discussion of his book as our
bookclub selection here on starting late October.

Mason Glaves stops by with a new post titled href=""> Two bugs in two years, new
features every week, deadlines met each and every time… and
what’s with these ruby slippers? He noticed he wasn't in
Kansas anymore at his interview. "Instead of long aimless talks about
where I plan to be in 10 years, what I think my faults are, and the
usual subtle duck-and-weave fare that comes with two entities feeling
each other out, I sat down with the chief architect in front of his 21
inch LCD and over the next hour we added a new feature to their radius
server. It was my first baby steps into the world of XP."

Lance Anderson announces href=""> Sun Java System Application
Server Platform Edition 8 2004Q4 Beta is now available.

Also in Java Today
, if you always find yourself
reaching for the list based collection classes, take a look at
Jack Shirazi's href="">Introduction
to Java Map Collection Classes. His intro details the APIs and
explains that rather than being keyed on numbers, "Maps provide a
more general way of storing elements. The Map collection type
allows you to store pairs of elements, termed "keys" and "values",
where each key maps to one value. Conceptually, you could consider
Lists as Maps which have numeric keys. However in practice there
no direct connection between Lists and Maps except that they are
both defined in java.util. In this article, we will focus on the
Maps that are available with the core Java distribution, and also
consider how to adapt or implement specialized Maps that are more
optimal for your application specific data."

You can straightening out your XML by validating it against a
schema. In href="">XML
Document Validation with an XML Schema, Deepak Vohra explains, "an
XML schema defines the structure of the elements and attributes in an
XML document. For an XML document to be valid based on an XML schema,
the XML document has to be validated against the XML schema." The
article then shows how to configure and use JAXP and Xerces2-j

In Projects and
, the href="">JavaDesktop page
links to the article href="">Processing
Image Pixels using Java, for directly manipulating image
pixels, but with the caveats that its PixelGrabber
approach is no longer preferred, and that getting a pixel array
can impair 2D acceleration.

The Java Tools
community has released the latest edition of its href="">newsletter,
spotlighting new tools, tips for project owners, and news from the
community's projects. Look for it each week.

Robilad asks about href="">Releasing
the TCK in today's

."You can't put a 'must not distribute unless
passes a TCK' restriction in a free software license, so that
would not really be free. There is of course a very simple
solution: release the TCK under a free license, so that
everyone can check how compatible different Java
implementations are on their platform."

Murphee thinks that many of the arguments of why we need to fork to
add features to Java may be overstated. "You href="">
don't need to fork anything for this; just look at AspectJ, which
is also a extension of the Java language which features Aspect
Oriented programming constructs."

In today's
News Headlines

Registered users can submit news items for the href=""> News Page
using our news
submission form
. All submissions go through an editorial
review before being posted to the site. You can also subscribe to
the href="">
News RSS feed.

Current and upcoming
Java Events

  • September 23, 2004 href="">Chat with
    Sun's Chief Web Services Strategist
  • September 23, 2004 href="">Compuware OJX
  • September 24-26, 2004 href="">Michigan Java
    Software Symposium
  • September 29-October 1, 2004 href="">OSCOM

Registered users can submit event listings for the href=""> Events Page using our href=""> events submission
form. All submissions go through an editorial review before being
posted to the site.

Archives and Subscriptions: This blog is delivered
weekdays as the
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.