Article Preview
Buy Now
COLUMN
Designing an HTTPResource Class
Procrastination-Driven Design
Issue: 6.6 (September/October 2008)
Author: Charles Yeomans
Author Bio: Charles is a senior software engineer at Dakim, Inc.
Article Description: No description available.
Article Length (in bytes): 6,407
Starting Page Number: 50
Article Number: 6618
Related Link(s): None
Excerpt of article text...
In the course of my work, I wrote a web server. In this month's column, I talk about one piece of it, the representation of HTTP resources.
To summarize the hypertext transfer protocol in a sentence, a web client sends a request to a server for a resource, and receives a response in return. In my server, I have corresponding classes HTTPRequest, HTTPResponse, and HTTPResource. The design and implementation of HTTPRequest and HTTPResponse are straightforward; one reads the HTTP specification and expresses it in REALbasic code. Implementing HTTPResource is another matter; after all, a resource can be just about anything.
I knew what I didn't want to do -- an abstract superclass or class interface implemented in an ever-increasing pile of subclasses. Since I didn't quite know what I wanted to do, I used what we'll call procrastination-driven design. That is to say, I implemented the bare minimum needed to represent a resource, and put off the rest until later. Here is the result.
...End of Excerpt. Please purchase the magazine to read the full article.