In this post, I’m going to talk about coding: why it’s useful, why I’m learning it with Python, and how I’m learning it.
Why learn to code?
#1: It’s a part of our everyday lives.
More and more people are plugged in to the digital world these days, whether through a computer, tablet, smartphone, or regular cell phone. And what do these devices all have in common? Coding. It’s everywhere! Isn’t it about time that we learn how our gadgets work so we can be more active participants in the technology we rely on?
#2: It teaches you critical thinking and problem-solving skills that make you a more intelligent person (and a more competitive job applicant).
Coding also requires a new mode of thought (which I experienced during my undergraduate physics classes). Abstract and critical thinking are essential, especially in today’s increasingly connected, information heavy world.
According to Skillcrush:
Coding is the language of critical thought, as you literally use syntax and semantics to “speak” your way through problems and make ideas real. Learning to code will not only bring about the benefits directly related to coding skills, but it will help you hone your critical thinking and take you to a whole new level of problem solving. Any professional job or career that you pursue is going to prize quick thinking and the ability to solve problems in nimble ways. Consider learning to code as an advanced course in critical thought. One that just happens to bring a truckload of concrete skills along with it.
Here’s an amazing real-life example. Check out this article about Jessica Lachs, who used to be a banker on Wall Street but made a career transition career after the financial collapse in 2008. She went to business school and took entreneurship classes in addition to teaching herself how to code (SQL, specifically). Armed with these new skills, she got her foot in the door of the startup world in 2014, and now, she’s a part of DoorDash, a $700 million dollar company. Even though she has been successful, she’s still continuing to grow and learn.
To this day, Lach keeps a bookmark folder on her computer called “Learning” with links to more courses and tutorials she wants to take. But now, she’s one of the leaders at DoorDash who is teaching a new wave of employees how to analyse data beyond an Excel spreadsheet and become empowered as a result.
“I’m a testament to the fact that you really can teach yourself a lot now,” Lachs said. “There are a ton of great resources out there if you want to learn something, between free online resources, the videos, and just the people that you surround yourself with — you can learn pretty much everything.”
#4: It is used in a wide variety of fields, even ones that may surprise you.
Coding the secret behind 3D animation! In this TEDxTalk, Danielle Feinberg talks about how she uses coding to create life-like lighting in Pixar animated films.
So why Python?
Python is one of the most beginner-friendly programming languages, making it a great first language to learn how computer programming works. One of my ultimate goals in learning Python is to use it in scientific research, which will require me to learn how to use NumPy and SciPy.
Why just be a researcher when I can be a computer literate researcher?
So how am I learning Python?
#1: I’m not using Codeacademy (yet).
Codeacademy looks gorgeous, with its minimalistic design and highly interactive, user-friendly interface. Great, right?
Well no, not exactly. The effort it takes to set up the Python programming environment on your computer is whisked under the rug, and as a result, you don’t get exposed to what it’s like to install and use the actual program.
Here’s what Python in Codeacademy looks like:
And here’s what Python on my computer looks like:
The first time I installed Python on my computer, I didn’t check the little box that would allow me to run Python directly from the command prompt. I’ve discovered that this is more convenient than the editor that Python comes with, and it lets me see what my script does right then and there.
Codeacademy doesn’t really teach you why stuff works. It just shows you the bits of code you need, and tells you where to put it. This heavy focus on syntax – the “grammar” of a programming language – is helpful, no doubt, but it doesn’t teach you how to solve problems with code. I started the Python course on Codeacademy a long time ago, but I stopped after a while because I often got lost in the quizzes and projects. I learned bits of code, but I didn’t learn how to use them on my own (i.e. without going back to the tutorial or the hints). Instead of using that frustration as an energy source to keep learning, I stopped.
TL;DR: Codeacademy is too much like training wheels and not enough of actually learning how to ride a bike. (Skillcrush has a great article that talks more about this.)
#2: I’m using a book.
Specifically, this book:
(Side note: I’m planning on going back to the Codeacademy course after I get through this book.)
I am currently working my way through chapter 4, which is about working with lists (using the introductory material on lists covered in chapter 3). While I don’t have a comprehensive overview of the whole book yet, I do have some initial thoughts about it thus far.
In general, my first impression is that this book is really thorough. Each chapter goes through a lot of material, but it isn’t overwhelming to the point where you cannot process what you read. It also has a lot of examples of code, and walks you through each line of the examples, explaining what the code does, what it’s useful for, and why a particular bit of code is used over another bit of code (which depends on what you want your program to do). These code examples are also easy to understand, and the explanations are in simple English without the jargon. If any technical terms are introduced, they are clearly defined, and the code examples help you understand the definitions in a conceptual way by telling you to type in the code into the Python environment and run it, to see what it does. On this note, the book provides several exercises at the end of each chapter to test your understanding of the concepts covered in the chapter and encourage you to experiment with the bits of code you learn how to use in the chapter.
One example of this is the .pop() method, which is used to remove items from lists to use them in other lines of code while referencing the list that the item was originally in. This is different from the del statement, which permanently removes items from lists (so you can’t make references to them in later lines). I understood this distinction, but I didn’t understand how the position, or index, of an item in a list changed for each way of removing items from lists. To get this better, I made a separate .py file – a script file – with a list of my own (of cat breeds, because I love cats!) and made sure to include a print() function, to display my list of cat breeds after each line in which I used .pop() or del. This helped me see how the list was dynamically changing, line by line, and helped me understand an important similarity between .pop() and del: both change the positions of the list items. I didn’t understand how specifically this occurred until I experimented!
In short, I highly recommend this book! It’s great for beginners, but also fast-paced enough that you actually learn important concepts. Initially, I borrowed a copy from my local library, but after working through the first three chapters, I decided to buy my own copy! I am certainly glad I did.
Thanks for reading! Stay tuned for more cool things! :)