It has been argued that writing in Mesopotamia (present-day Iraq) grew from a counting system of clay tokens used to record transactions of goods. The goods represented were inferred by the shape of the tokens: spheres, cones and discs stood for measurements of grain, while cylinders stood for livestock. This counting system was used from 7500 BC onwards across the Fertile Crescent, from the Mediterranean coast down to the Persian Gulf.
I don't think you can start with "text" or "programming" and get very far. I think it's always better to have something important and big you want to do better with - eventually this provides clues to various kinds of media (including "languages") that need to be invented to help. This is what people miss. McCarthy wasn't trying to invent Lisp, he was trying to create ways to make an "Advice Taker". Doug wasn't trying to do hypertext, he was trying to synergize human effort for good.
— Alan Kay