2023-04-14
- Woke up this morning and felt a bit lost. Some days are like that I guess. It’s interesting to get older. One of the most interesting things, so far, is that the things your parents would tell you about being an adult start to make a lot more sense. These days I think about them telling me that it’s important, on some basic level, to enjoy what you do. They were clear that it’s not so much that you need to feel deep passionate love for the activity/hobby/thing you’re doing, but it’s important to find it basically enjoyable. Because at a certain point, if you don’t enjoy it, you’ll realize that you don’t really have time for that thing anymore. You’ll just go do other stuff that seems more fun. In my somewhat younger days, I thought that I would be “tough enough” to endure things I don’t enjoy and that thus I could “do anything.” This is similar to the thinking described in the cliche of the investment banker that hates their job but does it for the money. What happened to me is
that as I got older, I realized there’s no actual prize for being “tough enough.” You mostly just end up with a story about your great endurance of suffering. But that begs the question…do you want this story? What was the point of being “tough enough,” originally? To be able to “do anything,” aka be able to do whatever you want. Well, why not just go do the thing you want? That’ll probably involve some amount of toughness and endurance in any case, and at the end you will at least have spent your time doing something you enjoy. And so, waking up today in a world that I built for myself in large part around being a certain kind of “tough,” I’m feeling a bit lost. Interested in exploring more of what I enjoy, while also a bit scared of changing too many things too fast, and then being even more lost. Kind of a tough spot.
- I recently saw a tweet from John Carmack about programming that resonated with my experience. Carmack wrote about the DRY principle, and how he had increasingly moved towards a programming style/approach that allowed for some amount of duplication in logic. He noted that DRY is often taken too far, resulting in mountains of abstraction that make it harder to understand and modify code vs duplicating logic in a handful of places. What’s cool is that I find myself in the same boat as Carmack here. I used to spend a lot of time figuring out ways to share logic that was ultimately duplicated in only two spots. The problem is that this approach ignores another important programming principle: You Ain’t Gonna Need It (YAGNI). In general, YAGNI is about striving for simplicity. For example, applying YAGNI would lead you to postpone adding extra configuration params to a method when that configuration is not immediately needed (e.g. you anticipate you will need it in the future,
just not today). When I was earlier in my career as a programmer, it was hard to see how DRY and YAGNI would come into conflict. But after writing enough code where I tried to maximize DRY, only to introduce abstractions that made it harder to reason about the code later, it has become clear that the abstractions associated with DRY are a kind of overhead that should trigger YAGNI concerns. Now, I figure it is substantially better to repeat logic multiple times before extracting anything, because adding another layer of code is often something that doesn’t pay for itself (aka “you ain’t gonna need it”). It’s really cool to see a person I consider a real expert programmer has arrived at a similar conclusion.
Date
April 14, 2023