Thursday November 25, 2021; 11:04 AM EST
- I'm going to be writing a lot of Drumkit over the next few days, and I'm really, really looking forward to it. This is turning out to be more fun, and in some ways, better, than working in an IDE. I did not expect that, not one bit. I was expecting working inside Drummer to be a set of painful compromises. Here are some notes I'm typing up about the experience as I go.#
- #
- The good, which is really, really good#
- I really like starting with a previously built thing, like an icon or a menu item. It gives me a prebuilt idea about how I might approach the problem, and I can easily grab entire labeled groups of functions from an icon, and drop them into a menu item as a scaffold for something else.#
- Writing the instructions for how to use it before even going near the code section is the way it should be. It forces me to think through each step of what I am claiming this code does, and how I intend to do it.#
- Inline user and dev documentation is the way to go. Separating the concepts of label, description, explanation and disabled code is clarifying and instantly makes it easier to navigate.#
- Trying chunks of code and just command-backslash to toggle them in and out is amazing. These do not have to be individual lines, you can do entire grouped hierarchies of functions. Or just a chunk of a function. What is that, a paragraph? I guess it's a block. (Given names like Drummer and Drumkit, it's probably a wooden block you hit with a stick. Maybe a cajon...)#
- I miss autocomplete and hover to bring up contextual documentation. Fortunately that is the next thing I am going to build after the little snippet I'm writing now.#
- I do not know what to call these chunks of Drumkit. So far I have referred to them with terms like snippets, thingies and chunks. A coworker suggested drums. I realized that I could just omit the word if I phrase it correctly, so for now I am going with "This Drumkit does blah blah".#
- Maybe "script" is the right word. This Drumkit script does blah blah. Here is where I keep the Drumkit scripts. Enh. I am not feeling that.#
- My use of ad hoc function categories, and the choice to emphasize plain English headers, rather than method names, using formatting like bold text, makes it SO MUCH EASIER to navigate my code, I cannot overstate this.#
- Not running everything through a standard, language- or project-specified, source code formatter is making me happy. Enforcing standard formatting helps me not go insane when other developers make The Wrong Formatting Decisions. But this is my fucking code. I can format it however the hell I want. My decisions about runs of white space are based on context and choice, not pattern matching. #
- I may have mentioned, I care a lot about how my code reads, and Drumkit is letting me also not care about anybody else's opinions on that. No one else writes their Drumkit code like this, I can't imagine anybody else would feel comfortable working like this. It requires a lot of extra formatting. You have to go back and rework running code. You write far more comments than you'd think are really necessary. #
- All the other Drumkit code I've seen looks like regular source code, all semicolons and braces and function names and variables. This is how we write code, this is what it looks like normally. You stop when it works. I keep going, because I want it to read well, too.#
- If you write some code, and decide to make it a function, you are working in an outliner. So all you do is, insert a node above the lines you are going to extract into a function, put the "function blah() {" etc stuff there, then just tab the nodes to indent them under the function, add a close brace, and now you can just drag that sucker wherever you like. #
- #
- The bad, which is really, really, really fucking bad#
- If you have a node selected and you accidentally hit backspace twice, you are fucked. You cannot possibly undo this. You can undo one of the backspaces, and get one of the nodes back. The other backspace has consumed the other node, and everything under it, even a nice group of functions you've worked on for hours. It is gone. You cannot get it back. Gone. I've also lost major chunks of blog posts this way. #
- If you don't notice you've done this, if you just hit undo to get the node back, and keep going, entire if-then blocks or paragraphs can disappear. Why isn't it working now? I thought I had that fixed. Oh right, that whole error-checking part is apparently gone now. What did that do again?#
- This also comes up in a different context. If you hit command-return, and split a node at the wrong place, my first instinct is to hit undo. Splitting the node is apparently two operations, however. If you hit undo, what gets undone is the insertion of the text into the new node. So you end up with half your text in the first node, and a new, empty, node. Half your text is gone. If you do not immediately hit undo again, you will not get it back. You are fucked.#
- And if you do remember to hit undo precisely twice—not once, not three times, but only twice shall you hit undo—your text is now in two nodes anyway, and you cannot undo that. I have been reminded that the keystroke to backspace a node into another node is, in fact, command-backspace. However, this does not always work. And, you have to navigate the cursor to the right spot. Because when you split the node, the text insertion point is now at the end of the newly inserted text in the newly inserted node. #
- So you need to click on the exact spot where the text begins, which means, you are very likely to accidentally select the entire node, instead of placing the cursor where command-backspace will do any good. I'd try it right now to see what command-backspace does when you've got an entire node selected, but I don't want to. My brain needs patterns that are safe. When I find a way to do something that is safe, I do it that way. Command-backspace does not feel safe.#
- I cannot overstate how careful I try to be with the backspace key. If I want to delete a node, I pause, and look, and double-check what I am seeing, and then after hitting backspace, pull my hand away from the keyboard like it was electrified. Keybounce may not be a problem, but my hands get jittery when I'm excited, and I cannot help it, I get jittery when I might be about to lose a bunch of work if I fuck it up.#
- Anyway, my first, first, first instinct is always, always, always, to use undo. That this is not the right thing to do in Drummer, and, in fact is an instant ride to lost-your-data town, unless you start thinking very, very carefully about what you are doing, is a shame. See this previous post. #
- I'd like it if Drummer had multiple undo. But that is probably an enormous rewrite of Concord, which is based on literally decades of experience and outliner code that works the way it does for very good reasons. It's a completely unreasonable ask, and not something worth filing as an issue. Just having repro steps for something isn't enough. #
- (It's also entirely possible, even probable, that some or all of these are only problems because I'm using an iPad, which, I'm probably the only one in the world. I am certainly not going to file an issue for something that literally affects only me, that's nuts. The drummerSupport repository functions as a todo list for Dave, it is not there for user support.)#
- I am learning to embrace the fact that if I wrote it once, I can write it again. I generally do it better the second time, anyway. Probably. #
- #
- Back to the fucking awesome part#
- The fact that I am still willing to put this much time and effort into Drummer����even though a stray keystroke, or trackpad tap, could, and has, repeatedly, obliterated non-trivial amounts of work—should be clear evidence of just how fucking awesome Drummer is. #
- I just realized today is Thanksgiving, so, umm, Dave, I accidentally kind of got loud at the blog version of the dinner table here, and I am sorry about that. But, really, thank you. Drummer is fucking awesome, and I will keep using it like crazy, even if it never gets multiple undo. No joke. #
- I don't say thank you enough. Thank you, Dave. You have made something amazing here, and you should be proud. #
- OK, back to the fun part. I got some more Drumkit to write, yes, I do....#