How I would learn programming in 7 days

This will be a part of a series of articles on learning programming and data science. There are many articles on this topic already, but these are for my friends.

This post focuses on learning programming. Most data scientists use Python and R. Between the two, I think Python is a more programming-oriented language. The types of objects are more straightforward, the syntax is easier, the object-oriented approach is clearer, too. There is no doubt that R excels at table manipulation, graphics, and statistical calculations, but I would recommend people to start with Python, even if it is not immediately helpful to your next research project.

Day 1

Figure out why you want to learn programming

For me, the joy of creating a virtual world with little physical dependencies is what got me started. It also helps me to automate a lot of tasks in life. I recommend taking a look at the https://automatetheboringstuff.com/ book to know the range of activities that Python can help you with.

Object-oriented programming also enthrals me on a philosophical level, because by its extension every machine, including us, is made of algorithms (i.e. a series of set rules).

Day 2

Set up the programming environment for Python

Many people quit programming after day 2 because they overestimate what they can achieve on that day. Set the expectation low and use an editor like @vscode. Call it a day if you can print “hello world” to the console.

There is a lot more to programming than just knowing the concepts. A large chunk of time is spent making the software systems compatible with one another. It is one thing to write algorithms to achieve what you want in a controlled environment, and another thing to deploy the algorithm so that it can become an application. Most tutorials tend to focus on the former, but remind yourself that the second half is just equally challenging.

Day 3

Learn Python basics

I think this is well covered by most tutorials. At a basic level, most languages have variables. These variables can be grouped into lists. You then have operations (methods, functions) that modify these variables. Lastly, you have loops that apply the operations on elements of the lists and conditionals that decide whether to apply an operation.

Day 4

Learn object-oriented programming

Well-covered by most tutorials. You do not have to understand everything, but it is something that you should keep at the back of your mind because most libraries are designed in this way and you will need it one day for organizing your code.

Day 5

Learn git

Git is a life-long learning tool for most people. I still consult with StackOverflow for many uncommon git commands. But git is also one of the most powerful tools invented in programming. It allows you to save the current state of the project and then revert to it any time in the future. For starters, just consider git as a linear structure. git add and git commit to save the current status, and use a vscode addon like git tree to revert to its older state and you are good.

Day 6

Learn how to load and use libraries written by other people

Programming is community work. Register an account on GitHub, now that you know how to use git. Related to Day 5 and 7 as well, as you will learn how to git clone other libraries, or use pip or conda to install the libraries. Learn how to raise an issue on GitHub and ask questions on StackOverflow.

Day 7

Start a project

My recommendation is to choose a project in the book https://automatetheboringstuff.com/ and implement it. The best way to keep what you learned fresh is to bring what you learned to your own life. There is no better problem to solve than the problems you are facing yourself.

Next steps

If you are interested in a data science project, I would move on to learning R with https://r4ds.had.co.nz/ and Hands on programming with R. That’s for another day.

Avatar
Tim

Personalizing medicine