Black Box Parsing

Black Box Parsing
NetNewsWire doesn’t know anything about RSS or Atom. Heck, it doesn’t know XML from Shinola.

Which is an absurd claim—it wouldn’t be much of an aggregator if it were true. But—here’s the deal—to me as the developer, it is true.

I’ll explain…

But first: the below is of interest mostly to beginning programmers
and power users who are curious about how things work under the hood.
It’s a post about architecture, about time-tested and mother-approved
techniques. (Truly mother-approved. My mom is a code reuse expert.)

Inside NetNewsWire

The part you see of NetNewsWire is
an application that knows how to display data in NetNewsWire’s internal
data format. That format is a collection of custom objects that use
strings and arrays and so on.

For instance, an individual item in a feed is a data-item object,
and that object contains attributes such as title, link, description,
and so on. And a feed is a data-source object, and it has a set of
attributes—including an array of data-item objects.

These objects are the same for RSS and for Atom, even though
the feed formats are different. Even if more feed formats come to be,
I’ll keep using these same data-item and data-source objects. These
objects don’t know thing one about RSS and Atom. They’re more abstract:
they’re like the ideal of a feed and feed items. . . .  []

Leave a comment