I know Python

Aug 26, 2007 12:19

I just finished writing 210 standard lines of python in two scripts.

It took me a night to figure out how to write python, implement an encoder of compressed record chunks that has smarts for file system block boundary alignment and keeping internal fragmentation within limits, and test it. Of course, I also implemented a decoder for the same. I was, and still am, at teemus's place all this while. Two cans of Red Bull 8 hours apart helped the cause of alertness.

All this activity also refreshed some of my memories from NCST -- how I tried to implement encoding and decoding libraries for xqueeze just for "learning C++" and how I made a half attempt at writing an FSM in Python for course assignment in "Programming Paradigms" conducted by nvivek and the_little_sasi. The fact that there are FSM implementations available to study helped a bit ;-)

As for xqueeze, sometimes I almost feel like I gave up on something valuable, something that I could've taken further. These feelings don't last too long, though. For one, the purpose of that project was solely a learning experience. Thanks to it, I not only learned C++, I also learned a thing or two about designing file formats and building non-trivial parsers and encoders. The file format that I worked on last night is a joke compared to that of xqueeze. I also got to learn XML rigorously because I needed to ensure maximum compatibility with the Infoset.

The other, more important point is that I stopped believing in its objective. The debate between textual and binary serialisation formats is so beaten up that I don't even follow it any more. If you're in the business of data portability between programming environments, take a serious look at JSON. If your application runs into performance issues with JSON, rest assured you won't get too much benefit switching to binary. You'd go much farther fixing your communication protocols and making them less chatty or taking another look at your encoding/decoding software.

Anyway, it's time now to waste what remains of the weekend until the race starts. It's been a really good night after a long time. BTW, any guesses how many lines would the Java port take? I'd be surprised if it turns out to be less than 10x the line count :p

matrix, code, saturday night, kung fu, python, hacking

Previous post Next post
Up