Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As much as I agree with a lot in this article, I totally don't understand the "Code Kata" thing promoted by Uncle Bob Martin and others. I understand drilling a specific skill in the arts, but writing the same piece of code over and over just makes no sense at all (and yeah, his example was solving the "Bowling Score" problem every time).

So, anyone do code katas and like/recommend them? If so, what does it teach you? Do you do the same problem over and over, or tackle different problems?



I don't personally do katas, but I would recommend them. As a disclaimer, I've written a research paper on the use of typing exercises to help learn CS [1]. For typing exercises, I consider it akin to building muscle memory at getting comfortable with code syntax with a variety of examples. I look at katas in a simple fashion, small scale problems designed to get you comfortable with building mental models in your head. There is also research out of Utah on giving super small coding drills with good results [2].

When it comes to teaching it, the biggest hurdle is that you need to build a lot of small, unique exercises. This is still drilling, just now focusing on making the techniques flexible to different problems. I use the analogy of drilling technique in martial arts, but you could consider that training with a different partner to understand how the technique works with a new body type. The trick I've found useful is to collect a number of textbooks to review when thinking up practice ideas. If the textbook is good, it typically has "real world" examples modeled with the topic - for example, one I built the other day looked at creating bigrams from a list of words.

[1] https://dl.acm.org/doi/10.1145/3373165.3373177

[2] https://dl.acm.org/doi/10.1145/3372782.3406259


Interesting!

There's a SaaS that let's you do this https://typing.io/


There are a few that have adopted typing practice with code (https://www.speedtyper.dev/ is another one). I think they focus a little too much on training your typing speed rather than helping expose new concepts/examples without making them coding problems.

Either way, yes, practicing code writing without solving coding problems does help learn CS concepts. I conceptualize it as some of the issues with CS/coding comes from "analysis paralysis" where you don't know what to do and even though you were told "use a loop", you don't really know what that means or are still struggling to know how to implement a loop. Drilling these lower level practices helps reduce that by saying "let's not worry about problem solving for a second, let's just focus on you getting comfortable with implementation". Then, there is less hesitation because the student knows "use a loop" means write out the syntax for the loop, THEN figure out what you want to loop.


Why is a simple typing tutorial webpage forcing me to sign in with Google? This is ridiculous.


Excellent! I really like the idea of doing a lot of small, unique exercises. Even something as simple as, "Okay, you built a linked list of integers, now start from an empty file and write a linked list of floats, then do the same for structs (which is going to add some interesting complexity)."


Take a look at my [2] link then (Google Scholar or ResearchGate have the PDF without a paywall)! John Edward's group out of Utah made ~30 small exercises exactly like that. "Make a loop the goes to 3", now "Make a loop that goes to 4", now "Make a loop that goes from 2 to 4", ok now "Loop from 4 to 1", etc.

And from my own work and Edwards, students enjoy these types of practices. They seem trivial to us experts, but they are appreciated by novices.


I don't know why anyone would repeat the same code multiple times, but I have found that practicing leetcode does actually improve code skill, even when the coding job doesn't have any complex algorithms. Just the practice of solving the algorithm has carryover to normal work problems, which would make sense as it's basically distilled code logic practice.


Many coding challenges are great drill work: but if you can, have your code read by someone else to ensure you're practicing how to write readable, maintainable code.

Leetcode solutions seem to be regularly "golfed" into being unreadable and intractable. Don't practice that!

At least in my experience, well-defined and functionally isolated coding challenges rarely happen at work, though.

Another skill you'll need to hone is listening to your userbase/business partners and translating what they're saying into actual specifications.

Doing this adequately is a prerequisite to success.

Doing this well (hearing what they need, separating the "need" from the "how", and being imaginative in what a clean implementation would look like) can both reduce what work is needed now, and set up future success to be more likely.


> Leetcode solutions seem to be regularly "golfed" into being unreadable and intractable. Don't practice that!

AMEN!


Oh yeah, I can definitely see doing a lot of small, not-necessarily-easy challenges as a way to improve. Even doing the same one, but in a different way ("now use an array instead of a linked list") would be good.


I dont like them per say, but they worked for me when I had to learn data structures and algos under a lot of pressure. What I noticed (and what I tell my students now) is that they can help you get to a point where you get enough muscle memory to start to watch yourself coding in real time and think critically about what you're doing when your doing it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: