Programming is a superpower.
It’s also a skill. Like riding a bike. Or playing the piano.
If you want to get better at the piano, what do you do?
Practice isn’t something you do once you’re good. It’s the thing you do that makes you good.
That’s right. The way to be a better programmer is to write more code.
One of the roadblocks to this is deciding what to write. Piano students usually have books full of music that they can play, but unless you’re working on some big project, you might not have any ideas of what code you should write to practice.
So, here are three of my favorite websites that you can use to help you practice writing code and become a better programmer:
CodeFights is FUN. Each day a new “coding challenge” is posted, which is a small programming assignment to solve an interesting problem. You can solve the problem in just about any popular programming language, and when you think you have a solution, it will run the solution and test it for you. You can keep iterating until your code passes all the tests.
Just completing the challenge and passing the tests is an accomplishment, but after that is where CodeFights starts to excel: CodeFights turns programming challenges into competitions.
CodeFights has head-to-head competitions, where you race another programmer to find a solution. They have achievements, where you start with simple problems and work your way to tougher ones. My favorite, though, is the contest to complete the daily challenge with as little code as possible.
Once you’ve completed the daily challenge, you can start getting creative with your code and making it smaller. Use single-letter variable names. Eliminate explaining variables. Replace complex expressions with equivalent operators. Find a creative bit-twiddling hack that doesn’t involve variables at all!
At the end of the day, the coder with the smallest program in each language wins bragging rights.
CodeFights is a great way to build your programming skills in a fun, competitive way.
The idea of writing the smallest possible program to solve a problem is often referred to as “Code Golf” (because in Golf, the winner is the person with the lowest score). StackExchange, the parent company of the popular programming site Stack Overflow, has an entire site devoted to Code Golf, and it sees multiple new challenges each day.
While StackExchange Code Golf doesn’t have the same automated testing that CodeFights has, it does revolve around a very fun community, and sees many challenges each day at different levels.
Even if you choose not to write a solution to a posted problem, you can learn a lot just by reading other people’s submissions.
The name is a play on words: Is it “Coding Game” or “Code In Game”? We may never know…
Codingame presents you with an exiting action-based game to play, but the game is missing some code. Your job is to play the game not by moving your joystick and shooting bad guys, but by writing code that will do that for you. (Why beat one bad guy when you write a program to beat them all?)
Codingame gives you increasingly difficult tasks, which you can solve in your choice of many popular programming languages. As you solve more challenges, the game gets more awesome and you become a better programmer. Everybody wins!
There are more sites out there like this, as well as books of programming challenges and many other resources. All of them help you sharpen your programming skills, prepare for interviews and tests, all while having fun at the same time.
(What!? Homework!? I told you, I’m a professor. There’s inevitably going to be homework)
Choose one of these sites and go solve your first programming challenge. If you’re a competitive type (I am), I suggest completing your first CodeFights challenge. If you’re more of a solo gamer type, go check out Codingame. And if you like publishing your code for the world to see, go complete a Stack Overflow Code Golf challenge.
Get more from Professor Jake!
Subscribe to get more awesome smart stuff and take your programming skills to the next level.