Embracing and appreciating your own work
I've been doing Advent of Code this year, not on a fix schedule, just when I get some time. Like last year, I'm using Derw. This isn't a sales pitch on Derw - but for reference in this post, it's a ML-family language that I've been working on in my spare time for over a year now. This post is instead about anything you, the reader, have created, and gotten use out of.
When I did it last year, I was fixing things as I went along - expanding the standard library, fixing compiler problems. This year was noticeably different. I'm able to do things in the way I intended, rather than resorting to workarounds to get things to work. That change was a revelation: working in Derw is now beyond just _possible_, but it's actually natural. My work in dogfooding the compiler (i.e rewriting the compiler to be self-bootstrapping) along with a bunch of projects throughout the year have shown me that Derw is becoming more mature, but a directly comparable experience of advent of code last year vs advent of code this year made it way more obvious. It was no longer whispers at the train station, competing between all the noises, but yelling into a microphone on a stage with an audience of one.
If you've ever made something yourself - a framework, a language, a chair - you'll know the joy being able to use your creation as you intended. To know that your hard work has paid off, and it's no longer an idea floating in your head, but something tangible that you can show others, you feel a sense of pride. And you should be proud! There is plenty of value in ideation, but creation takes a different set of skills and abilities to establish. Many people are able to visualize a chair, and many of those could make a great attempt at building one. A chair that you yourself has made has inherently more value to you than the latest Adde you bought from Ikea. That still doesn't mean it's an objectively good chair in terms of chair design, but it does represent a piece of your life experience.
When it comes to programming, every library or framework is the same: a demonstration of your experience when it comes to API design or implementation. Getting to that point requires the consumption of libraries, the writing of days of code, and the inspiration for how to do something differently. And that same experience, in a couple of years time, will make you feel like your old libraries might not be great or shouldn't be used too. At some point a carpenter will re-purpose wood they spent on their early chairs. So do the same to your libraries: if you can think of an improvement, why not do it? It gets harder when your libraries have actual users, you can't turn a chair into a table while someone's sitting on it, but you can offer them a better chair to sit on. Not everyone will take that offer, though. Stubbornness and complacency are natural. The real gotcha though is when the new chair you're offering is worse than the one the one they're already sitting on. Maybe it doesn't have as much padding, maybe it's complicated to figure out where to put your legs. I don't know, I'm not a chair designer. But as a programmer, I've seen plenty of libraries and languages which make big sweeping changes for visibly few benefits, so it's not a situation totally out of my imagination.
The real test for any creation like this is getting others to start using it. I hope for the next Advent of Code, I will have a guide on how to do everything you need to get started. If anyone out there is interested, feel free to reach out to me on Twitter - https://twitter.com/derwlang, and I'll help you get started.
This is the rough template I'm using for each day:
import "fs/promises" exposing ( readFile )
loadLines: string -> List string
loadLines fileName =
do
fileContents: string
fileContents =
readFile fileName "utf-8"
return
fileContents.split "\n"
logicPartOne: List string -> string
logicPartOne lines =
""
logicPartTwo: List string -> string
logicPartTwo lines =
""
main: void -> void
main _0 =
do
lines: List string
lines =
loadLines "data/DayOne.txt"
console.log (logicPartOne lines)
return
undefined
run: Promise void
run =
main()