Search This Blog

Sharpen Your Programming Tools

Programming is like any other craft, whether that be engineering or woodworking or auto repair. Every craft has its tools that must be learned and maintained in order to do beautiful work and make wonderful things. In the craft of programming, one of the main tools we work with is programming languages. The more languages we know and the better we know them, the more versatile and valuable we can be as programmers and the better our solutions become. Fortunately, it's extremely easy to find websites to help you practice with programming problems and build up your skills with the languages you already know or bring you up to speed on languages you're trying to learn. They're so easy to find that it may be a bit overwhelming to pick one and settle in to actually work on some problems. Here are some of my favorite (free) sites—and why I like them—to help simplify that decision.

Monoglot Programming Puzzle Sites

These sites focus primarily or exclusively on one programming language. They tend to be great for getting started in that language or practicing the basics of a language that you're not that strong in, yet. However, they can also go deep into their chosen language because of the focus on a single language.

RubyMonk

RubyMonk screenshot

RubyMonk is a nicely designed site that introduces Ruby and leads you on a journey through the language's various features from objects to metaprogramming. It's part tutorial with explanations of all of the language concepts that it covers, and part practice with additional exercises to solve after you've read the material. Throughout the tutorial are lines of code that you can run to see what they do, and other places where you're asked to enter your own code to accomplish certain tasks to participate more in the lesson. These input areas also act as scratch pads where you can experiment with the Ruby language to your heart's content. It's a great, interactive way to learn the language, and one of the better implementations of this concept that I've seen. I particularly enjoyed the Zen master and apprentice theme throughout. It was quite calming and relaxing, making for a pleasant learning and practicing experience.

Ruby Koans

Ruby Koans screenshot

Continuing with the Zen theme, this Ruby practice site takes you away from the internet by having you download a set of files that are set up as Ruby test files. After making sure that Ruby is installed, you simply run each file in Ruby and see what the output looks like. It will tell you how the first test in the file fails, and then you have to go and fix the code to make it pass. You continue in this way along the path to enlightenment. It's pretty slick, and the progression of the problems was well thought out and nicely done. Whereas RubyMonk has the advantage of having everything work in the browser, Ruby Koans has the advantage of making you work in a more realistic programming environment, and its focus on the testing culture of Ruby is an added benefit.

The Python Challenge

Python Challenge screenshot

This is probably the most clever of the sites in this list. The Python Challenge starts off with a couple fairly simple puzzles, but then quickly ramps up the difficulty level. For each puzzle you're given an image with a clue, and you have to figure out how to edit the URL to advance to the next level. This set of puzzles is extremely entertaining. I felt like Indiana Jones, or maybe Benjamin Gates from National Treasure, while trying to solve these puzzles, putting the clues through different Python functions and coming up with different ways to manipulate them in order to find the right next step. The site even helps you out with extra hints when you're on the right track but haven't fully solved the puzzle, yet. It's very well done, and I highly recommend giving it a try. Don't go looking for how to solve the problems, either. It's much more satisfying to do it yourself. Like Ruby Koans, you're own programming environment is required.

4Clojure

4Clojure screenshot

This site is a straight up problem solving site for the Clojure programming language. Each of the 156 problems has a set of tests that should pass if you fill in the right code in the editor and run the tests. The output when your code fails is pretty sparse, so you'll either need a local Clojure environment or an online REPL (the link on the site is dead) for debugging and experimenting. The problems range from simple fill-in-the-blank problems for learning syntax to fairly difficult mathematics and algorithmic problems. Once you've solved any given problem, you can look at how other people have solved that same problem, but only for people that you've followed on the site. It's easy to choose a dozen or so people that have solved all of the problems from the site's Top Users list, and scanning through others solutions is a great way to learn new tricks in any programming language. We'll see this feature pop up in a number of the other sites here. I especially liked 4Clojure's simple, clean interface and the nice set of puzzles they have to solve with a good range of difficulty for learning the language. They do have some bumps in the road, with some problems seemingly out of logical order if you proceed through them numerically. Some earlier problems require syntax and functions that you learn about in later problems. The elementary, easy, medium, and hard problems are all mixed together, too. But, for the most part it works well, and solving the medium and hard problems was quite satisfying.

99 Prolog Problems

99 Prolog Problems screenshot

If you want to try your hand at Prolog, this is a great site for doing just that. I would imagine these problems could be solved in a similar manner in Erlang and possibly Elixir as well, but beyond that, we're probably getting too far from a logic language for the problems to be the kind of challenge that they were intended. Come to think of it, miniKanren—a logic language built on top of Clojure—may also work here. Anyway, this is a great set of problems for buffing up your logic programming skills with a nice progression in material and difficulty, and there are solutions for if you get stuck or just want to see if there was another way to solve the problem. It's another bring your own programming environment site with just the bare-bones problems and solutions provided. The meat of this site is in the problems themselves.

Polyglot Programming Puzzle Sites

These sites allow the user to solve problems in numerous different languages, sometimes any language they want to use is fair game. The nature of these sites tends to focus on the problem solving or puzzle nature of programming as a result, since general problems can be solved in any language.

Ruby Quiz

Ruby Quiz screenshot

Okay, what gives? I say this is going to be the polyglot section and the first site I list is another Ruby site. Well, Ruby is in the title, but it's not at all restrictive. You need to use your own programming environment, so you can solve the problems in whichever language you want. The solutions on the site are given in Ruby, but the result of running the program for each problem is known, so you'll know when you've got the program working in any other language. What's nice about these problems is that they're more like miniature real-world programming problems instead of the standard textbook exercises of most sites. This site was run with a new problem once a week for three years before switching management over to a different person and a mailing list, so there are 156 problems here to solve. That's still enough to stay busy for quite a while, so have fun exploring the standard libraries of your favorite programming language to efficiently solve these problems.

Codewars

Codewars screenshot

Codewars is one of the more fully-featured sites on this list. It has huge sets of programming puzzles, called kata, for about 20 different languages, and the number of kata is constantly growing because users can submit their own kata for others to solve. The kata are ranked by difficulty level, and you get different amounts of experience for solving different levels of kata. There are no specified tracks to the kata; it's somewhat arbitrary what order you'll solve them as you're free to choose the next kata at every step. As you gain experience, or honor, you advance up the ranks from 8kyu to 1kyu. It's a nice gamification that keeps you going to solve more kata at higher difficulty levels, if the challenge and satisfaction of solving programming puzzles wasn't enough already. In addition to the huge selection of puzzles, you can look at other users' solutions, and discuss them through comments on the site. It adds a nice social aspect to the puzzle solving as long as you can keep the conversations civil, as we all should do in programming debates.

Exercism.io

exercism.io screenshot

Exercism.io is similar to Codewars in that it supports a ton of different languages, and there's a social aspect to looking at other users' solutions and commenting on their code. Here it's encouraged to critique other people's code in a constructive and respectful way in order to try to help your fellow programmers improve their skills. Through your analysis and others critiques, you should also improve. It works pretty well, too. Compared to Codewars, there's less puzzles for each language, although more are being added all the time, and Exercism.io takes a serial approach to solving the problems. It's also done offline rather than on the website, so you'll download a little script to get started that pulls down the first problem for whichever language you want to practice. You solve the problem in your own environment, check it against a set of tests, and submit it with the script from a terminal. Then you can go on the site and review other people's solutions. It's a different way of doing what Codewars does from your own computer, and it works surprisingly well.

Project Euler

Project Euler.net screenshot

This puzzle site is the essense of a programming puzzle site. The problems are simply math problems that you could solve by hand, if you wanted to, but trust me, you don't want to. Take the first problem as an example: Find the sum of all the multiples of 3 or 5 below 1000. I could calculate this answer by hand, but honestly, I'm going to write code to do it. You can pick any language you want of course, and when you've solved it, just submit the answer to the site. Your time from seeing the problem to submitting the solution is logged, and you can go to the forum for each problem to discuss it and see how others have solved it. Many problems aren't even solvable on a computer if you just try to brute-force a solution. They require additional thought to make the code efficient enough to solve the problem before the Earth gets swallowed up by the Sun. On the other hand, there are some problems for which closed form solutions can be found, so keep your eye out for those! This is a challenging and engaging site, and it's ever so satisfying to solve a particularly difficult problem in an elegant way. They're always adding more problems to the list, too. It's currently up to 683 problems, so get crackin'!

Programming Praxis

Programming Praxis screenshot

This site is a running list of programming exercises with new ones added on Tuesdays and Fridays every week. The exercises are intended to be solved with Scheme, and that's the language the solutions are given in. But of course you can solve the exercises in any language you like. This site has been going strong since 2009, so there's plenty of exercises to choose from. The chronological list only goes through 2013, with 491 exercises there, but they keep going after that, up to the present day. You can either go back through the history and try to solve them all, or use the site to consistently practice the most recent exercises starting today. Either way, there's a ton of stuff here to keep you busy and help you improve your programming skills in any language you want.


Well, there you have it, ten of my favorite sites for sharpening your programming tools. They run the gamut from introductory tutorials for specific programming languages to huge lists of fun, challenging puzzles for any language under the sun. There are tons more sites like these out there, probably many more great ones that will help you become a better programmer. The important thing is to find a couple sites that have engaging enough puzzles to hold your attention and help you level up your skills, and keep at it. Putting in that effort will noticeably improve your programming abilities in addition to being rewarding in its own right. I know I'll be working (playing?) through a few of these sites for a long time to come.

No comments:

Post a Comment