Brad Fitzpatrick (bradfitz) wrote in lj_dev,
Brad Fitzpatrick
lj_dev rewrite

Ever look at No? Good. Yes? I'm sorry. Yeah, files with one function that is a few thousand lines suck.

Anyway, it's being rewritten. The first patch is now in CVS.

Not only does it now have hundreds of little functions instead of one big one, but now the protocol internally returns rich data structures, which other protocol handlers can then manipulate easier.

So basically we have an meta protocol handler internally now (LJ::Protocol::do_request) and different front-ends that wrap & manipulate it, like the old flat key/value interface (LJ::do_request). The XML-RPC interface is just a package now (LJ::XMLRPC) that has very thin wrappers (one line) for every internal method.

The rewrite's only half done, but it's downhill from here. I don't normally check works in progress into CVS, but I wrote a little regression tester to compare the results of the old log.cgi to the new one for every protocol mode and permutation of options.... all checks out.

Next step, if anybody's up for it, is to start changing our code in BML pages to use the meta protocol instead of using the uglier key/value protocol.

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment