A question on MVC-like architecture for EmeraldView, the Greenstone PHP
frontend I'm working on. First, a crash-course in the Greenstone data
The biggest unit of content in Greenstone is the "collection." Within
each collection, G references content in "documents" which are broken
into "sections." Each document and section (I've taken to calling them
nodes) is represented in a datastore by a record with metadata. So for
example, represented in YAML:
Title: "Pigs in space"
Subject: "pigs, space"
Title: "The mission begins"
Title: "More of the mission beginning"
Title: "The mission continues"
Browse trees can be created on arbitrary metadata fields, and are called
"classifiers." They also consist of a root "node" and subnodes; for
Title: "Aardvark, Larry"
Title: "Milton, John"
Okay, now for the question. I have written a Node class to represent
this most basic level of organization, with subclasses Node_Document
(representing a document or section thereof) and Node_Classifier (for a
classifier or subnode thereof). This makes sense to me for representing
the metadata, as described above.
What happens when I need to deal with the *web page* representing the
content of a node? In Greenstone (and thus in EmeraldView), each
classifier, document, and section has a page view associated with it.
There are certain behaviors that apply to a web page and not a
"Model"-level node, such as getUrl(), getSourceDocumentUrl(), getHTML()...
I have been using wrapper classes for the Nodes (Classifier and
DocumentSection), and, realizing that there is much duplicate
functionality between the two, thought to make them inherit from a
[there are a couple of obsolete duplicate methods in here that I haven't
cleaned out yet]
When I came to the question of what to call this parent class, I took a
step back, wondering, what sort of class is this, exactly? Does it
merit a distinct class apart from Node? I looked through Gang of Four,
but couldn't find anything that really reflected what I'm trying to do -
this seems simpler than most of their patterns. Intuitively it feels to
me like this should indeed be a separate class from Node, as Node is for
metadata, and this class is to be for web page behavior. Perhaps:
Thanks so much!
Touro College Libraries
33 West 23rd Street
New York, NY 10010
Tel (212) 463-0400 x5230
Fax (212) 627-3197
Email [log in to unmask]