Beef Up Your Skills with Code Exercise

Just as those who want to get in shape might not have the time or inclination to train for a marathon, programmers who want to sharpen their skills might seek an alternative to slogging through a dense textbook or taking a full course. Likewise, many developers may have missed some of the fundamentals early in their career. I had found myself in this position a few years ago…

I’d been learning programming on the job, and was learning plenty about application development but very little in the way of computer science. Basic concepts learned in most CS curriculums, and algorithms considered “common knowledge” were largely out of my domain. Trying to bolster my skill set by reading canonical texts wasn’t going to happen thanks to my short attention span in the evening, and taking an online course just seemed like overkill (not to mention the cost). Luckily, many sites have popped up over the past few years to solve my problem exactly. Over the course of a few months, I found several ‘coding practice’ resources that meet the following criteria:

  • Interactive – you write code instead of reading about it.
  • Fast Feedback – know if the code you write is correct or not.
  • Discrete – exercises are independent of each other, and can be completed in a short amount of time.

With the above criteria met, it was relatively easy to set up a training routine to strengthen my weak spots and stay interested enough to keep at it for a long period of time. Below is a rough guide to coding exercise resources, with increasing intensity, that should appeal to beginners and experts alike.

A Relaxing Warmup

Code Koans are an easy way to get started with a code exercise routine. A Koan is a mental exercise intended to stretch the mind, often in the form of a question with no concrete answer. Most code koans are packaged as a group of failing unit tests, and it’s up to you to write the necessary code so that the tests pass. Code koan sets can be found for a variety of languages, usually for free.

The Neo Ruby Koans website is popular, and gives a good overview of the concept. Clones of the project can be found around the web, and a decent JavaScript Koan project is available on GitHub.

To get started with the JavaScript Koans, clone the repo (or download all the files if you don’t use git) and open the jskoans.html file in a browser. You should see some text instructing you on which file to edit. In this case, the first koan is available in the /topcs/about_asserts.js file. Opening that file, and filling in the missing bits of code will allow the tests to pass, and complete the koan when you refresh the jskoans.html file in your browser. See the image below for 2 of 3 tests passing for the first koan.

JavaScript Koans

The koan projects generally focus on basic syntax and language concepts, and provide a good review for experienced developers, or a nice introduction for those looking to learn a new language.

For some actual problem sets that can be downloaded and solved in a similar manner, take a look at the warmup-exercises project from Jumpstart Lab. The project is a collection of test driven challenges that get progressively more difficult, and can also be implemented in a variety of languages. Instructions for getting started with each language are available in the README.

A Simple Routine – Practice and Repetition

Similar to doing some calisthenics in the morning, or some yoga before bedtime, coding challenges allow you to get bit-sized practice on your own time. Many sites have popped up over the past few years that offer collections of programming practice problems. Some sites, such as the formidable Project Euler, are simply a series of questions with a text input prompting you for your answer. Newer sites, however, provide many advanced features such as an in-browser IDE, point systems, leaderboards, hints, and discussion forums for each problem.

My current favorite coding challenge site is Codewars, which opened up from private beta last year. The whole site has a pervasive martial arts theme. Code challenges are referred to as katas, and gaining experience moves you to the next kyu. The list of katas is constantly growing, as submitting your own kata is another way to earn experience. The gamification aspects of the site add to the interest, but the slick interface, well-organized challenges, and lively community make it really worthwhile. Currently, Codewars is limited to JavaScript, Coffeescript and Ruby, but more languages are planned.

codewars

Another very interesting code challenge site is Hacker Rank. It lacks the stylistic flair of Codewars, but also sports a great user interface along with plenty of well curated challenges. The main drawback (for me) is that JavaScript is not an officially supported language for solving the problems on the site. Challenges can be solved in BASH, C, C++, Java, C#, PHP, and Ruby.

hackerrank

There are a couple other full-featured challenge sites that look interesting (but I haven’t personally tried). Coderbyte offers challenges, Q&A forums, and the occasional competition, and supports JavaScript, Python, Ruby, PHP, C++, and Java. It has a nice built-in IDE and test-runner, but lacks a few of the bells and whistles of the previously mentioned sites. Code Chef is a coding challenge site that offers its services to educational institutions as well as casual programmers. The site is starting to look a bit dated and only supports C, C++ and Java, but has a ton of content and a very active community.

A few other sites worth exploring are:

  • CodingBat – Simple, friendly layout with a nice problem set for Java and Python.
  • Project Rosalind – Challenges intended to teach bioinformatics algorithms. Also has an introductory Python problem set.
  • Project Euler – I only mention this because of its overwhelming popularity. There is no interactive IDE, and most of the problems are computation/mathematics oriented, but it has a huge following and you’ll get some street cred for finishing more than a few problems.

Pushing the Limits

If your competitive side starts to tingle, and internet points and leaderboards aren’t scratching the itch, then it may be time to up your game and enter an actual contest against real, live people that can earn you actual rewards. I can’t say that I’ve participated in any of these competitions, but am definitely intrigued by the prospect.

  • TopCoder is one of the more well-knowns contest sites and offers cash prizes for many of its tournaments.
  • Hacker Earth collects challenges from various corporations and provides winners with potential job offers (including Adobe).
  • The above-mentioned HackerRank also has a contest section sponsored by various companies throughout the year.
  • Facebook hosts its own coding challenge site, where the top contestants are considered for jobs.
  • Every now and then, Google has a ‘code jam’ that doles out a big cash prize for the winner.

If you are the competitive type, and have exhausted the supply of coding challenges, then push it to the limit and make all that hard work pay off!

Cooldown

It’s important to remember to take a break and relax, shut off the computer, and enjoy something completely outside of the realm of code. Burnout is real, and can happen to the best of us. Even professional athletes factor in plenty of rest into their arduous routines.

Of course, there are various and sundry methods to advance your programming skills, and completing coding challenges is one path out of many. It’s been fun for me, though, and now I can traverse binary trees with confidence. Now excuse me while I work my way to the next kyu.

Previous

Roll Your Own Asset Pipeline with Gulp

Rethinking DOM Traversal

Next

Comments are closed.