Beef Up Your Skills with Code Exercise
The modern web is always changing, and this article is more than two years old.
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.
/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.
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.
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!
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.