7 Essential Tips from 300 days learning to code

Photo by Fernando Hernandez on Unsplash

“In January 2019 I made a commitment to learn how to code in Python, a widely used, object-oriented programming language…

…over the last 300 days I have explored many different resources to learn programming, including: coding `gamification` sites; MOOC’s (Massive Open Online Courses); technical documentation, magazines, books, podcasts and video tutorials. No single resource was useful from the beginning to end of my learning journey, but some were great at specific times. Beyond individual resources, I would like to share some learning principles I found helpful, and could be applied to any programming language.

I have a hectic family life, young child, and a full time job. I needed to use flexible, self-taught resources that could fit around an unpredictable schedule. Because of this, any intense “boot-camp” style learning was out, and my real-time connection with other learners or mentors was limited; as I could not predict the time of day I would sit and code.

These time constraints also meant my learning needed to be as efficient as possible. When I explored each learning resource, I asked myself the question: “Is this the most effective way I could be learning to code?”.

I would like to dedicate this article to everyone learning to code: for a new career, to enhance your prospects, or simply for the joy of coding and creating new things.I hope that you find these tips helpful for your journey — good luck!

  1. Make Coding a Habit

“We are what we repeatedly do. Excellence, then, is not an act, but a habit”

- Aristotle (384–322 BC)

The most valuable lesson I learned was to make coding a habit. On the rare occasion I could not sit at a computer and code on a given day, I would use other creative methods to keep learning, for example: reading a tutorial for five minutes in the morning, coding on my phone during a lunch break, or squeezing in a quick video tutorial before bed.

I would try not to be too hard on myself if I couldn’t type code into an editor that day, as long as I kept the habit going with some form of code learning.

I found it important to keep immersed with code daily to continue the momentum amidst life’s distractions. Active learning (learning by doing) was the primary strategy I used. This usually involved typing the code out into a code editor, running it, and hoping it worked (and attempting to understand why if it didn’t!).

I could not entirely avoid passive learning in the “understanding” phase of learning each topic — for example reading documentation on List methods, but gradually I tried to convert conceptual understanding into an active learning session, e.g. read the material, cover it up, and try to recall from memory.

I found that learning a little every day was far more effective than cramming my coding into a weekend; this gradual approach is well supported by research in cognitive psychology, the learning benefits of regular practice vs. cramming are well established, see: A Mind for Numbers (Oakley, B., 2014). Sitting down to code eventually became as automatic as brushing my teeth, requiring little willpower, which, as we all know, is limited in supply!

If you are interested in how habits are formed and maintained, I highly recommend: The Power of Habit (Duhigg, C., 2012), which discusses how to forum and maintain positive habits.

2. Find a Community

To reinforce my daily coding habit, I found a hugely supportive Twitter community based around the #100DaysOfCode challenge (Thanks to Alexander Kallaway — external website)

This is highly supportive community of both beginner coders and experienced software engineers learning new programming languages, and logging their progress. Having access to a solid community is reassuring, as you know you are not alone, which is helpful if you are having a tough time learning. You can also gain some positive support from people who know what you are going through. I used my own Tweets as a motivational tool — looking back to see how far my programming skills developed via historical Tweets.

3. Pick one programming language and stick with it until you have mastered the fundamentals

If you are completely new to coding, don’t dilute your focus by flipping between programming languages. Learn to code by practicing the principles from one language. Once you have mastered programming fundamentals (e.g. loops, if/else conditionals, various data types), which are, for the most part language independent, you will have a much simpler time learning other languages.

Switching your focus between different languages when you haven’t cemented programming basics is self-defeating, as you lack the transferable learning that would make your life easier when you need to build something in a different language.

Repeatedly changing languages when you do not know the basics of one, is a recipe for spinning your wheels, you will form a superficial familiarity at best, and at worst become disheartened or burnt out when nothing seems to stick.

If you want a programming language to start with as a beginner that is relatively easy to learn, used widely in academia and business, has tons of learning resources, is powerful and free — try Python :-)

4. Don’t get trapped in a Tutorial “Bermuda Triangle”

My introduction to Python programming was a series of videos and lectures by Dr. Charles “Chuck” Severance, on the Coursera platform. I found this to be an amazing introduction as complete beginner. Dr. Chuck is a fantastic teacher, and made learning to code enjoyable, breaking down concepts with helpful explanations and analogy.

I tried another beginner Python course after Dr. Chuck’s, and then one more for luck. There are literally thousands of coding tutorials and courses available online. I would complete a course, diligently typing out the prescribed exercises and ticking off the boxes, and then move straight onto the next course, repeatedly over-learning simple concepts, without forming an understanding how concepts operate together to form working programs.

Spending time with courses and tutorials when you have established a reasonable understanding is psychologically safe — it feels good to get the answers to simple problems “correct” without much effort. However, this is incredibly inefficient for continued development, learning should challenge you, it is best to move away from structured tutorials and lessons as soon as you feel able.

I found this advice echoed in the r/learnprogramming subreddit (another great code learning resource):

There is a curated list of great beginner resources for many languages on the above site.

I chose to work through: Think Python! (2nd Edn), (Downey, A., 2016), which is quite comprehensive, and offered me appropriate levels of challenge to support moving from a complete beginner to an intermediate coder. I worked systematically through the book and exercises until I had enough understanding of coding fundamentals to start on my own projects.

5. Build Something

Coding is a creative, problem solving endeavour. As a beginner, tutorials offer a gentle introduction, and suggest the structure and major themes, but it wasn’t until I started building (and failing to build!) my own coding projects, that I really began to learn how to write functioning programs.

Learning from coding projects is an iterative process, like honing a craft or skill to attain mastery. Gradually building my knowledge in order to achieve a defined goal was highly motivational compared to more structured learning. I compare it to the point in video-games where you complete a long and dull introduction, first learning how to move, shoot and pick-up objects, and only after this, you get the “real” game, and your eyes are opened to a vast, open world to play in.

My first coding project was a complete disaster. It was too ambitious for a beginner, I couldn’t get it to work, I didn’t know where to look for advice, and I didn’t know how to move forward.

However, the process of attempting to build the project created an explosion of new learning; including new methods for achieving the result I wanted.

Making mistakes prompted me to review principles and concepts I thought I “knew” from tutorials. Oakley, (2014) describes the danger of “illusions of competence” in which exposure to, and familiarity with the material, fools us into thinking we truly understand the subject. I was familiar with a lot of syntax and structure from tutorials, but building something from scratch really highlighted my own illusions of competence, and prompted deeper understanding and improvements in my coding progression.

Attempting to build software quickly exposed the gaps in my knowledge, and I started to learn how to apply previously unconnected principles. I was surprised at the obvious holes in my knowledge base, how much I did not understand, and how much there was to learn.

All of my code learning is now centred around particular projects, if I don’t know how construct some functionality into my code, I use Google, and the programmers best friend: stack-overflow.com. I then supplement my existing knowledge with this new learning.

A great place to start for Python coders looking for project inspiration is: Automate the Boring Stuff with Python, or Invent your own Computer Games with Python, both available as excellent free e-books by Al Sweigart.

6. Read other programmers code

When I started to read through other people’s code my learning ramped up another notch. Attempting to understand, break or replicate others code was a a fun way to learn, and it was here I was exposed to principles of good coding practice and software design from professional developers. I was then inspired to pay more attention to making my own code more readable, adding comments and docstrings, as well as formatting my code in Python’s official PEP8 style, which is a set of agreed standards.

“Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live”

- Unknown (Cited from Conway, 2005)

I genuinely found reading other people’s code enjoyable, if you have spent hours working through clean examples in tutorials, or staring at your own code, it can be eye-opening to read real-world programs. There are many different styles and methods programmers use to achieve their coding goals, with varying degrees of quality! Reading other programmers code is also a great place to learn more efficient or concise syntax to improve your own code, and enhance your projects. On more than one occasion I learned a shortcut with Python that could have saved me so much time had I known it earlier in my learning journey.

7. Track your learning

A few months into coding, I needed to apply a concept to a project that I learned during my first month. I was hugely frustrated by not being able to recall the syntax or procedure for something I put time and effort into learning.

At that point I decided that I needed a better method to memorise and recall everything, as what was the point of learning if I had forgotten about it a few months later?

I created a Github repository, (an online code storage and collaboration site), and began to fill it with Jupyter Notebooks, each dedicated to a specific area of python concepts.

These interactive notebooks allowed me to write example lines of code that I had learned performed a particular task, and then write my personal notes alongside the code. I could then revise my notes and code together instead of flipping between two separate windows, everything worked in one neat, interactive notebook.

Alongside each topic, I created banks of test-questions, which required me to write manageable snippets of code based on that topic area. After studying a particular topic and answering questions on the material, I record the results, so I can track progress over time, and put everything I learned onto a spaced repetition schedule — a calendar to review what I learned after 7, 14, 28 days and beyond.

When I returned to my coding Notebooks on the appropriate date, again I did not passively re-read them, as active recall (answering questions based on the material) combined with deliberately practicing the areas you find most difficult is far more effective. If you are interested in learning more about this, I recommend the book: Make it Stick (Brown et al, 2014).

I also transferred a lot of coding syntax, which required memorisation, onto digital flashcards. The flashcard software I use is called Anki, and is free, open source, and sync’s across all my devices. I could then test myself on coding anywhere, at anytime. It does take a degree of time and effort to construct the flashcards, but I found the benefit of not forgetting the material (and then having to re-learn it) far outweighed the effort of writing the flashcards.

So, have I learned to code?

Well… I have been learning to code for almost a year now (300 `mostly` consecutive days, 457 hours), and realistically, I am just getting started. There is so much to understand, absorb and apply, and I am fine with that. I don’t believe anyone is ever finished learning to code, we are all somewhere on a continuum of ability from novice to expert.

Having said that, I am content with my progress: I have a solid understanding of the fundamentals of Python, and at least I feel confident (if not yet competent) that I could start to build anything with my current knowledge; given enough time, stack-overflow searches, and black coffee!

One of the best articles I found on learning to code is by Peter Norvig, Director of research at Google, and co-author with Stuart Russell of AI: A Modern Approach. Peter’s article is entitled: Teach yourself programming in Ten years, and was penned partly as a counter-argument to the “Learn to code in 24 hours” fallacy that is so culturally pervasive.

I like Peter’s article as it blows away false expectations new coders may have (and therefore limit the damage that not meeting these expectations can bring!), i.e. that you can learn to program in a few hours or even weeks:

“How about working hard to continually improve over 24 months? Well, now you’re starting to get somewhere…”

Norvig, P

I have thoroughly enjoyed my coding journey, it has been challenging, frustrating, fun, creative and eye-opening. If you haven’t tried coding already, I’d like to encourage you to download a programming language and start creating something you are passionate about. I hope you’ll enjoy the journey as much as I have.

Massive thanks to everyone who has supported me over the last 300 days :-)


Disclosure/Positionality statement:

I am a professional male in my late 30’s. I have a busy family life and young child. During this time I was working full-time in healthcare leadership, with no professional experience of coding. I have no financial affiliation to any of the resources I discuss — I share them because they helped me personally, and I hope they will help you.

Artificial Intelligence, Data Science, Machine Learning