his article explores the design of a GUI spreadsheet, called Nano-Sheets. In its most basic form, the code for Nano-Sheets requires fewer than 1,500 bytes of code, which prints easily on a single sheet of paper. It is a very basic, but fully functional, spreadsheet engine with a working GUI.
Why is it so small?
- It is built using REBOL, a compact, portable, messaging language designed for the semantic exchange of information between people and machines.
- The code generates the main GUI worksheet dynamically.
- The REBOL language is available for direct use in cell formulas. That means you don't have to write your own expression evaluator or macro language, yet you can still easily extend the worksheets with custom code.
- There are no features beyond basic spreadsheet functionality. This is an important design aspect. As you'll see, Nano-Sheets can be extended with specific features as necessary in an application, but also inherits the rich macro language that REBOL provides for cell formulas.
Many modern software developers think a spreadsheet has to be a multi-Megabyte program whose empty data files
are 10K or more in size. Even after adding features such as the ability to load and save files, HTML export, and some custom worksheet functions, Nano-Sheets will still be only about 10K of code (3.5K in ".rap" formthat is, compressed and encryptedon REBOL/IOS
. IOS stands for "Internet Operating System," which provides secure distributed messaging between Reblets similar to Nano-Sheets. You do need to install REBOL/View
(about a 300K download) to run the samples.
The goal here is not to rail against mainstream software bloat, or to write the smallest, most cryptic code possible; instead, it's to create a useful tool. With Nano-Sheets, you can send the entire application, along with the custom worksheet, in an email. For clients that use REBOL IOS, you can publish Nano-Sheets once; subsequently, the clients can can all use the shared copy. Fixes or extensions to the engine require a download of only a few kilobytes, which makes the application accessible to users on dial-up or wireless connections as well as those using broadband or LAN connections. And because REBOL is a multi-platform tool, Nano-Sheets will run wherever REBOL/View is available.