I started programming Python in 2014 and have since gotten pretty good at it. I have gone on to build applications using R, SQL and Kotlin.1

This post is targeted at somebody starting to learn programming from scratch. Your learning timelines and objectives unknown (e.g. specialising in a type of coding, for a job or hobby).

Reader objectives from this post:

  • see what a successful “learning to code” journey looks like
  • common pitfalls and feelings
  • habits for learning effectively
  • encouragement and setting realistic expectations

This post contains advice when starting out, my own Python learning curve, a suggested approach to learning, and how I setup my computer to code.

I hope it helps and good luck!

at first…

You just have to keep plodding. Rome wasn’t built in a day. Coding fundamentals are a combination of logic, language syntax, an ecosystem of other people’s code and some maths. All time great cyclist Eddy Merckx has a quote about just doing it that applies to elite cycling and learning to code:

Ride Code as much or as little, or as long or as short as you feel. But ride code.
Eddy “The Cannibal” Merckx :goat:

It’s all about consistent curiosity. Coding is a moving target: languages, libraries and “hot areas” come and go. A curious mindset help keep you up-to-date.

A lot of people feel intimidated by learning to code. Some common fears or feelings to recognise:

  • Imposter syndrome. I think because of how fluent some people appear to be. These people may have been coding for a long time, are good at self advertising or using impenetrable language. Rest assured the best technical minds I have met or read online are humble and approachable (e.g. Alex Martelli).
  • Messing up your computer. This is honestly pretty hard to do as a beginner, especially if you use virtual environments. See my post on “intro to virtual environments”.
  • You feel like you don’t have the raw passion to succeed. It helps to be interested in computers but I didn’t love computers at the start. I had an appreciation, but it has taken me a while to see what was possible.

ProTip!: develop the ability to read and navigate original documentation.

milestones in my python learning curve

Here I list key turning points and supporting links in my python learning curve. Bear in mind these milestones are spread out over 5+ years and I was pretty determined to use Python as much as possible!

  1. The language basics (types, keywords, looping, functions): Codeacademy. Other seemingly equivalent providers that have nice gentle intros and have an interpreter in browser so you can code directly and don’t have to faff with a local python setup.
    • katacoda: similar to codeacademy but users submit courses.
    • Datacamp: for data science, R and Python specifically.
  2. Algorithm design and what the computer is doing under the covers: Coursera computer science 101 MOOC. There are a range of equivalent MOOCs out there.
  3. Couple other python assisted walkthroughs: Al Sweigart’s Automate the Boring Stuff and How to Think Like a Computer Scientist.
  4. Challenges for practicing algorithm design by yourself: Project euler and advent of code. You should never look at the solutions while solving. But they are a good to benchmark how others do it.
  5. Achieved fluency and confidence: Started coding on the job, doing Kaggle competitions and going to evening meetups. Developed an idea of good code, different ways to solve the same problem (!) and the differences between hacking and building. Some links and reading for this point:
  6. More advanced techniques and topics: the internals of a language, how to interface with the OS, and application architecture. Some links and reading for this point:

tips for learning effectively

  • Keep a log of how you solve a problem, and then once solved how your method stacks up against the “gold standard”. The end goal is to build up log of lessons learned and which specific pattern solved the problem. This log can be multi-line comments in a script, e.g.
“””LESSONS LEARNED
- tried nested for loop that iterated over every single combination
- better solution: while loop with stride of 2 and break when found because only need to consider odd numbers
”””
  • Google the techniques around the problem, not the solution. E.g. The maths to test if a number is prime or not.
  • Don’t be hard on yourself about your pace. You will speed up as you go, but its a very up+down pattern.
  • Learn how best to unblock when you are stuck on a problem. And ideally before you become blocked and have sunk many hours into a simple problem. My suggestions:
    • Take a break. This works really well for me, I like going for a short walk and letting my subconscious chew through a problem.
    • Talk the problem over with others, even if not technical audience.
    • Sketch out the inputs, outputs and moving parts.
    • Learn to debug systematically. This blog post has great tips for practical debugging.

my tooling and setup

  • IDE: IntelliJ with the python plugin, basically the same as PyCharm but a few more IDE options and multilingual support. IntelliJ integrates so well with other tools e.g. virtual environment manager, version control, testing and deployment. Its also really easy to customise and sync using your JetBrains account e.g. apply a badass colour scheme. I have also recently started using MS Visual Studio and it does some things better.
  • a nice raw text editor: Notepad++ on Windows, Sublime sounds nice for mac (I’ve never used it). Recently started using github’s Atom which is cross platform, integrates well with version control (unsurprisingly), lightweight, nicely packaged out of the box (read: default dark themed and split screen), extendible, pretty good completion and really nifty shortcuts (just “a” to add a new file!!! :open_mouth:).
  • Environment management: conda. I really recommend investing time to understand virtual environments. They are the topic of my next post. In a nutshell they control your project’s the installed library versions. Often so-so hard to replicate results because of peoples hacky-as-shit setups.
  • Here is a template conda yml file. You should modify this file: e.g. set the environment name and python version. Here’s the conda docs section how to to create an environment using a yml
  • Testing: pytest and unittest together. I strongly recommend getting familiar with Test Driven Development.
  • Version control: git. It is so important to grasp version control. You can forget about worrying if a new change will break existing code.
  • Deployment: Docker.

footnotes

1 I fully recognise that Python is a high level functional languages and many would scoff at it being called “programming”. To these higher code-lords I bow and mumble incoherently. :wink:

Updated:

Comments