Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 17 in printed book and digital formats -- plus a one-year subscription (beginning with 18.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 6.6


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.