One of the most interesting things about programming is that it forces you to decompose seemingly simple ideas into a set of orderly steps, and when you do that, you often realize that the "simplicity" of things you deal with all day, every day, is purely illusory and that these are actually incredibly complex, nuanced, fuzzy and contradictory: everything from peoples' names to calendars to music, art, email addresses, families, phone numbers, and really, every single idea and concept.
It turns out that "plain" text is also fantastically complex. Alexis Beingessner's daunting list of the problems of text rendering makes that clear.
And once you've got the text to render, you have to edit it, and that turns out to be even harder, as Robert Lord describes in an essay recounting the lessons he learned spending several years merely implementing a text-selection library.
Jonathan Blow, in a talk about how software is getting worse, points to the example of Ken Thompson’s text editor, which Ken built in a single week. Plenty of the code in this blog post is accidental complexity. Does Windows need 128 interfaces and 8 kinds of locks to provide text input? Absolutely not. Are the bugs we’ve found in TextEdit disappointing, and a result of a complicated editing model? Yes. Are the wealth of bugs in modern programs something we should be worried about? I’m worried, at least.
But at the same time, Ken Thompson’s editor was much, much simpler than what we expect from our text editors today. Unicode supports almost every one of the ~7000 living languages used around the world, and plenty more dead languages too. These use a variety of scripts, directions, and input methods that each impose tricky (and in some cases, unsolved) problems on any editor we’d like to make. Our editor also needs to be usable by vision-impaired folks who use screen readers.
The necessary complexity here is immense, and this post only scratches the very surface of it. If anything, it’s a miracle of the simplicity of modern programming that we’re able to just slap down a <textarea> on a web page and instantly provide a text input for every internet user around the globe.
Text Editing Hates You Too [Robert Lord/Lord.io]
(via Four Short Links)