Hello again! This is post #2 of my Outreachy internship, and today I’m not gonna talk about pastafarianism.
Instead, I’ll tell you about how to keep your sanity while diving into complicated code, more specifically as it relates to my current work on kubectl.
Like I mentioned in the previous post, I recently started trying to make sense of the kubectl code and it has been ever so slightly just a tiny bit maddening, so let’s get into that.
Without further ado:
…and the problem is that you’re a noob. I mean, beware of what you’re calling spaghetti. Maybe it isn’t.
And the reason I’m mentioning this first is, kubectl is not certified spaghetti or anything like that. There are lots of devs working on it, and I bet things make sense for them.
A lot of it feels like spaghetti to me, but what is that saying… spaghetti is in the eye of the beholder? Yeah. That.
…if you let it.
I mean, to me the definition of spaghetti is when you have an event somewhat like:
You need to figure out some fairly simple, innocuous functionality.
You have 8 different packages open on different IDE windows, each IDE with 20 open files, each file with a code block selected that you absolutely can’t make sense of by itself and that’s why you you were looking into the 19 other files to begin with.
3 there, it will drive you bonkers. It’s hard to keep track of a journey that long, and if you try—and you will—you’ll go nuts.
I don’t really have a solution here. If you try to keep track of things by memory you’ll go nuts. If you try writing down how the whole thing works, 1. congrats on the effort and 2. I suspect you’ll go nuts just the same.
I guess the way I dealt with this was to just stop giving too many fucks to the whole process. No more hundreds of files open to try and make sense of later. No more trying to make sense of every single little thing I came across. So “thrive in ambiguity,” I guess?
Where I’m at right now is, I look at something, if it makes sense → great, if it doesn’t → whatever, and move on.
Good thing I’m not working on a nuclear power plant, you say? Yeah, definitely.
…that it makes no sense.
On the first few weeks of the internship I was feeling pretty disgruntled that I couldn’t make sense of anything. I was frustrated and embarrassed and angry, the whole nine yards.
I mean, spaghetti or not, if I was as smart as I thought I was, I should be able to work things out, right?
So yeah, I felt like shit.
Then one day at a meeting someone mentioned something to the effect that things were organized in too weird a manner and that even the experienced people had trouble with it.
The way my brain heard it was, “you’re fine, it’s the code’s fault.”
If even experienced people were having trouble with it then maybe I wasn’t the useless pile of garbage I thought I was. I mean, if it’s hard for everyone, then I’m not particularly incompetent.
…if you’re lucky.
To me it happened when I was told to check the remains of a tool someone else had made, that it had some functionality that could be useful to what I wanted to do.
Thanks to the prior weeks spent bashing my head against kubectl code, I was already familiar with the whole thing, and the way it worked made sense pretty quickly.
Now while I couldn’t get much done on account of the
spouse-mandated holiday work break, I’m confident I can finally start getting things done.
My point here being, the time you spend banging your head against seemingly intractable code isn’t wasted. Eventually things start to make sense, and then they “click,” and then you can get going. You wouldn’t get there without the part that’s likely to drive you insane, though. It’s part of the process. (Note to self: the part where you think you’re an idiot is not; lose it.)
That’s it for now.
Things are finally starting to make sense. Yay.
Thanks for reading, and I’ll see you in a couple weeks. Next update’s on the 15th!