Client vs. server: who does what in an online spreadsheet?

| | Comments (0) | TrackBacks (0)
"Data elements" are the focus of Section 5.2.1 of Dr. Fielding's dissertation. I think the focus is who does how much work to render the data. He lists three options: mostly server, mixed client & server, and mostly client:  Server                                                          Client |----------------------------------------------------------------------|       |                    |                                 |  1. Fixed format       2. encapsulated data & code    3. raw data & metadata     (jpeg)                 (json, javascript)             (html <img> tag?)

This is an important decision for an online spreadsheet. Should the server send only literal values (option one)? Should the client evaluate functions and resolve references? (option two)?

Option 1:

    pro: parsing cell values into a tree and traversing it is tricky. Writing it once in Java seems like a reasonable approach.

    con: client has no idea which cells are related to each other. That would really complicate features like copying and pasting cell references.

Option 2:

    con: reimplement much of cell parsing & traversal in Javascript. Using Rhino to test it outside a browser mitigates this a little.

    pro: client knows which cells are related.

Option 3:

    con: no idea how to apply this approach for a spreadsheet.

I chose option two. Eventually the client will probably need to work directly with cell references. Better to get that work out of the way ahead of time. Not all of the logic needs to be rewritten. Some of it is only needed on one side:

common:

  • build parse tree from cell values
  • iterate over parse tree

server specific:

  • update reference values: A1 => B1, $G3 => $G4
  • collapse the parse tree back into a flat string

client specific:

  • resolve reference values (A1 = 123.45, G3 = A1 = 123.45).
  • evaluate functions (=SUM(G3,A1) => 246.9).

I didn't expect so many neat challenges. Even the prototype implementation needed parsing, recursion, evaluating simple math expressions, tree traversal, base10 & base26 conversion, and more. But all that is meat for another post.

Leave a comment


Type the characters you see in the picture above.

0 TrackBacks

Listed below are links to blogs that reference this entry: Client vs. server: who does what in an online spreadsheet?.

TrackBack URL for this entry: http://www.nearinfinity.com/mt/mt-tb.cgi/395