Simple Spreadsheet

DOS productivity program.

Screenshot of the program running, displaying a sample invoice
Screenshot of the program, displaying a sample invoice

We had to make a final end-of-year project for our Introduction to Programming class at school. The requirements were pretty vague and described a CRUD application in which data had to be stored, retrieved and manipulated. It usually led to students making simple library/videostore applications, but was there anything more interesting that could be pulled off?

I’ve always loved terminal applications with GUI elements and even today I still use those sort of applications on my more underpowered systems, be it vim for code-editing, cmus to play songs or mpsyt to search youtube. There’s something in them that makes me immediately nostalgic, not sure exactly why. Plus they spare resources.

We had a month to deliver our project and had to use Turbo Pascal 7, which was the teaching tool of choice for that class. Before deciding what to make I’ve read through the documentation (which was pretty nicely integrated in the IDE) to see what could or couldn’t be pulled off. I figured that making one of those terminal GUI applications was perfectly within reach and decided to give it a go. In the worst case scenario if something didn’t go as planned I could always hack together a simpler application in a couple of days.

Having stumbled upon Jack Crenshaw’s Let’s Build a Compiler series somehow back then, and being a bit in awe with his KISS approach to compiler creation - with easy to understand Pascal snippets spread throughout his lessons to boot - I was also looking at some project where I could apply his techniques.

I ended up deciding to make a tiny Visicalc / Lotus 1-2-3 clone: It would allow me to explore an ncurses-like interface, make a small expression evaluator and if time allowed even explore the graphical mode routines to draw some charts.

Visicalc was an extremely popular spreadsheet software with the first version being released in 1979 for the Apple II. It was reportedly quite a systems seller at the time, with people and companies buying the hardware just to use it. About 1 million copies ended up being sold throughout the product’s history.

Visicalc running on an Apple II
Visicalc running on an Apple II

Sales of Visicalc quickly diminished with the release of the Lotus 1-2-3 for the IBM PC in 1983, though. It mimicked Visicalc’s functionality, but it was faster due to the x86 assembly language code and had fewer bugs. It also allowed the creation of charts if the user had a graphics card.

Lotus 1-2-3 for DOS screenshot
Lotus 1-2-3 for DOS screenshot

Developing SS ended up being super fun and I explored both the pascal language and the APIs as much as I could. I separated the code into several reusable modules and even added parallel-port printer support. The low memory limitations were a challenge at the time though - I ended up having to limit the number of cells and refactoring the expression evaluator to solve expressions iteratively since my initial recursive approach kept hitting stack overflows.

There’s a case to be made to still keep using pascal and TP as learning tools for students. As outdated as it was even back then, the streamlined IDE, simplicity and readibility of the language and the integrated help system filled with clear explanations and examples for its API made programming quite fun and accessible.

Anders Hejlsberg, the original creator of Turbo Pascal, went on to join Microsoft where he leads the teams designing c# and typescript.