Coding Practice

The best way to learn anything is to do it and coding is no exception and the best way to get better at something is to practice. Try it, learn by making mistakes and the apply the knowledge gained to improve. Coding exercises allow you to do all of this in a safe way. There are many sites available, but there are a few I have used in the past 12 months that I would like to highlight in particular. This is not just for beginners, experienced Software Engineers have much to gain by testing and challenging themselves in unfamiliar domains. It’s also a great way to learn a new programming language.

Codingbat

https://codingbat.com/

A great place to start. The problems start quite simple but will give you a very good grounding in the core basics. There is an online editor for Java and Python where you can submit your solutions and get immediate feedback. Your code is run against a predefined suite of tests, so you can see which ones have passed and failed instantly. As this doesn’t use an IDE, there is no syntax highlighting or auto complete, while this can be considered a drawback, on the flip side it provides a way to test your ability without relying on hints from the IDE, further solidifying your knowledge.

Codility

https://app.codility.com/programmers/lessons/

This one is a bit more challenging, so it will give you more of a workout.  There are a number of lessons focusing on a particular theme, each increasing in difficulty. They are graded, but don’t let that influence you, it all depends on your past experience. I do find that the more of these types of problems you do, the better you get at them as you slip into the mindset for the problem domains, which is why it’s always good to mix it up every so often and expose yourself to a range of different problems.

Again there is an online editor as with Codingbat, but Codility supports a lot more programming languages such as Javascript, Swift, and C# to name but three. You can of course use your own IDE and simply past in the code from that once done.

Problems here are solved against the clock, the first challenge – Binary Gap gives you 2 hours to complete it. You also get the option here to input test cases, which is useful to help you develop your skills to identify test cases from the problem statement.

Some of the problems will measure and test algorithm performance (Big O notation), meaning it is possible to provide a functionally correct solution, but then fail on the performance requirements. This is a good feature to get you thinking in terms of performance, and bottlenecks when scaling up datasets. Although in general beware of the pit falls of early optimisation. More on that another time.

Google Tech Dev Guide

https://techdevguide.withgoogle.com

A recent discovery for me, and I must say I really do like it. Google provide 4 paths, Foundations, Advanced, Machine Learning and Cloud Computing. I have only looked at the Foundation path so far. This gives you a list of 33 items to complete, some are coding exercises (usually links to Codingbat), while others are high quality YouTube videos on a specific language feature. You self-mark each one as done once completed to track progress. There are some former Google Coding Interview questions – Google are notorious for setting tough problems, sometime only allowing you a whiteboard and dry marker to solve.

I found this quite enjoyable so far, and like the fact you can track progress to easily pick up where you left off.

Advent Of Code

https://adventofcode.com

This is a Christmas coding challenge (I know its March), several of my colleagues took part in last year. If you can withstand the Christmas theme in spring, there are some excellent puzzles on this site to solve. You are presented with a problem and a set of input data. You only need to provide the answer, so you can use any language you like. In December a new puzzle is released each day up to the 25th – the advent calendar, with the objective to solve it as quickly as possible. However there are past events from 2015 to 2019 that you can do at your leisure all year round. I used it in December as a way to bolster my Python 3 skills and I must admit to getting somewhat hooked on it over that period. The feature of a private leaderboard also helped provide a competitive edge.

The problems get progressively harder and in the later years they tend to follow a theme with each day building on a previous day’s solution, so clean code and the ability to make changes to the software as requirements change is key.

A few tips…

  • Start by getting something working, you can refactor later
  • If easier, solve the problem in an IDE offline and cut and past the solution in later
  • Schedule some time each week to make it a habit
  • Discuss solutions with others – this a great way to learn, as there are many ways to solve the same problem

And to challenge yourself (experienced Software Engineers)…

  • Think about performance, will your solution scale as the input grows?
  • Use a new or unfamiliar programming language and make use of any language specific features
  • Write it all from scratch i.e. don’t use any in-built string functions for example! 
  • Try solving on a whiteboard only, then test it out when confident