TweetFollow Us on Twitter

Spreadsheet 2000

Volume Number: 13 (1997)
Issue Number: 4
Column Tag: Visual Programming

Building a Visual Programming Language

By Steve Wilson, Palo Alto, CA

Designing and implementing intelligent, user-friendly, commercial software with Prograph

Back in late 1993, my business partner (and father) Dave Wilson and I decided we were going to create a new Macintosh application. We wanted to build an app that would appeal to a wide range of users and would fill a real need in the Mac community. We decided we would write a spreadsheet - but not just any spreadsheet. We locked ourselves in a conference room with a white board for two days, and designed a visual programming language (VPL) for solving the same type of problems typically solved with a spreadsheet. The product which resulted was called Let's Keep It Simple Spreadsheet (or L.K.I.S.S. for short). L.K.I.S.S. 1.0 was first released in May 1996, and was very well received. In January 1997 we released version 2.0 of the product and changed the name to Spreadsheet 2000.

In this article I will give an overview of the VPL we created and also talk briefly about our experiences implementing it. We used Prograph CPX, another VPL to write Spreadsheet 2000, and as you can imagine, this led to some interesting experiences.

The old way vs. the new way

A spreadsheet is a type of programming language. It just isn't a good one! Anyone who has ever built a non-trivial spreadsheet knows how hard it is to do without causing unseen errors. One of the fundamental problems with spreadsheets is that your formulas, labels, and data are all mixed together. In fact, a single cell often contains a text-based formula hidden underneath the answer produced by the formula, as shown in Figure 1.

Figure 1. Cell A4 looks like data, but it is actually a formula.

We set out to design a Macintosh-like user interface to fix this and other problems with the traditional spreadsheet metaphor. Spreadsheet 2000 is the program we built. Figure 2 shows a simple calculation done with Spreadsheet 2000 as it would appear on your screen.

Figure 2. The same calculation done with Spreadsheet 2000.

Spreadsheet 2000 calculations are easy to understand because you can see what you're doing. We use visible operators instead of text-based formulas to perform the work. We feel that this will lead to more accurate results, as well as a shallower learning curve. Lastly, we hope that Spreadsheet 2000 makes problem solving more fun.

Figure 3. A screen shot of Spreadsheet 2000.

Language Overview

Is Spreadsheet 2000 really a spreadsheet? I get asked that question a lot, and I'm not sure I know the answer. It probably isn't, but it helps the marketing people to call it one. I can, however, tell you what Spreadsheet 2000 is: Spreadsheet 2000 is an object-based, data flow, visual programming language. I hesitate to say that Spreadsheet 2000 is object oriented, because that term carries so much intellectual baggage, but objects do play a big role in our language. The idea of treating data as objects, is one of the things that makes Spreadsheet 2000 so powerful.

There are 4 major classes of objects in Spreadsheet 2000: Grids, Operators, Charts, and Notes. Each of these classes of object can come in many different shapes and sizes (you might even call them subclasses), and some samples are shown in Figure 4. The two most important of these classes are Grids and Operators.

Figure 4. Spreadsheet 2000 Objects.

Grids

Grids are basically collections of cells. Grids usually contain numbers, but you can also add labels which hold strings. Note that grids do not contain formulas, we use separate visual operators instead. There are 4 basic "subclasses" of Grid: Table, Row, Column, and Cell. These types are differentiated only by their shape. A Table is a two dimensional collection of cells. A Row is a horizontal collection of cells, where a Column is organized vertically. The fact that each of these subclasses are treated differently allows for some interesting behavior, which I'll explain as we talk about Operators.

Operators

Operators are the objects which manipulate the data stored in Grids. Operators display an interesting kind of polymorphism which resembles function overloading in C++. Basically, Operators perform differently depending on what subclasses of Grid are connected to its inputs and outputs. Spreadsheet 2000's visual language is centered around the idea of overloaded operators. Let's look at an example.

Figure 5. Adding by Column.

Figure 5 shows a simple calculation with Spreadsheet 2000. It is using the + operator to add some numbers together. You will notice that it is adding the numbers by column. How does it know that is what you wanted? Because the output of the + operator is connected to a Row object. Can we get it to add across instead of adding down? Sure we can.

Figure 6. Adding two ways.

In Figure 6 we just dropped in a Column object and connected the output of the + operator to the input of the Column object. Now that the + operator is attached to a Column it acts differently, adding across instead of down. Note that this single operator can service both grids. We can even take this one step further, as shown in Figure 7.

Figure 7. Adding three ways.

Now we drop in a single cell and connect the operator to it. Since we are feeding into a single cell, it adds up all the numbers in the original grid and sums them together.

Let's take a look at another example of Spreadsheet 2000 polymorphism. In this case we'll look at an operator with 2 inputs instead of just one.

Figure 8. Multiply a Table times a Cell.

Figure 8 shows the use of the A*B operator. In this case it is multiplying a Table times a Cell. As you can see from the figure, it is multiplying each value in the Table object times the value contained in the Cell object. Now what would happen if we multiplied a Table times a Row? Let's grab the resize box on the Cell and stretch it into a Row. This effectively changes the class of that object. Then let's put a number into the new cell that's created inside the Row object.

Figure 9. Multiplying a Table times a Row.

Can you see what it is happening in Figure 9? It is multiplying the first column in the Table times the first cell in the Row, and the second column in the Table times the second cell in the Row. Since we changed the class of that Grid from a Cell to a Row (by stretching it) the A*B operator now changes its behavior. That's pretty cool, but you're asking why would I do that? Let's build a simple "real world" example using these ideas.

Example: Building a Budget

Let's say that we want to build a simple budget, so that we can see our expenses for the year. We have a set of expenses which occur on a daily, weekly, or monthly basis and we want to see what comprises the bulk of our expenditures. We can use the two operators we explored in the last section to accomplish this.

Figure 10. Our Budget.

Figure 10 shows the document we constructed to solve this problem. Since daily expenses will occur 365 times each year, weekly 52 times, and monthly 12 times we can use the A*B operator to compute the total amount spent per year on each item. We can then add the columns in that Grid together to get a single Column using the + operator. Lastly we feed that Column into a Chart so we can see our results.

Custom Operators

That's pretty cool for simple stuff, such as addition and multiplication, but can you do anything sophisticated with this? We certainly hope so. There is a set of 90 operators which are built into Spreadsheet 2000. These include operators for trigonometric functions, scientific functions, date and time functions, sorting, searching and even Boolean logic and loops. That gives you a lot of flexibility, but we can't claim to have built in every conceivable operator. That's why we let you build your own! Let's look at an example of doing that.

On our palette full of operators we have objects for computing Square and Square Root. These are commonly used functions, and we wanted people to have easy access to them. Now let's say that you often need to take the cube root of a number in your calculations. We don't have a Cube Root operator built into the program, but we do have a two-input operator called Root, which can take the n-th root of any number. You could use that (as shown in Figure 11).

Figure 11. Finding the cube root of 27.

Now that works fine, except it seems like a like of work for something you'll want to do often. That is what Custom Operators are for. Let's look at how we could build a new Cube Root operator. First you need to select the items which are central to your calculation. You can do that by shift-clicking or drag-selecting. Once you have these items selected you'll want to choose the Crunch menu item.

Figure 12. Building a Cube Root operator.

After you choose Crunch, you'll be prompted to give your new operator a name. The result is a new Cube Root operator which can be used again in this document or in other documents. You can even save this operator into one of your own custom palettes. You can then give these palette files to your friends, or even upload them to the Internet. We hope to build a cottage industry around people building and sharing custom operators and other Spreadsheet 2000 documents. We have even built a site on the web where people can upload and download Spreadsheet 2000 documents and operators. Visit Emergent Behavior's Spreadsheet 2000 web page http://www.emer.com/s2k for more info.

Writing Spreadsheet 2000

We always get a good response from people at user groups and trade shows when we demo Spreadsheet 2000. Developers, in particular, seem to really like it. After the demo they often ask me what I used to write it, and I tell them Prograph CPX. After the poor programmer pulls his jaw off the floor, and puts his eye balls back in their sockets, he asks me if I'm kidding. If you haven't yet heard of Prograph then you should check out some of the great articles from past MacTechs which are referenced at the end of the article or stop by http://www.pictorius.com. Figure 13 shows an example of some Prograph source code. In this article I'm not going to dwell on the technical details of Prograph (there are many fine MacTech articles which do that). I want to give you my general impressions from using it to build a large application.

Figure 13. The Prograph source for closing my about box.

It seems that many people have heard of Prograph, and some have even tried it, but few people believe that Prograph can be used to write a "real" application. I'm here to tell you that you can. Prograph often get's lumped into the same category with products like MicroBrew (formerly AppWare), HyperCard or MacroMind Director. The fact is that Prograph is a much more powerful general purpose programming tool. With tools like MicroBrew, HyperCard or Director you can very quickly build certain types of programs, but you generally run into a wall where you must write some kind of C code to get a particular behavior you want. HyperCard XCMDs are an example of this. Although Prograph can import existing C code, Prograph doesn't have these limitations, and Spreadsheet 2000 illustrates how powerful Prograph can be. Let's look at some facts about Spreadsheet 2000.

Spreadsheet 2000 Facts

Spreadsheet 2000 is written in 100% pure Prograph, and supports the basics you expect from a real application. It is a stand-alone, double-clickable application which supports multiple windows and documents, floating toolbars and cut/copy/paste. It even supports some things you might not expect, such as Drag Manager. One thing to keep in mind is the fact that I didn't write any external C code. Prograph gives you full access to the Mac Toolbox, so there isn't any kind of application you can't write with Prograph. One key detail that shouldn't be left out is that Spreadsheet 2000 is PowerMac native. Prograph has compilers which generate real 68k and PPC assembly language. (An Intel x86 compiler is also in Beta.) You don't need any run-time baggage, such as byte code interpreters or run-time engines. You are a first class citizen on the desktop.

Now that we've established that it is possible to write serious applications with Prograph, we come to the question of whether it is practical. Once again, I believe the answer is yes. Spreadsheet 2000 is implemented using about 450 Prograph classes which contain about 4000 total methods. About 150 of those classes are the ABC Application Framework which comes with Prograph CPX. About 50 of those classes are add on libraries from third parties, and the rest are Spreadsheet 2000 specific. 450 classes is a fair sized OOP project by most standards, and Prograph handles it without showing signs of stress. I should also mention that I use VOODOO from Unisoft for source code management. It does a great job of keeping track of the 100+ source code files which are used to build Spreadsheet 2000.

Prograph's greatest benefit is productivity. Version 1.0 of our application was written using about 2 programmer years of effort. Moving from version 1.0 to 2.0 took us about another 7 months. That may see like a lot, but that is nothing when compared with other productivity applications, especially when you consider that time includes Prograph's learning curve. I'm a pretty fair C++ programmer (I've taught Apple Developer University's course on Advanced C++ many times), but I just can't write code as fast in C++ as I can in Prograph. Add in the fact that Prograph's garbage collector takes care of most memory management tasks, and you can really start to see Prograph's benefits.

The other thing which needs to be mentioned here is debugging. Let's face it, what percentage of your time do you spend writing new code vs. debugging existing code? Prograph has the world's best debugging environment. I make this sweeping statement without apprehension. Prograph's environment is more conducive to debugging than any other. When you encounter an error in Prograph the machine doesn't bomb. Prograph halts the execution of your program and puts up a dialog explaining the difficulty. (See Figure 14 for an example.) You can then rollback execution of the program, make modifications to your source code and continue to run the program. I'm sure you've done the old: Compile, Link, Test, Modify, Compile, Link, Test, Modify cycle. With Prograph you can shorten that to: Test, Modify, Test, Modify.

Figure 14. Prograph offering assistance to fix a bug.

The Flip Side of Prograph

I've now made Prograph sound like the second coming, but I should fill you in on its limitations. Although Prograph can write any type of application there are types of programs which it cannot produce. Prograph cannot create stand-alone code resources which means you cannot build Photoshop filters or Netscape plug-ins. You also cannot currently build OpenDoc parts.

Performance is another issue of concern for many. Compiled Prograph code is not as fast as compiled C++ code. A program written in C++ will also generally be smaller, and require less RAM than an equivalent Prograph app. If speed and application size are your main concerns then you will want to experiment with Prograph some before committing major resources to Prograph.

I should add a couple more comments before closing this subject. First, the Toolbox is the Toolbox, no matter what language you use to call it. For example, a call to CopyBits doesn't take any longer when called from Prograph than from C++. The other comment is more qualitative, bad C++ code is slower than good Prograph code. Although Prograph is often slower than C++ for equivalent operations, your choice of algorithm may still be the most important issue. A bubble sort written in C++ will not be faster than a quick sort written in Prograph. Your skill as a programmer, and your knowledge of your problem domain is ultimately much more important than your choice of language.

The Future of Prograph

Prograph is being actively supported and improved by Pictorius. Right now early versions of Prograph CPX for Windows are available. I've worked with some of these early releases and I was pleasantly surprised. Prograph is going to be a serious choice for developing your cross-platform applications

Conclusion

I hope you've enjoyed this brief exploration of visual programming. Visual programming languages are often quickly dismissed as toys, but I hope that the success of tools such as Spreadsheet 2000 and Prograph will change that. Although text based languages (and spreadsheets) will not disappear anytime soon, I think that visual alternatives will start to become a serious option more often. The best way to figure out if visual programming is right for you is to take a test drive. If you're interested in Prograph, there is a demo CD with a crippled version of the environment available from Pictorius.

In this article I've only scratched the surface of Spreadsheet 2000. There are a number of features, such as our reporting options which let you build simple front ends to your calculations, which I haven't addressed at all. If you're interested in Spreadsheet 2000 then you can get a demo off the web at http://www.emer.com/s2k. That is the best way to get a feel for the program. Have fun.

Places to see on the web

http://www.emer.com/s2k has all sorts of info on Spreadsheet 2000 and includes a FAQ and a library of documents for downloading.

http://www.emer.com/MadeWithPrograph is a list of over 40 Macintosh applications which have been written with Prograph CPX.

http://cocoa.apple.com Cocoa version DR/1 is a visual programming language for kids. It also happens to be written in Prograph CPX.

http://www.pictorius.com general info on Prograph CPX.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »
Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links below... | Read more »
Marvel Future Fight celebrates nine year...
Announced alongside an advertising image I can only assume was aimed squarely at myself with the prominent Deadpool and Odin featured on it, Netmarble has revealed their celebrations for the 9th anniversary of Marvel Future Fight. The Countdown... | Read more »
HoYoFair 2024 prepares to showcase over...
To say Genshin Impact took the world by storm when it was released would be an understatement. However, I think the most surprising part of the launch was just how much further it went than gaming. There have been concerts, art shows, massive... | Read more »

Price Scanner via MacPrices.net

Apple Watch Ultra 2 now available at Apple fo...
Apple has, for the first time, begun offering Certified Refurbished Apple Watch Ultra 2 models in their online store for $679, or $120 off MSRP. Each Watch includes Apple’s standard one-year warranty... Read more
AT&T has the iPhone 14 on sale for only $...
AT&T has the 128GB Apple iPhone 14 available for only $5.99 per month for new and existing customers when you activate unlimited service and use AT&T’s 36 month installment plan. The fine... Read more
Amazon is offering a $100 discount on every M...
Amazon is offering a $100 instant discount on each configuration of Apple’s new 13″ M3 MacBook Air, in Midnight, this weekend. These are the lowest prices currently available for new 13″ M3 MacBook... Read more
You can save $300-$480 on a 14-inch M3 Pro/Ma...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
24-inch M1 iMacs available at Apple starting...
Apple has clearance M1 iMacs available in their Certified Refurbished store starting at $1049 and ranging up to $300 off original MSRP. Each iMac is in like-new condition and comes with Apple’s... Read more
Walmart continues to offer $699 13-inch M1 Ma...
Walmart continues to offer new Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBook for sale by... Read more
B&H has 13-inch M2 MacBook Airs with 16GB...
B&H Photo has 13″ MacBook Airs with M2 CPUs, 16GB of memory, and 256GB of storage in stock and on sale for $1099, $100 off Apple’s MSRP for this configuration. Free 1-2 day delivery is available... Read more
14-inch M3 MacBook Pro with 16GB of RAM avail...
Apple has the 14″ M3 MacBook Pro with 16GB of RAM and 1TB of storage, Certified Refurbished, available for $300 off MSRP. Each MacBook Pro features a new outer case, shipping is free, and an Apple 1-... Read more
Apple M2 Mac minis on sale for up to $150 off...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for $100-$150 off MSRP, each including free delivery: – Mac mini M2/256GB SSD: $499, save $100 – Mac mini M2/512GB SSD: $699, save $100 –... Read more
Amazon is offering a $200 discount on 14-inch...
Amazon has 14-inch M3 MacBook Pros in stock and on sale for $200 off MSRP. Shipping is free. Note that Amazon’s stock tends to come and go: – 14″ M3 MacBook Pro (8GB RAM/512GB SSD): $1399.99, $200... Read more

Jobs Board

*Apple* Systems Administrator - JAMF - Syste...
Title: Apple Systems Administrator - JAMF ALTA is supporting a direct hire opportunity. This position is 100% Onsite for initial 3-6 months and then remote 1-2 Read more
Relationship Banker - *Apple* Valley Financ...
Relationship Banker - Apple Valley Financial Center APPLE VALLEY, Minnesota **Job Description:** At Bank of America, we are guided by a common purpose to help Read more
IN6728 Optometrist- *Apple* Valley, CA- Tar...
Date: Apr 9, 2024 Brand: Target Optical Location: Apple Valley, CA, US, 92308 **Requisition ID:** 824398 At Target Optical, we help people see and look great - and Read more
Medical Assistant - Orthopedics *Apple* Hil...
Medical Assistant - Orthopedics Apple Hill York Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Now Read more
*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.