Coming back to this episode's main topic of "News on the Web" we will develop
an applet for viewing and navigating RSS channels. Let's put our newfound knowledge
from the former article on news formats to good use and
create a useful tool for every Web site that intends to publish information in RSS.
Every now and then we will come across some best practices of software development
from WikiWeb, the site that incubated
Extreme Programming.
How do we do it?
We will start by
doing the simplest thing that could possibly work, focusing
on the RSS parser and neglecting user interface and presentation aspects at first,
as well as the "standards way of doing things."
We will then incrementally add more bells and whistles as we go.
How do we start then?
First we need to design our little program, which in this case is more like collecting
the ingredients for the RSS alphabet soup. We need -
an XML parser. Aelfred
is a good candidate for an applet, being small and fast.
an RSS parser on top of the XML parser. We will create two classes:
RSSChannel to hold all of the data from the RSS file
RSSHandler to receive the callbacks from Aelfred and feed the information into RSSChannel
We could combine both into one
in order to save a few bytes in the jar file and the Java VM, but it would be less
cleanly designed and we want to avoid
premature optimization.
an applet class RSSViewerApplet to use all of the above and create the user interface from the
data collected in RSSChannel.
Let' s look at each of them in turn, starting with the Aelfred XML parser.