Restructuring Anjin

Week 17 •

Anjin went through some big changes this week, so let's talk about 'em!

Kata

Last week, I wrote about how generating exercises was a slow process and resulted in very similar exercises being generated over and over again. The solution I came up with was to rework exercises to "kata".

Kata is a term used in martial arts to describe a series of movements that are practiced over and over again. The idea is that these movements become second nature, and can be performed without thinking. The term's been adopted by the programming community to describe a similar concept, where a programmer practices a series of exercises over and over again to improve their skills.

The "kata" in Anjin are a set of exercises attached to a goal. Intead of exercises being generated on the fly, they're created on the goal as a kind of template that can be completed many times. The completion data has been pulled out of the exercise itself into a "kata completion", which is a record of a user practicing a single kata.

This change means that the exercises are now generated once and can be completed many times, as a kata should be. For example, for my "Learn Piano" goal, I have a kata called "Practice Scales" that I can complete many times. Kata can have an optional guide attached, as well as a template for the completion notes, so the user has a starting point for their reflections during each completion.

ImageKata list on a goal

Completions

The record aspect of exercises have been moved into "kata completions". Instead of a user recording their progress on the exercise itself, they create a new kata completion for each time they practice the kata. This new object holds the time spent, notes (pre-filled with the kata's notes template), and an optional enjoyment rating on a scale of 1-4.

This allows the user to see their progress in a kata over time and creates a kind-of journal for both the kata and the goal it's attached to. The user can see how much time they've spent on a kata, how they've felt about it, and review notes from previous completions.

ImageKata completion form

Challenges

The third concept I introduced this week was "challenges". Challenges are a daily, rotating set of kata that the user can complete for stars. The user has three challenges each day, which require a specific kata to be completed for a specific period of time. The time required is random for now, but I'm considering making it a setting (e.g. "Easy" would be one 5 minute kata, one 10 minute kata, and one 15 minute kata)

The "stars" aren't actually in yet, and resetting challenges is done with a button instead of automatically each day, but the concept is there and working well. The idea is that the user can only earn stars by completing challenges, so if they miss a day, they miss out on the stars for that day. I played with the idea of having them act more like bonuses, but I think tying the challenges to a specific reward will make them more engaging.

ImageChallenges on the dashboard

Practices - A Failed Experiment

The first iteration of the kata concept was a little more complex, with a "practice" object holding several kata to be completed in sequence. The idea was that a practice would provide a structure and each "slot" in the practice would be pulled in from a pool of kata. For example, a "Learn Piano" practice might have slots for "Warm Up", "Song Practice", "Scale Practice" with a pool of kata for each slot, holding specific warmups, songs, and scales.

I liked the idea of a kind-of card game, where you draw a single kata for each slot to create a structured practice. It ultimately felt overly restrictive though, so I simplified the model so that the kata just exist on a specific goal, with no intermediary "practice" object.

I like the concept of longer, structured practices, but the goal of Anjin is to provide a simple tool for getting the user to make progress on their goals in a way that's easy to understand and use, so I've tabled the practice concept for now.

Wrapping Up

There were a few other things I worked on this week, like cleaning up dead code and improving the data management in the client. I also started designing an API layer, so I could eventually have separate clients for mobile. That's still in the early stages, through.

Over the next week, I'd really like to solidify the data model and re-introduce the AI workflows when a user is creating a new kata (currently it's just a form). I'd also like to get the stars system in place and work more on the API and getting the app into a deployable state. While I'm happy with the progress on the model side, I'll feel a lot better about the project when I can actually use it in production.

See you next week!