DEV Community

jess unrein
jess unrein

Posted on • Updated on

Getting started with code mindfulness exercises

EDIT: due to some really interesting comments below, I've decided to replace references to katas with mindfulness exercises, since kata can border on cultural appropriation, and, despite being widespread, is not the most descriptive term for the practice. :)

I feel like I've been hearing people talk about code mindfulness exercises a lot lately, and I think I understand what they are. Here's what I gather: it's an exercise that you repeat every day without looking at your previous work. The flow goes something like this:

  1. Code the same thing over and over again
  2. ???
  3. Profit

It seems like a form of code meditation. Am I off base here?

Do you intentionally practice code mindfulness? Have you done exercises in the past and then stopped? What did you get out of it? What's a good exercise to start with?

I feel like this is an interesting concept but I don't have a clear entrypoint, especially since no one on my team or in my circle of friends and mentors practices this form of code practice.

Discussion (10)

Collapse
bhaibel profile image
Betsy Haibel

Code kata is a really misleading name, is part of it. Misleading and... kind of disrespectful? My business partner does martial arts very seriously and she hates the term. She goes into why a bunch here: twitter.com/jtu/status/10402717419...

Most of the things we call code "katas" are exercises that we're supposed to learn something from. Unlike martial arts kata, the expectation is not that we'll keep doing the same thing over and over. The expectation, instead, is that every time we approach the exercise mindfully we should learn something from it.

When we do code exercises, and then re-do them hours, months, or years later, we're coming to the exercises with new context and knowledge. If it's a well-designed, open-ended exercise, that should also mean that we learn something new every time! That's totally different from the value martial artists get from practicing kata. But it's pretty valuable on its own terms.

Collapse
thejessleigh profile image
jess unrein Author

That's super good to know about it being a disrespectful term. I think it could be a valuable practice, and I want to get into it, but maybe "code mindfulness" or something might be a better term. Thanks for sharing that thread from @jtu!

Collapse
bhaibel profile image
Betsy Haibel

Hey! Speaking of disrespectful: you calling my business partner my “friend” deprofessionalizes that relationship in ways that echo patterns of structural sexism. You saying that an Asian woman is under-informed when talking about the ways Americans are a little weird about Asian culture is... not really what I expected from a community that advertises itself as inclusive. A lot of Asian-American folks have a different response to cultural appropriation than non-diaspora Asians — you might want to do some research into that.

bhaibel profile image
Betsy Haibel

Yeah, that makes sense. I appreciate the apologies! I was nervous about how you were going to react to my reply, and I'm glad that you took it well.

For context, I'm a white American woman. I have some martial arts experience, but nothing impressive -- a few years of taekwondo, and I'm not currently in active practice. Still, enough martial arts experience to be real familiar with the fact that Americans assume "karate words" apply to all martial arts. I can't count the number of times I've had to tell folks that it's not appropriate to refer to a taekwondo school as a dojo. That dynamic speaks to the way non-Asian Americans often, and inappropriately, lump all Asian cultures into one big bucket.

In the context of code "katas", the American etymology comes from folks who didn't have deep experience of martial arts, or of Japanese culture. (Here's a blog post about that history from the dude who originated the term.) They were trying to find a word that meant "mindful practice," and so they wanted to evoke the way that they'd seen kata used in martial arts films. They succeeded -- just look at the other comments on this discussion! I think that that decision was shallow and appropriative, though. It didn't come from engagement with Japanese culture, it came from engagement with American projections of Japanese culture. And it came in the context of other attempts by programmers to use Asian cultural signifiers to jokingly evoke tradition.

I also still think that the word "kata" isn't an accurate or useful term for the code exercises people usually call "katas." They're generally intended to be exercises that you come to mindfully, but solve in different ways. To me, using a term for "mold" carries the entirely wrong implication. There may be nuances I'm missing, but... look at folks' confusion in this discussion!

If the term were accurate, it would be way less problematic! But the ways that the term is inaccurate are really revealing of its appropriative origins.

Collapse
kaelscion profile image
kaelscion • Edited on

I know from a light martial arts background that, at least in that context, a kata is a series of rudimentary motions and moves that you would never really use in a practical situation. But, those movements are the building blocks upon which many practical forms are built. Learn the katas and you've got the fundamentals committed to muscle memory and all other movements will almost come naturally. Perhaps code katas are similar???

bhaibel profile image
Betsy Haibel

That makes sense. For context, I was using "disrespectful" because I've found that, in these kinds of discussions, it's sometimes more useful than "appropriative." Since "cultural appropriation" is kind of jargon-y and has a lot of baggage attached to it, I find that using "disrespectful" instead often conveys my meaning more clearly.

That obviously wasn't the case with you & I'll take that perspective into account in the future.

For what it's worth, I do a lot of "teach the teachers" in terms of helping other senior developers be better mentors. When I do that, I stress the importance of making mistakes and admitting ignorance in front of junior devs. In my experience, that creates an environment where junior devs feel a lot more comfortable pushing back and asking questions. So I think we're aligned where unquestioned respect is concerned.

Thread Thread
thejessleigh profile image
jess unrein Author

I've gone ahead and edited the post to talk about code mindfulness exercises or practices instead of katas, because I think at the very least, kata is not a useful term. The idea can be expressed more explicitly and be less fraught in the process.

Thanks both for your perspectives. This has been a really interesting and enlightening discussion!

Collapse
ben profile image
Ben Halpern

I’ve never been able to get into katas. So if you’re unsure about the whole thing, you’re not alone!

Collapse
rhymsy profile image
rhymsy

Sounds very Mr Miyagi, wax on wax off... :) I get it, eventually it sticks in without you having to look it up. After a while of repetition, you might see a better way to do so. Enlightenment ;)