The Amazing Benefits of Exercism

Share Button

A couple of months ago, a good friend at work (@rodeoclownII) sent out an email (or blog, or Slack message, or something) about exercism.io. It’s a cool little website for practising programming in various languages (currently about 45) by implementing koans, or small exercise problems.

I’ve been working through the Kotlin problems since the start of the year and I’ve found it super useful, so I thought I’d write this quick blog to recommend it to others.

Why I like exercism.io so much

Actor Anthony Hopkins seemingly performing an exorcism with the words "Back to hell, demon!" Probably unrelated to exercism.io

Just to be clear, we’re not talking about this kind of exorcism.

The most obvious benefit of this site is the opportunity to practise using different elements of the Kotlin language and standard library. Being challenged to solve problems which you might not necessarily come across during day-to-day work can lead you to discover parts of Kotlin that are really useful but which you otherwise might not have found a need to go looking for. Also, the problems are all implemented in a test-driven way, which feels very natural for me as a long-time practitioner of Extreme Programming/TDD.

By far the biggest benefit of using Exercism.io, though, is the opportunity to learn from others. Once you complete a problem and submit it back to the site, you can see the solution of every other person who’s ever solved it. I’ve made it a habit, every time I complete a problem, to review the solutions of the previous 7 people who’ve completed it, as well as those of other Tyro devs using the site. By doing this, I’ve learnt far more about Kotlin from reviewing other people’s solutions than I have from just solving them myself.

Finally, there’s also the opportunity to help others out. If you see someone has written a solution that could be improved, either slightly or massively, there’s a comment stream for each solution where you can make suggestions or ask questions about other people’s code. You can also hit ‘Looks great!’ on someone’s solution if you just really like it. I’ve found the community isn’t super-active, but the people on there are typically helpful and supportive if you engage with them.

How to use exercism.io to help you learn Kotlin

There’s a number of steps for getting up and running with Exercism, but it’s actually really simple:

  • You need a GitHub account in order to join/login exercism.io.
  • If you know of a ‘Team’ that you want to join on Exercism, you should search for it and join it straight away. If you don’t know of a team you want to join, think about creating one. You could make one for your work colleagues, university friends or any other community of developers you’re a part of.
    • The point of Teams is that there’s a separate “feed” for activity in the group, so through our Tyro team we can easily see what solutions other colleagues are submitting and review and comment on them.
  • There’s a command line client. Install it & configure it as described. Easy.
  • It’s probably good to browse the rest of the instructions and follow them.
  • Run: exercism fetch kotlin
    • This will download a new Kotlin/Gradle project to your machine, which you can open in IntelliJ.
    • The project contains JUnit tests. Most of the time they don’t compile because there’s no code in src/main, but it’s easy enough to create a stub class/object/method and run the tests.
  • Make sure you read the problem description page. It describes the problem in English rather than in tests, and from time to time it contains details about how the implementation should be done or extra requirements that aren’t expressed in the tests.
  • Write code until all the tests pass.
    • I’ve found solving a problem usually takes between 10 minutes and 1 hour.
  • Submit your solution with: exercism submit <project-dir>/src/main/kotlin/*
    • This command prints out a link to the page where other people’s solutions are. Go there and review some alternative solutions!
  • Fetch the next problem and keep going.

Some other thoughts

At first, Exercism is a little bit addictive. It’s easy to get through 10-15 exercises in the heady excitement of the first few days. After that, it can start to get a little tiresome if you just try and hammer through them as fast as possible. I eventually decided to make a plan to try and do about one every day or two.

I also found that, as I got further along, the hardness of the problems plateaued a bit. That made me wonder if perhaps I wasn’t learning as much from each new problem, and I think that might be the case. However, I still think there’s still value in doing slightly varied repetition to really drill in the skills that the exercises are teaching, especially as I’m reading about Kotlin alongside this practice and finding new tools to try out (more on that at the bottom).

It’s probably also worth noting that all the problems I’ve implemented so far (over 40) are of a particularly type, i.e. write an algorithm that takes some small amount of input from memory and produces some small amount of output in memory. If you’re looking to learn something else about the language/libraries – like how to use files, or handle large amounts of data, or persist to a database, or answer a web request, or process using multiple threads (the list goes on!) – you’ll probably need to invent your own practise projects to work on those skills. (Exercism accepts submissions of new exercises, so if you create some of these, it’d be great if you’d share them with the community!)

Finally, while this site is great, I don’t think it’s a comprehensive way to learn Kotlin. At the same time as working through the Exercism problems, I’ve been systematically reading my way through the excellent Kotlin docs – first the language reference and then the stdlib API – learning many things that I wouldn’t have discovered just by practising code and looking at other people’s code on Exercism. So it’s great for ensuring you’re doing the “practice” part of learning, but you’ll need to be reading about Kotlin as well to really get a handle on its full capabilities.

Image credits:
‘Practice’ by Nick Youngson CC BY-SA 3.0 Alpha Stock Images

Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *