Spreadsheet Amanuensis Spreadsheet Amanuensis
home Student Projects no local find frame, full screen Google search web for topic jump to footer translate with Babelfish by Roedy Green ©1996-2008 Canadian Mind Products
This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. It does not describe an actual complete program. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; I have too many other projects of my own.

I do contract work for a living, which could include writing a program such as this. However, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project any way you please.

This is one of the amanuensis projects. Why another spreadsheet?
  1. Microsoft is getting a little too much market share with Excel.
  2. Excel can’t exploit multiprocessors. It does not run on workstations or servers.
  3. Collaborative features of Excel are primitive.
  4. Spreadsheets will become the way to have the end user customise parts of a boilerplate program. For example, customers will provide tiny spreadsheets to calculate taxes or commissions.
  5. Everybody should write at least one spreadsheet engine in their lives, just to learn how they work inside.
  6. David Pollack’s Integer, (which handles floating point doubles just fine) which did some of these wonderful things, is no more.
This spreadsheet works a different way from usual.
  1. It is an amanuensis i.e. it generates the source for a Java program to compute it, and then compiles the code on the fly with the resident sun.com.javac.Main class. It does not bother with an interpreter at all. Not only do you sidestep the overhead of an interpreter, you automatically exploit the latest Java optimisation technology for the code you generate. You regenerate source and recompile before every execution if there are any changes. Let’s hope you have fast enough CPU to make this not too onerous. You don’t have automatic recalc the way you do in a conventional spreadsheet. The code you generate just calculates. It does no display, data entry or file i/o. One advantage of this approach is it becomes trivial for the end user to add new functionality to the spreadsheet. Spreadsheet functions are simply garden variety Java static methods.
  2. If you want to put some hair on your chest, instead of generating Java source code, generate the class file byte codes directly in RAM, then use a custom ClassLoader to load them directly from RAM, without ever creating any *.java or *.class files on disk. For hints on how you might do this see JASM.
  3. The code you generate is multithreaded. You can partition the spreadsheet calculation into threads that can be run in parallel, without object locking. This means you can maximally exploit every additional CPU.
  4. The spreadsheet is not a standalone program, but rather a JavaBean class, with optional Swing user interface. It designed to be just another component, like a TextArea, that you can plug into your own apps, or customise and plug into your own apps. It becomes trivially easy to add new functionality into your spreadsheet or to integrate your spreadsheet into other applications, quite unlike a desktop spreadsheet.
  5. In version 2 you might think about how you could avoid recompilation when the only changes were to numeric literals, not the formulas.
  6. In version 3, using RMI, you can have several people viewing and possibly even updating, a spreadsheet simultaneously. You could do it with peer to peer, with all copies complete and updating themselves, or with a central copy, accepting transactions, and just serving result changes for the part of the grid of current interest to each client. In any case, the idea is to keep the traffic between the copies to a bare minimum. This way you could actually execute the spreadsheet on some super server with 256 CPUs and blow everyone away with the calculation speed. It would be far faster than any desktop spreadsheet.
  7. In version 4 you can start thinking about how to import and export Excel spreadsheets. That way you could develop your spreadsheets in Excel, then export them to your spreadsheet engine for production.
Class.forName
ClassLoader
JASM
javac.exe
on the fly compose, compile and run

CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.18] Spread the Net
You are visitor number 4,251.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/project/spreadsheet.html J:\mindprod\project\spreadsheet.html