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="http://weblogs.java.net/">Weblogs, Vincent Brabant
praises Joshua Kerievski's book href="http://today.java.net/pub/wlg/1875">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 java.net starting late October.

Mason Glaves stops by with a new post titled href="http://today.java.net/pub/wlg/1855"> 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="http://today.java.net/pub/wlg/1876"> Sun Java System Application
Server Platform Edition 8 2004Q4 Beta is now available.


In
Also in Java Today
, if you always find yourself
reaching for the list based collection classes, take a look at
Jack Shirazi's href="http://www.oracle.com/technology/pub/articles/maps1.html">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="http://www.onjava.com/pub/a/onjava/2004/09/15/schema-validation.html">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
parsers.


In Projects and
Communities
, the href="http://community.java.net/javadesktop/">JavaDesktop page
links to the article href="http://www.developer.com/java/other/article.php/3403921">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="https://javatools.dev.java.net/newsletter/20040912.html">newsletter,
spotlighting new tools, tips for project owners, and news from the
community's projects. Look for it each week.


Robilad asks about href="http://forums.java.net/jive/thread.jspa?messageID=655&tstart=0#655">Releasing
the TCK in today's

Forums
."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="http://forums.java.net/jive/thread.jspa?messageID=662&tstart=0#662">
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 java.net
News Headlines
:

Registered users can submit news items for the href="http://today.java.net/today/news/">java.net 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="http://today.java.net/pub/q/news_rss?x-ver=1.0">java.net
News RSS feed.


Current and upcoming
Java Events
:

  • September 23, 2004 href="https://see.sun.com/Apps/DCS/mcp?q=ST4hlKTFvkJhYA">Chat with
    Sun's Chief Web Services Strategist
  • September 23, 2004 href="http://www.CompuwareOJX.com/">Compuware OJX
  • September 24-26, 2004 href="http://www.nofluffjuststuff.com/2004-09-detroit/">Michigan Java
    Software Symposium
  • September 29-October 1, 2004 href="http://oscom.org/events/oscom4">OSCOM

Registered users can submit event listings for the href="http://www.java.net/events">java.net Events Page using our href="http://today.java.net/cs/user/create/e"> 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
Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.