Outliners turned out to be way more computer science than they look
- Published on
When I'd just started building Kosshi, I wasn't all that comfortable with Mac/iOS development to begin with, so the first thing I did was dig through Apple's docs trying to figure out which pieces I should combine to build an outliner. But I couldn't really find anything that would get me close. Even when I tried things out, something would always be off.
Most programming jobs are really about picking up foundations that already exist and using them well — that's where most of the weight sits. Everything I'd built before — web services, regular apps — was the same shape: stack things on top of existing frameworks and libraries. I assumed an outliner would feel the same way.
The more I looked into it, the more I realized I had to build this from a more fundamental layer.
To be precise, you can probably build something that works as an outliner using only Apple's standard frameworks. A list view, indentation, collapsible rows — those are things the frameworks will give you. So at first I was working in that mode too.
The thing is, matching what someone used to a modern outliner expects turns out to be hard with that approach. The standard list and text views weren't designed with outliners in mind, so when you try to stack one on top of them, you keep running into the limits of what the underlying assumptions allow.
While working on it, I started feeling: there's no way around going one layer below. So Kosshi ended up being assembled from a lower layer. The behavior that Apple's higher-level frameworks would normally hand you — in Kosshi, I mostly write that from scratch.
On top of that, there's another part that's hard internally. Making it stay responsive when there are a lot of rows.
I'm the kind of person who deletes notes pretty often, so my own outline never really gets that big. But when I looked at outliner users, there are quite a few who keep years of notes and tasks in a single file, running into hundreds of thousands of rows.
So with Kosshi, I'm building toward the goal of staying responsive even past 100k rows. At the core is a data structure called SumTree, modeled after the one used internally by Zed, the high-performance text editor. Roughly speaking, instead of laying rows out in a flat line and counting from the top, you arrange them in a tree, so you can jump to any position in a small number of steps. (See: Why Kosshi stays fast at scale)
I've already started getting some feedback, and people sometimes wonder why a usual operation that works elsewhere doesn't work in Kosshi. Since most of Kosshi's behavior is written from scratch, the implementation often turns out to be missing for features I don't personally use.
While working on this, something started to settle in.
Outliners turned out to be much more computer-science-flavored software than they look.
To a regular user, it's just an app for writing bullet points. But internally, there's a surprising amount of data structures, complexity, and algorithms going on.
Early in my career, when I was a backend engineer working on a search system, I went through a phase of wanting to do this kind of algorithm-adjacent work. There was a sort of admiration for it, like it was the glamorous side of the field.
But most regular web services and system development jobs are built on top of existing technologies, combined together. It's mostly an unflashy stack of mature tools. That's hard to avoid if you want to build something that stays stable.
Something gradually became clearer to me while building this. This kind of computer-science-flavored work seems to come up when you're aiming somewhere that the usual "stack things on top of an existing foundation" approach can't quite reach. Once you start rebuilding it yourself from a lower layer, what's waiting there is data structures and complexity, and the work naturally turns more algorithm-flavored. Kosshi has turned out to be much more demanding than I'd thought at first.
I never really expected the kind of work I used to admire when I was just starting out to show up inside an app I'm building on my own. It takes time, and there are days when nothing seems to move, but being able to build something like this with my own hands feels like an unexpected kind of luck.
Related posts
Kosshi took me four years to ship
I left my company at the end of 2021. Before that, a few of us had been building a new product internally. The product itself didn't take off, but I couldn't shake the feeling of building something from zero, so I quit to do it full-time on my own. Going from a salary to nothing overnight was a stretch, so the plan was to take freelance work for a few year
I'm starting to wonder if I wanted a robot
I've said a few times that I was going to build a small robot called Sankome. Recently, though, I noticed something a little troubling. Maybe I didn't actually want the robot itself. This is a problem. I had been saying I would make it, and now I was no longer sure whether I really wanted the thing I was trying to make. For a long time, I wanted to make s
When there are new posts, I send a single weekly email summarizing them.
You can unsubscribe anytime.