JSON feed

Summary

I’m evaluating the JSON Feed-format for my version-update system. As stated on the webpage announcing JSON Feed JSON is simpler to read and write, … I tested it for my needs. First thing is to read. Works!

Ich will mein Versions-Update System erweitern. Da kommt mir die Ankündigung des JSON Feed-format gerade recht. RSS ist nett aber artet in Arbeit aus.


In den letzen Wochen ging ich mit der Idee schwanger, mein Versions-Update System auszubauen. Ich dachte mich an RSS anzulehnen und schob den Aufwand vor mir her. Da kam mir die Ankündigung des JSON Feed-Formats durch Brent Simmons und Manton Reece gerade recht. Ausprobiert und klappt.

My experimental JSON Feed Reader

Der JSON Feed von Brent Simmons wiegt ca. 60 kB, der von Daring Fireball ca. 100 kB. Holen mit HTTP Get dauert und auseinandernehmen des JSON-Feeds und auspacken in eine Listbox dauert ebenfalls. Die Oberfläche ist für ein paar Sekunden blockiert. Das ist nicht schön. Ich habe das umgebaut auf CALL WORKER und schicke das Ergebnis zurück per CALL FORM. Jetzt bleibt die Oberfläche lebendig.

Ohne CALL WORKER/CALL FORM hätte ich das Auspacken der JSON Feeds per On Timer nach der Ladephase des Formulars ausgeführt, um den Eindruck das Formular hängt zu vermeiden. Die paar Sekunden Blockade der Oberfläche hätten den Aufwand eines zweiten Prozesses und der Rückmeldung in die Oberfläche nicht gerechtfertigt. Jetzt ist das einfacher.

Ich verlasse die Methode DBZ_JSONFeedReader nicht. Die Items des Feed übergebe ich an „Worker_ReadItems“ und schicke die aktuelle Fensternummer mit. Dort wird CALL WORKER ausgeführt, mit dem Namen der Methode und führt die Methode aus in „lbFeedItems_ReadItems“, also im Context des Worker. Dort wird jedes Feed-Item ausgelöst und per CALL FORM und der Aufgabe „lbFeedItems_Insert“ in den Context des UI zurückgeliefert. Nach Abarbeitung aller Feed-Items wird im Context des UI über „lbFeedItems_Sort“ die Listbox sortiert.

Workflow Konzept

Es ist nicht machbar, Pointer auf eine lokale Variable an eine Methode wie DBZ_JSONFeedReader die in CALL WORKER/CALL FORM ausgeführt wird zu übergeben. Das ist ein Context-Wechsel. Deshalb habe ich zusätzlich Parameter $5 eingeführt, der ein Object erhält und Objekte überleben den Context-Wechsel. $2 und $4 werden als Nil-Pointer übergeben, die brauche ich hier nicht und stören nicht.

Natürlich hat diese Seite auch einen JSON-Feed.

DDDD JSON-Feed


Lately I was thinking about enhancing my version-update system. Not to invent the wheel again, I thought about RSS and procrastinated because of RSS. When reading the announcement of the JSON Feed-format by Brent Simmons and Manton Reece I was convinced: this is what I was looking for. Tested and works.

JSON Feed Daring Fireball

The JSON Feed of Brent Simmons is about 60 kB heavy, that of Daring Fireball about 100 kB. Fetching the feed with HTTP Get takes time. Parsing the JSON-Feed and filling in into listbox-rows takes time too. The UI seems blocked for a couple of seconds. Not nice at all. I splitted the work up with CALL WORKER. After splitting up, the result is send back by CALL FORM. Now the UI keeps vital.

Before CALL WORKER/CALL FORM I’d delegated the work of parsing the JSON Feeds into an On Timer-process. This runs after the form is loaded and helps keeping the UI active. The couple of seconds spared didn’t seem to justify the hassles of a second process and getting the result back into the UI. Now it’s simpler.

I don’t leave the method DBZ_JSONFeedReader. The items of the feed are send to „Worker_ReadItems“ including the current form window longint. CALL WORKER executes, using the name of the method and executing the methode with action „lbFeedItems_ReadItems“, which lives in the context of the worker. Every single feed-item is send back to the UI by CALL FORM which executes „lbFeedItems_Insert“ into the context of the UI. When done with the feed-items sorting the listbox is send via „lbFeedItems_Sort“ as a job to the UI.

Workflow Konzept

We can’t use a pointer to a local variable to a method like DBZ_JSONFeedReader when using CALL WORKER/CALL FORM which means switching context. Therefor I added parameter $5, which contains an object, which survives context-switching. $2 and $4 are nil-pointers, I don’t need them and they do no harm.

Of course, this site does have a JSON-feed.

DDDD JSON-Feed