Software Design

String Theory and Time Travel: The Humble Text Editor

String Theory and Time Travel: The Humble Text Editor

by Colin Fulton

In the video titled "String Theory and Time Travel: The Humble Text Editor," Colin Fulton discusses the significance of text editors in programming and how they relate to more complex software development tools. Fulton, a front-end architect and accessibility specialist, emphasizes that while many spend considerable time using text editors, few understand their inner workings or the historical context surrounding their development.

Key Points Covered in the Talk:
- Introduction to Text Editors: Fulton begins by engaging the audience with questions about their preferences for text editors, illustrating the deep affection developers have for these tools.
- Personal Experience: He shares his journey into text editor development, sparked by his desire to create a personal CMS for his artwork, leading him to explore the intricacies involved in building a text editor.
- Historical Perspective: The talk outlines the evolution of text editors from early computing's keypunch machines and teletype interfaces to modern text editors. Examples include MIT's Tico and Unix's ed, showcasing the challenges and advancements in command editing.
- User Interface Philosophy: Fulton contrasts modal and modeless user interfaces, explaining their impacts on user experience and how they inform current text editor designs.
- Development Tools Evolution: He discusses the shift from hand tools to wizards in modern editor creation, highlighting how usability principles can guide the development of more efficient tools.
- Technical Features of Editors: The features of text editors, specifically the 'time machine' functionality, are examined to discuss how they could be improved using data structures such as doubly linked lists to enhance editing history tracking.
- Inspiration from History: Fulton points to significant figures such as Jef Raskin and innovations like the Canon Cat and Rob Pike's Sam to underline how historical insights can inform contemporary tool design.
- Conclusion and Forward-Looking Statements: He concludes by encouraging exploration of computing history, urging attendees to apply historical lessons to develop better editing tools. Fulton hints at ongoing work on his text editor and a future sharing of his findings.

Fulton's talk encapsulates not only the practical aspects of using text editors but also encourages a philosophical reflection on the tools we use and the potential for innovation rooted in historical practices. The overarching message is a call to appreciate and improve text editors, crucial tools in the developer's workflow.

00:00:15.369 Alright everyone, it looks like we can go ahead and get started. My name is Colin Fulton, and I'm a front-end architect and accessibility specialist at the University of Michigan Library.
00:00:21.920 I work on making our websites better for people with disabilities and also for people in general, as our current websites aren't very good. Whether you're a human or a non-human computer, they have their flaws.
00:00:32.930 So, my first question is: who loves their text editor? Okay, when talking to people who aren't computer programmers, they often don't understand why someone could give an impassioned talk about text editors.
00:00:39.140 However, Wikipedia shows that we are really serious about text editors, to the point where debates about them get their own Wikipedia pages. So, my second question is: has anyone tried to make their own text editor? There are a few hands raised.
00:00:56.539 It's a really special experience, and as you develop it, you start to realize why most people would avoid doing this. The reason I got into text editors is a long story that I’ll summarize this way: I wanted to make my own website for my artwork.
00:01:13.909 As a computer programmer, I thought I could build my own content management system (CMS). It can't be that hard. But as I developed my CMS, I thought maybe I could develop my own web framework too.
00:01:27.740 After working on that for a while, I realized I didn't really like any of the HTML templating languages out there, so I thought I'd develop my own. Not knowing much about parsing or lexical analysis, I decided to try my hand at it.
00:01:46.280 At the end of this long expedition, I found I was spending all my time in text editors and knew nothing about how to write one. So, I decided to spend some time trying to write the perfect text editor. This has been the end of my long journey so far.
00:02:02.900 However, this talk is not going to be about showing off the text editor I've been working on, as it isn't completed yet. I don't believe in rushing personal projects like this; I prefer to take a thoughtful approach, much like Rich Hickey did with his programming language.
00:02:19.160 So, in summary, this talk will first take us through a journey in time to explore text editors throughout history. If any old Unix graybeards are out there using ed since day one, you can snooze through this bit, but for the rest of us, it's fascinating to see where our text editors come from.
00:02:32.780 Next, we'll discuss the philosophy of tools—why do development tools look the way they do? Why are the User Interfaces (UIs) of development tools so different from those we create and the web products that many of us work on?
00:02:45.740 Finally, we'll spend some time building a time machine. Most text editors have a time machine incorporated, along with a number of other features. We will spend time looking at these various features alongside the topics mentioned.
00:03:16.940 If the slides become hard to read, just shout at me, and I can adjust them to be clearer. First, let's clarify what a text editor is.
00:03:31.160 A text editor is different from an IDE (Integrated Development Environment). An IDE is a powerful program packed with features, including debuggers and wizards to guide refactoring.
00:03:43.519 In contrast, a text editor is simply used for editing strings of text. Notepad is probably the prototypical text editor, similar to Vim or Emacs, but it doesn't offer many tools.
00:04:15.110 Now, let's go back to the dawn of computing. In the beginning, there were no computers, and everything was quite boring. Fast forward several years to when computers were invented; we didn't have screens and keyboards for a long time.
00:04:29.840 Instead, we had keypunch machines where users would fill punch cards with commands, which the machine would read. If you wanted to undo a command, you had to start over by creating a new punch card.
00:04:55.720 These primitive line editors made it easy to reorder code, but they were cumbersome and frustrating at times. That's why people eventually began using teletype machines connected to their computers.
00:05:07.570 Teletype machines acted as typewriters that could transmit characters to the computer and receive output in return. This laid the foundation for how our command line interfaces work today, where you can't go back and edit previous commands.
00:05:30.490 As command-line interfaces developed, eventually, dumb terminals allowed computers to display output on screens instead of printing on paper. This innovation facilitated a lot of early computer development, including Unix.
00:06:05.070 Let's examine what text editors were like in those early days. A notable example is Tico, a popular text editor created at MIT in the 1960s. It had a complete command language featuring if statements and loops for manipulating text and files.
00:06:31.160 Each command was just one character, allowing quick typing without the hassle of lengthy commands. However, this powerful command language led people to write very complicated macros, which could result in amusing unintended usages.
00:07:10.570 Unix, the operating system we still rely on today, saw the development of its first popular editor, ed. It was a simple editor, which many users found limited and frustrating due to its complexities.
00:07:47.320 Ed's limited feedback also led to confusion. For instance, if you entered a command incorrectly, it might just return a question mark and require further investigation to determine what went wrong.
00:08:43.060 Additionally, the commands were quite unintuitive and required a lot of memorization. This led to the development of sed, an extended editor that removed the need for live editing and made it easier for professionals mastering the tool.
00:09:25.760 While sed may not be user-friendly, it remains a powerful tool for those willing to invest time in learning its complexities. The discussion of UIs leads us to the concept of modal versus modeless interfaces.
00:10:05.980 Modal UIs require users to switch between different modes (like command and insert modes) while modeless interfaces allow any command to be executed at any time without switching modes.
00:10:52.370 Ultimately, both approaches can work depending on the situation; the key is finding the right fit. When discussing development tools, I like to differentiate between hand tools and wizards.
00:11:33.930 Hand tools, like a Japanese saw, allow skilled users to have more control, while wizards provide shortcuts for those needing guidance. Both have pros and cons, and the context determines which is more suitable.
00:12:04.310 Wizards are designed to guide users through complex tasks, assisting those who may not be experts. The trade-off for the convenience offered by wizards is often a lack of control.
00:12:31.720 On the other hand, hand tools gain respect amongst experts who utilize them with speed and skill, creating an environment of admiration because of their proficiency, and it's a sight to behold.
00:13:16.390 Both wizards and hand tools can coexist, offering different functionalities for different scenarios. Today, modern editor creation often leans towards wizards, leaving older text editors somewhat neglected.
00:14:00.140 However, the lessons learned from older editors remain relevant, and projects like Vim and Emacs continue to thrive by adapting with the times. Vim remains popular despite being difficult to use, as it allows programmers to perform complex tasks.
00:14:41.840 Emacs, originally a set of macros built on Tico, evolved to provide users with powerful capabilities. Users must still invest time in learning combos to manipulate it effectively, enhancing its capabilities.
00:15:22.720 It's essential to take into account that all of these editors were created in a time of limited computing resources, but today we have more powerful hardware and memory at our disposal.
00:16:00.240 We need to leverage that to write better, more efficient, and expressive programs. The advances in technology have led to sophisticated data structures which enhance how we build these rich environments.
00:16:39.771 One key improvement could be a better command syntax. Instead of cryptic command languages, we could adopt a syntax that is intuitive and allows better comprehension of commands without excessive memorization.
00:17:27.290 In this development, the philosophy of usability suggests using principles such as single responsibility and composability so that smaller commands perform specific actions, allowing for creative combinations of these smaller tasks.
00:18:03.670 Documentation can be a first-class part of this infrastructure to improve the editor’s usability through static typing and by offering constructive feedback when missteps occur, enhancing the overall editing experience.
00:18:51.890 Let’s also talk about the time machine feature in editors, which often seems to be broken or limited. An effective edit and history feature could exponentially improve user experience; the power of tracking edits can simplify the editing process.
00:19:32.460 Implementing a doubly linked list may serve as the foundation for this editing history. By connecting each change with its predecessor and successor, you can navigate back and forth through the history easily.
00:20:17.269 This would enable users to undo and redo actions seamlessly. However, a challenge exists in ensuring that altering one part of the history does not break the whole structure.
00:21:01.990 Maintaining a clean history without the risk of losing work requires implementing branches within that history, much like Git does, allowing users to switch between different states of their editing process.
00:22:23.390 Through these implementations, the editing process becomes flexible and intuitive, enhancing the value of user interactions with their editing environment.
00:23:05.099 There exists historical precedence for innovation in editing tools, with pioneers like Jef Raskin working on the Macintosh, promoting a user-friendly approach that prioritized usability without compromising power.
00:23:47.630 Another noteworthy development is the Canon Cat, a computer that relied solely on keyboard shortcuts, providing flexibility and usability through a thoughtful design that eliminated the mouse.
00:24:22.050 Building on this philosophy, Rob Pike developed Sam, a text editor that fundamentally changed how text was edited, moving away from traditional line-based structures to a model based on regular expressions.
00:25:11.340 The strong aligned principles used in his work illustrate how traditional concepts are reimagined in light of modern capabilities, leading to efficient approaches without the constraints posed by outdated paradigms.
00:25:59.290 Additionally, planned improvements in text editors can incorporate lessons learned from historical designs, merging both usability and functionality in concert with evolving tech.
00:26:44.370 The key insight from all this is standing on the shoulders of giants that have shaped the world we currently navigate; exploring that legacy and applying those strategies can yield remarkable advancements.
00:27:31.610 I encourage you to explore the history of computing to see the myriad ways it's influenced contemporary tools. There are endless developments from the past's design principles that offer lessons for us today.
00:28:11.190 I don't have all these practices down yet, but I'm working on it and will soon upload my findings. Thank you very much for your time!