loading...

Getting started with code mindfulness exercises

thejessleigh profile image jess unrein Updated on ・1 min read

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

pic
Editor guide
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
brandelune profile image
Jean-Christophe Helary

Tell your friend business partner to come to Japan and absorb what the term "kata" means so that she can go beyond the "disrespectful".

kata is a term used in a variety of contexts and it's use in the martial arts (sports) context is just an extension of it's original meaning.

かた 【型, 形】
1 【原型】
【ひな型】a model;【鋳型】⦅米⦆a mold, ⦅英⦆ a mould;【型紙】a pattern;【歯型】an impression.
▸ 鉛を型に流し込む
pour lead into a mold.
▸ 洋服の型を取る
cut [make] a (paper) pattern for a dress.
▸ 石膏(せっこう)で胸像の型を作った
I made a model for a bust in plaster.

2 【スポーツにおける動作の形式】
a form.
▸ レスリングの型を覚える
learn forms of wrestling [wrestling forms].

3 【様式】
【タイプ】a type;【スタイル】a style;【パターン】a pattern;【自動車などの年式】a model.
▸ 1987年型の車
a 1987 model (of a) car.
▸ その時計は新しい型だ
The watch is (of) a new type. (!be の後では of はしばしば省略する)
▸ 帽子の最新の型はどんなものですか
What are the latest hat styles [styles in hats]?
▸ 彼女の考え方には一定の型がある
There's a pattern in her way of thinking.

4 【慣例】
a convention;〖定型〗a stereotype.
▸ 型を破る
break [(無視する) disregard] the convention.
▸ 型にはまった言い方
a stereotyped [a conventional] expression. (⇨型通り, ⇨型破り)

5 【形状】
a shape.
▸ V字形の指輪
a V-shaped ring / a ring in the shape of a letter V.
▸ 卵形の顔
an egg-shaped face.
▸ 形がくずれる (⇨型くずれ)

6 【大きさ】
▸ 大きな型の冷蔵庫がほしい
I want to buy a large-sized refrigerator.
型落ち
an old model.

So, in the context of code, the term "kata" has all its use and unlike what the tweet your friend quoted has no "orientalist" or "appropriative" connotation, because it is ok to use foreign words when you think your language does not carry a specific meaning. Besides, Japanese people do that all the time :-)

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.

Thread Thread
brandelune profile image
Jean-Christophe Helary

Well, I really apologize for the "friend" vs "business partner", for some reason I had read "friend". Sincerely sorry for that.

The way I worded my reply was not the most appropriate and I apologize for that. The thing is that I have seen a lot of martial artists (Japanese or not, diaspora or not) appropriate a lot of Japanese culture and create cultural artefacts that have not much to do with what Japanese think of themselves (or would think of themselves if cultural extremists were not all over the place, as it is to often the case here), hence my badly worded reaction.

Thread Thread
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.

Thread Thread
brandelune profile image
Jean-Christophe Helary

For context too, I've done (and I'm still doing) my share of MA katas (I started kendo 30 years ago, I came to Japan 20+ years ago but I'm just a normal "dad" with bills to pay and sadly not much time to practice whatever kata I'd like to, as a foreigner, in a foreign language etc.)

I do have issues with the term "disrespectful" in general. The term is too often used in situations of unequal power and often (but not always, we agree) by the ones who detain symbolic power in the field. I'm in fact actively teaching disrespect (of which I am often the target, by design) to my kids because of the above: unquestioned "respect" never leads to much good. If all the slaves in the world had remained respectful of their masters, the world we live in would be even more messed up that what it is...

And I was nervous too when I read your reply :)

Thread Thread
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
kaelscion profile image
kaelscion

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???

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 ;)