How to learn (Python) programming?
That is a question I get a lot and it is a very valid one. It looks nice to write posts on LinkedIn with nice looking pictures like 3D plots or over complicated looking code but behind the scene there is a lot of fun, a lot of frustration but most of all a lot of practice. I compare it with how I learnt to play guitar.. you start off with horrible repeating notes (ask my sister) and slowly you progress towards more complicated melodies and in the end you play a lute suite by Bach (or end up in a Soundgarden tribute band which is also great ;-).
Actually there is no ‘in the end’, not in playing music, not in coding because you’re always learning and finding ways to improve your code which is also the fun thing of coding. It is a creative process and it is great to see how your code comes to live. No matter if it is a tool to help with your work, an app to try and predict the stock prices (been there, failed that) or a game.
But back to the question, how can you learn programming?
There are a couple of ways but I always stress that motivation is the only thing that will make you a good developer. There is no way that you can take a magic pill (like the awful learn X in 30 days.. internet is full of them and I tell you, soon you will see, learn X in 30 seconds (for only $299)). Anyway, you should have an intrinsic motivation and curiousity to learn to develop code. I have no idea how you could create this motivation if it’s not already there but I guess there are probably loads of self help gurus who can sell you their magic path to motivation. My advise is, don’t start if you’re not really interested, it could become a world of pain (thx Lebowski!).
So if you are still with me and really motivated it is gonna be fun.. and frustrating.. and a lot of practice. But here are a few tips;
The internet is full of MOOCs (massive open online courses, but I guess you already knew) and the can be pretty good! I do not see the need to go to university to learn coding although it probably helps but to be completely honest I think you learn programming just as well by studying online classes and just writing code. The only thing I think is really important is a sound knowledge of mathematics. You do not need to know about The Riemann Hypothesis (I don’t.. I just looked it up on the internet right now) but highschool mathematics come in handy. Off course all depends on the code you want to write. If it’s gonna be for a company that develops 3D software you will probably benefit from some extra matrix knowledge. But overall highschool math is fine.
I am not gonna recommend a MOOC because it has been a while since my last one when it comes to Python programming but there are loads of sites or discussions about ‘the best MOOC’ and I encourage you to Google/DuckDuckGo it yourself. Focussing on Python (which is in my humble opinion currently the easiest way to get into code development) you should try to find a course that is really just about the basics of Python. Don’t rush off into numpy / pandas (or even tensorflow) directly but be sure to pick something to really learn the basics. It is important to know about datatypes and programming structures like loops and functions. What I think is also really important is to learn about OOP which stands for Object Oriented Programming. This is especially true for people who will write code that is shared with others. OOP almost always means better code house keeping and trust me you will have a better time once your code is organized!
Ok, so now you know the basics and OOP is it time to make it more fun and learn about numpy and pandas. Take your time with this because it is complicated but the power of these packages is really worth the effort. Off course I am writing this from an engineering perspective but I think it will hold true for other perspectives as well. Oops, I almost forget the other very important library, matplotlib! This will make your manager very happy because it creates such beautiful images and that sells.
Learning about the basics of Python, OOP and the nice packages is fine but never forget to apply everything you know to code asap! And here is another important tip.. it is fine to use Jupyter notebooks but please don’t use it all the time! Jupyter notebooks are great for prototyping and research but awful for shared code. Learn to use an IDE (Integrated Development Environment) because this is where the pro coders go. I must admit that as a linux fan the best IDE (at this moment of writing) is by Microsoft and it is called Visual Studio Code.. it is great! Try it and learn your way around in this IDE, I promise you that you will not be disappointed.
Ok, now that is out of the way I think I should mention Linux again.. it is easier to develop on Linux (and Visual Studio Code is available on Linux.. oh my, Microsoft, you changed!). You might argue that this is subjective which it probably is but I have to admit that every professional developer I met used Linux or Mac (tooooo expensive!! why do people buy this.. it’s like those expensive sneakers with just a fancy name and logo but also coming from a child labour related factory.. sorry, got distracted again). At least try to use Linux (like Ubuntu which is really user friendly) and get rid of Anaconda and install your packages like a man with pip and virtualenv ;-) You will see the benefit of Linux soon and if you don’t well just go back to Windows (loser!.. kidding ;-)
Another very important thing which should come in handy by now. Learn to use git (a versioning system).. the basic commands are really easy to learn but I think you should at least learn about branching and merging because otherwise you will just copy your code to another location, checkout again and merge by hand because you really didn’t understand how to branch and merge.. again.. I’ve been there.
Ok, there is more.. you are really up to speed now but there are some more things to learn and that is documenting, code testing and packaging. This is a very wide topic and all the world is full of CI/CD (continuous integration, continuous development) right now which actually means that once you finish your new code and push it to the master code checks will be done and maybe even packages will be created etc. etc. without your interference. These are great tools and mandatory in larger code projects! For now I think you should focus on tools like pytest. For every important class and function write a test. Before you upload your code check it and only push if there are no errors. You will be very thankful you did it this way. I didn’t do this because I thought my brain would keep memory of all my code but this failed.. I can’t even remember birthdays.. In one project I learnt to really document and test my code and this has been a game changer. Google Docstrings, use them.. I thought it was annoying but now I love to write them. They are very helpful.
Ok.. what’s more.. well at this point there will probably be specific stuff you would like to focus on. For example, cloud computing, webservices, gaming.. etc. Feel free to try this eventhough it is not part of your normal work. It will open up new possibilities to enhance your code with things you would never have thought of. I also like to learn new languages like GoLang or Rust or I try to use Python in Blender (3D modelling software) or C++ in the Unreal Engine. There are so many possibilities to go wild.. and maybe I should end with that. Be sure to take a regular break and be sure to see your friends / family.. coding is addictive! On one hand that is fine (because you will like your work) but on the other hand it is nasty because you could become the next obese pale computer addict.. so don’t!
Well I hope this rather improvised article is of help for your road down to developers lane. Note that I do not consider myself to be a professional programmer.. it’s like music again, yes I can play Bach and yes I can play Soundgarden but I am not J.S. Bach and I am not KimThayil (who??.. oh dear, a lack of music education), far from it but I have a passion for it and I think I have earnt some credits to write an article like this but hey, it’s the internet.. feel free to start Googling/DuckDuckGoing and find other perspectives.. which actually brings me to the last tip..
Listen to his voice!
Sorry.. this was the tip; Every beginner, medior but also pro.. they know stackoverflow.. trust me. Everybody copies code which is not a bad thing! You’re a bad developer if you do not visit stackoverflow at least once per hour ;-)
Ok, let’s leave it like that.. happy programming!
Oh no.. one other thing.. don't overcomplicate your code.. make it easy to read and don't try to do all kinds of fancy things in one line of code.. people will hate you.
lambda L: [] if L==[] else qsort([x for x in L[1:] if x< L[0]]) + L[0:1] + qsort([x for x in L[1:] if x>=L[0]])
Ok, now I'm done.. again have fun!
Rob van Putten
Civil,marine infrastructures development and management
3yI am happy i got to know Rob van Putten on this platform. He is one of those taking goe-related knowledge digital. Kudos!
Startup Growth | Product Strategy & Development | Ready for Next Venture
4yNice article! Good analogy with playing an instrument. It is funny that some people think programming is very 'exact', while there are so many ways to achieve the desired results. It is a creative process, it is puzzle solving, it is fun!
Geotechnical Specialist Engineer at JEJ Ingeniería - PMCHS Level 2 | Mining Engineer - USACH
4yGreat article Rob ! I started programming in a "more advanced" way I used to do, and a complete whole world opened to me. I'm able to achieve things I didn't think I was able to. Even I've thought to include Python programming for my thesis. Have a nice week!
Great article and excellent choice of music ;-). Having a project on which to apply your coding made all the difference for me. I think fully agree with your sentence that you should apply every new coding skill immediately.