Learning to code and not die trying

Mario García
8 min readMay 18, 2017

--

Is it easy to code? The first answer that comes to my mind is YES. I will take a few more minutes to give you a better answer. Coding is not that simple. Maybe it will take you one, two or three days, sometimes more, to learn the basic syntax of a programming language.

I’m assuming that you’re self-taught. The truth is that everyone has different ways of learning. Some people need anyone else that guides them through the learning proccess, some others, like me, take the iniciative to learn a new technology because it is fun or just for spending spare time. So, where to start? what language to choose? I will try to answer these and a few more questions in the next lines.

My first time coding

I was 16 years old by the moment when I started learning HTML. I don’t remember why, it was probably a high school project but I’m sure I didn’t learn it in class as the school didn’t offer programming courses. I just started with HTML and a little bit of CSS, creating animations with Flash and some graphics with Corel Draw. I didn’t use any text editor but Dreamweaver which offers an easy way to markup a web page for someone with no experience. Clean up code after finish a project it helped me to learn a little bit more. It also made me to get interest about configuring local web servers and how to publish a website online. 12 years after I could say that the experience could have been better. But this first approach with coding was the reason for studying an IT career.

What language to choose?

Sometimes we don’t have the freedom to choose what programming language to start with. When we’re studying an IT career, our teachers choose it for us, which doesn’t mean is the best option, they generally base their election on their experience. But the truth is there are so many programming languages and some have a shorter learning curve than others.

When I started the university, the first programming language I learned was C++. It was the main language used during the career. Then I had to learn Java for a project I was working on. It took me three days to learn the basic syntax and finish the project. I also learned assembly language, PHP and web technologies (HTML, CSS & JavaScript).

I was in the 7th semester of the career when I started to learn Python on my own. I heard about the language at a local tech event and that year, 2009, I started to read the official documentation and found a book in spanish (Python para todos) that helped me a lot through the learning process.

What I learned about those programming languages is that C++ is not that bad as starting point. I don’t recommend Java for someone who is learning to code for the first time. I’m not saying that Java isn’t a good language but its syntax makes you write a lot of code for just one simple task as printing a “Hello World!” message and that’s why Universities finally realize that Java is a bad introductory programming language.

I will probably never write code in assembly language again but it was fun. I remember my classmates using an 8086 emulator to run programs and my team running code directly from the terminal in Ubuntu.

I have heard negative comments about PHP and why you shouldn’t use it for your web projects but WordPress now powers 25% of the Web. WordPress is a content management system (CMS) that’s written in PHP.

Python is an interpreted language used in areas like math, robotics, bioinformatics, astronomy, system administration and software development in general. It has a simple and readable syntax that lets developers write less lines of code which means a shorter learning curve.

Hello world! in Python:

print(“Hello World!”)

I’ve been a university teacher for about a year and a half. I was using C/C++ for my first programming classes then changed to Python 6 months ago to use it as introductory programming language. So I would recommend you to start with Python because of the reasons explained above.

Where to start?

I was born in Mexico so my native language is spanish. I also speak english and that helped me to learn the technologies I work with these days. Talking about coding and learning a programming language, the problem with it is that the syntax of most of the programming languages is in english, Latino is the one that has a syntax in spanish but I’m not going to talk about it this time. It’s helpful to learn english as it makes you understand the syntax and some concepts. Not so many people are interested in learning a different language than their native.

So before you download the interpreter from python.org or any other tool you need to start writing code in Python, I would suggest to look for documentation in your language so that you can have a guide you’re able to understand and follow. I recommend you to check the following books and websites.

Spanish

If you live in a non-spanish speaking country you can check the following websites.

English

OpenLibra is an online library where you can find books and magazines in spanish and english about so many topics. All the content is available through an open license like Creative Commons, so you can share it with your friends.

There are two versions of Python, 2.7.12 and 3.6.1. The changes between these two versions are the syntax which is slightly different, and the compatibility with some libraries.

Python 2.7.12

print "Hello world!"

Python 3.6.1

print(“Hello world!”)

The interpreter of Python is available for Windows, GNU/Linux and Mac OS and you can download it from python.org/downloads where you can find both versions (2.7.12 and 3.6.1). You just need to choose the right version for the device you’re going to install it on. If you use a GNU/Linux distribution, Python probably comes installed by default as some applications are written in this language. If it isn’t installed you can install it through the package manager of the distribution you use.

Interactive console on Manjaro

I’m talking about GNU/Linux because I’ve used it for the last ten years and my main operating system is Manjaro. But I’m not going to tell you how to start with Python on GNU/Linux as you probably don’t use it or you’re not familiar with the terminal. You have two options to start writing code in Python after installing the interpreter, using the interactive console that you can find in the Windows menu, executing it from the terminal on GNU/Linux or Mac OS. Writing the code in a text editor like Atom, SublimeText, Notepad++ or nano and executing it through the command line.

Writing code with nano

A more easy way is to use an IDE like Ninja IDE or Thonny. Tools like these include in the same application, an editor and the console. Thonny has an easy to use interface, it comes with Python 3.6 built in so that you need to run only single installer. Thonny is available for Windows, GNU/Linux and Mac OS.

Thonny

You can also write code in Python on an Android device like a tablet or smartphone. QPython is an application for Android that you can use for running Python programs. It isn’t available through the Google Play store but you can download it from its website. There are two versions, QPython for Python 2.7 and QPython3 for Python 3.x. It comes with an editor and the console.

QPython — Source: https://qpython.com/

Let’s play! A few days ago I found out about CodeCombat, a platform for students to learn computer science while playing through a real game. You can learn Python, HTML, CSS and JavaScript while playing. Not every people learn the same way so why not trying CodeCombat?

Students write code and see their changes update in real-time — Source: https://codecombat.com/

If you need some extra help for starting with Python, look for a course on CodigoFacilito, Platzi, CodeSchool, Udemy, edX. Attend a technology event where Python is one the topics to be seen. Ask an expert. If you meet someone who has experience with Python, ask for help. Search on social networks to find Python developers. Follow me on Twitter or Facebook and send me a message if you need more advices.

Python events

There are Python events around the world. Visit meetup.com and look for Python events near you. If there’s not a Python event in your city, organize one. You don’t need to be an expert to organize a Python event, contact an expert and send him/her an invitation to give a talk or workshop about any topic related to Python.

If you’re in Colombia, follow Django Girls Colombia on Facebook to know when they’re organizing a workshop in your city. Follow Argentina en Python on Twitter to know when a Python event is coming to Argentina or other country in Latin America.

The international community for the Python programming language holds several conferences each year, named PyCon. I was in Bogotá, Colombia on February participating as speaker at PyCon Colombia 2017. I was giving a workshop about Flask, a micro framework to create web applications with Python. It was an amazing experience and it helped me to know a little more about the kind of interesting projects we can make with Python. So if there’s a PyCon event in your country I invite you to attend.

On June 10th there’s PythonDay Mexico at TelmexHub in Mexico City. I will be giving a workshop about Flask. Here’s an article in spanish about my participation: “Flask: Introduction to Python for Web”. See you there.

PythonDay Mexico agenda

Final thoughts

You’re not going to learn Python or any other programming language in a day, it’s something you need to practice as much as posible. Find exercises to solve. Think about something you want to do and see if it’s posible to implement it with Python. Read as much as you can, not just documentation, tutorials or blog posts but code. Don’t give up the first time you fail. And ask for help when you need it.

If finally you decide Python is not for you, there are other technologies you can try like HTML5, CSS3 and JavaScript for creating web content or Kotlin for Android apps.

Remember, coding should be something you do for fun.

--

--

Mario García

Free Software Enthusiast, Speaker, #Mozillian, #Rustacean, #geek, #WebDeveloper