Unrealistic Expectations
Feb. 6th, 2011 10:07 pmI don't know why I do this to myself.
I had a brainstorm yesterday morning, and set aside about four hours to figuring it out. The idea was simple: I wanted an RSS reader like Liferea, which is my reader of choice, but which had not just the generic GTK-based front end, but a standard REST-based front-end. I also wanted better performance; Liferea is nicely written and multi-threaded, but I thought that if I separated the front-end from the back-end, and changed the back-end to an event-driven model, then I could make both work independently.
And then I thought, if I did that, then I could write a pubsub handler whereby front-ends could receive messages, and multiple front-ends would receive all feed and subscription updates as they happened.
After four hours of straight programming, I had a working script for loading the feedlist in OPML-XML format. I grumped. That was it? After four hours, all I had was a single intake handler? Where was the event loop, and the feed handler?
And then I realized: I'm working with a technology I haven't seen in 12 years (SAX) and a low level I don't usually indulge in, and because it's all the rage in event-driven programming, I was writing the OPML wrapper in language I've never actually written in before, Node. SAX has matured a lot, and when used with the enclosured callbacks of Node makes for a very viable technology. It took me a while to figure out how to express the DTD in SAX, and then how to write the closure properly so that I could get the data back out. By the end of the session I was deriving and successfully walking a JSON tree of objects, looking at each object's respective title and so forth.
There was a lot left to do: error handling for corrupt OPML for one. Distinguishing between standard OPML, Livejournal and AmphetaDesk's broken but survivable OPML (yo, LJ, AD: XML is cAsE sEnSiTiVe), that kind of thing. Exporting the document. Eventually, transferring the document to an internal feed/subscription and running that damned feed.
And that's just the OPML handler. Eventually, I have to write RSS, Atom, CDF, and PIE parsers, but I have the DTDs for those already. Once I write one, it's a template for the rest. Once I have all of them, a couple of output handlers for JSON and a generic RSS format should be trivial.
But mastering even that much is pretty damned impressive. Why do I have such unrealistic expectations of my output?
I had a brainstorm yesterday morning, and set aside about four hours to figuring it out. The idea was simple: I wanted an RSS reader like Liferea, which is my reader of choice, but which had not just the generic GTK-based front end, but a standard REST-based front-end. I also wanted better performance; Liferea is nicely written and multi-threaded, but I thought that if I separated the front-end from the back-end, and changed the back-end to an event-driven model, then I could make both work independently.
And then I thought, if I did that, then I could write a pubsub handler whereby front-ends could receive messages, and multiple front-ends would receive all feed and subscription updates as they happened.
After four hours of straight programming, I had a working script for loading the feedlist in OPML-XML format. I grumped. That was it? After four hours, all I had was a single intake handler? Where was the event loop, and the feed handler?
And then I realized: I'm working with a technology I haven't seen in 12 years (SAX) and a low level I don't usually indulge in, and because it's all the rage in event-driven programming, I was writing the OPML wrapper in language I've never actually written in before, Node. SAX has matured a lot, and when used with the enclosured callbacks of Node makes for a very viable technology. It took me a while to figure out how to express the DTD in SAX, and then how to write the closure properly so that I could get the data back out. By the end of the session I was deriving and successfully walking a JSON tree of objects, looking at each object's respective title and so forth.
There was a lot left to do: error handling for corrupt OPML for one. Distinguishing between standard OPML, Livejournal and AmphetaDesk's broken but survivable OPML (yo, LJ, AD: XML is cAsE sEnSiTiVe), that kind of thing. Exporting the document. Eventually, transferring the document to an internal feed/subscription and running that damned feed.
And that's just the OPML handler. Eventually, I have to write RSS, Atom, CDF, and PIE parsers, but I have the DTDs for those already. Once I write one, it's a template for the rest. Once I have all of them, a couple of output handlers for JSON and a generic RSS format should be trivial.
But mastering even that much is pretty damned impressive. Why do I have such unrealistic expectations of my output?