Spreadsheet 2.0 / Product Requirements Document
We've done some focus group studies and some market research, and found
that customers are really excited about Spreadsheet 1.0. In fact, we've
gotten so many requests that we're going to release the next version as
our flagship product. Marketing is really excited about the potential of
Spreadsheet 2.0.
But they want a few changes...
Feature: User-friendly cell references.
Marketing wants to use references like "A1", "B2", etc. instead of row/column
indexes like (1,1).
Internally, we can still use numbers, but the whole UI has to use the
letter/number combinations, for both input and output. So instead of
set 1 1 57
we now do
set B1 45.3
Feature: Function display.
We want to be able to display (print) the function associated with a cell
as well as the value. For example, if the cell is calculating A1+B2, we
should have a way to print "A1+B2" on the display.
We should also have a way to display the entire spreadsheet this way,
showing the formulas instead of the values. (Of course, any cells without
formulas still show their values.)
Feature: Trig functions.
There's a big customer who really wants sin and cos functions. So we have
to have these in version 2.
Feature: User defined formulas.
Market research indicates that users want to set up their own functions.
So in version 2, we'll let users set functions on cells. And not just simple
functions; we'll let them set up any function that can be built up from
+,/,*,-,%, sin, cos, (, and ), as well as any other functions or operators
we come up with in the future. The syntax will look like
set B1 = C2+ D3 * (1.5 + B7 + sin(A4) )
The = means that we're setting a function, not a value. Note that the formula
can contain cell references and constant numbers, and that there isn't
necessarily white space between the terminal elements.
Feature: Embeddability
Another big customer really wants to embed this spreadsheet into their
hand-held computing device. They have their own methods for I/O (involving
handwriting recognition), and so they just want a nice C++ interface to
our spreadsheet library with no I/O built in. In other words, they want
to be able to create a Spreadsheet, set and get cell values and formulas,
etc, but they don't want an event loop. We should be able to build our
code into a library to hand off to them.
Notes
A reasonable way to implement the user defined formulas is to implement
a recursive descent parser. (Other ways are to build an abstract syntax
tree or use a parser generator like yacc.) Note that the parser will have
to be able to do two different things: (1) find all the cell references
in the formula in order to figure out what cells the formula depends on;
(2) actually calculate the value of the formula. These things happen at
different times.
Possible Future Extensions
-
Additional functions, including functions that take a variable number of
arguments or cell ranges (such as B1:B15).
-
Persistent storage of the spreadsheet and its cells (saving and loading
back again from a disk file).
-
Undo, either single level or multiple level.
-
Elimination of redundant calculations to improve performance.
-
Ability to have strings as well as numbers in the cells (and the ability
to have string functions as well)