How do I learned programming

Published in 2023-07-07, last edition in 2024-02-01.

I started programming in 2019, not far back in time, and despite some learning mistakes I feel ready to share some experience with people who are starting.

In this article I discuss about the learning process of computer programming, what programming is, places where you can start and some additional information.

Index

  1. What is a computer program?
  2. How those programs are written?
  3. What's the best way to learn programming?
  4. What's the best progamming language to start?
  5. What's the best programing language? Is there any supreme language, the best-of-all, the king, able to solve every problem?
  6. I want the best way to start...there must be the best way, the PERFECT way!
  7. I'm still undecided
  8. Recommend me a text editor :D
  9. And what is the best text editor?
  10. Where do I start learning?
  11. Last considerations
  12. Notes

What is a computer program?

The same way a person can follow the instructions inside a cookbook to bake a cake, a computer can read the instructions inside a program and execute them to perform tasks like process texts, numbers, audio and images.

A program is essentially a set of instructions that are executed by a computer, and program a computer is basically design, write, test and maintain those groups of instructions.

From that browser you are using right now to games, operating systems and cellphone apps, all those programs are just sets of instructions written by a programmer and executed by a computer.

How those programs are written?

The only language that computers really understand is machine code, a language composed only of zeros and ones, based on the binary numeral system. In the end that's what a program is, a bunch of zeros and ones, and most electronic computers work that way.

Develop a program using pure machine code is possible but very complicated (some would say insane), so high-level programming languages is what most programmers use nowadays for that task. They are much easier to read and write than machine code. A programmer writes the instructions of the program in a high-level language and later those instructions are translated to machine code. The process of translation may involve two programs:

Simplified model of a program compilation and interpretation processes.

What's the best way to learn programming?

Practice, practice and practice again. The practice and experimentation through projects and problem solving is essential to computer programming, there is no other way to learn it. Some may learn the theory first, but the practice is still the cornerstone of software development skills.

The first step is to ask yourself what goals you want to achieve using programming skills. Is it a new hobby? A job? Do you simply like computers and want to explore? Do you want to make a cool website, cellphone app or game?

Once you find out what you want, you choose a programming language compatible with your goals to start. Choose a book, course or workshop that teaches the basic programming concepts using that language. The first programming language is always the hardest to learn, but any other after that will be easier because the same basic principles can be applied to each programming language.

After the basics, it's pretty possible that you'll feel kinda lost, not knowing what to do next. Take what you learned and start making personal projects with it, follow tutorials on internet, learn how to solve specific problems, explore the libraries and documentations of your language, and the list goes on...your imagination is the limit.

There are plenty of problems to be solved out there, and many of them can be solved with programming. Find problems that interest you, break them into smaller sub-problems and solve them one by one. With time you'll realize that even big programming projects are composed of small solutions that you connect together, and those small solutions are composed of basic logic blocks of code that get repeated along the source-code.

A tip based on personal experience: at least in the beginning, the frequency that you practice programming is more important than the quantity. It's better to devote 30 minutes a day consistently over several days than 4 hours in a single day, that way you learn better and develop the habit of programming easier.

Another interesting way to keep learning after the basics is to explore the source code of open source programs. Like the name suggests, the code of open source programs are publicy available so anyone can run, edit, and share that code, that way you can look directly at the source and find out how those programs work. Be careful tho: some projects are monstrous in terms of size and complexity, so choose smaller projects like language libraries and snippets to start.

It's important that you stick with the languages and tools you choose to do some projects with them before jump to learn another language. The programming knowledge comes from the experiences you have with each project.

What's the best progamming language to start?

This question is pretty hard to answer because it depends a lot on the student needs. In my case, for example, it was Python. I tried to learn programming using C, Pascal and Javascript, but the language that really kept me on the right track was Python. Python is a pretty clear and straightfoward language that allowed me to make useful tools and quick experiments early on.

Other people I know learned programming using C, PHP and other languages. Each person should choose a way that fits better their own personality, goals and learning needs.

Remember that once you learn the fundamentals, other languages will be easier to learn and you can always change the technology you use. Technologies born and get deprecated very often, but the fundamentals of programming remain and can be applied to new languages again.

Here are some language options to get you started:

What's the best programing language? Is there any supreme language, the best-of-all, the king, able to solve every problem?

The best tool to put a nail in a wall is a hammer, isn't it? You may use a rock, a pan or a knife and still get the job done, but a hammer or a nail gun will make the job easier and faster. The same way, every programming language has its strengths and weaknesses, and the best programming language depends on the problem you have to solve.

It's normal to feel more affinity for some languages than others, but professional projects requires languages that best suits the project problems.

I want the best way to start...there must be the best way, the PERFECT way!

Bad news: there is no perfect way, you'll have to make a choice and deal with both the good and bad outcomes that may result from it. It's quite unusual for a choice to bring only pleasant results, most of the time the unpleasant results comes together and we gotta have patience and perseverance to deal with them. To make good choices we need experience, and experience mostly comes from mistakes and bad choices. We learn by making mistakes.

I'm still undecided

The American psychologist Barry Schwartz coined a very interesting concept called "the paradox of choice", which is used to describe a phenomenon where consumers who are confronted with too many choices might find it hard to make a decision or to be happy with the decision they make. Have choices is good, and it's natural to wish for options that brings us the best outcomes, but get caught up in analysis paralysis is a waste of precious time that should be used for programming.

Remember that your choice is not permamnent, once your learn the basics you can learn new languages and tools easier than your first language, not to mention that learn more than one language is a must as you'll face challenges that will require different languages.

Recommend me a text editor :D

In theory any text editor (even the notepads that usually comes with operating systems) can be used to write code, but good editors must have, at least, two features: syntax highlighting and automatic indentation. Those features makes the code more readable and provides a much better visualization of the code structure.

Example of code without syntax highlight and indentation:

# (Python version 3.7.3) Function to identify even numbers.
  
def num_even(num):
if num % 2 == 0:
print(num, "it is an even number.")
else:
print(num, "it is an odd number!")

num_even(2)

Example of code with syntax highlight and indentation::

# (Python version 3.7.3) Function to identify even numbers.
  
def num_even(num):
  if num % 2 == 0:
    print(num, "it is an even number.")
  else:
    print(num, "is is an odd number!")

num_even(2)

Geany is an excelent text editor with the basic qualities of a good text editor. It runs in the main desktop operating systems (Linux, MacOS and Windows), it's easy to use, fast, open source, free, supports many programming languages and have many other features. You can download it in this link.

And what is the best text editor?

Seriously? After everything I've said?!

Where can I start learning?

Below are some of the sites I personaly used to start learning:

freeCodeCamp: a non-profit organization created to make the learning of programming accessible to anyone. It consists of an interactive learning web platform, a forum, chatrooms, video courses, and online publications. The interactive lessons introduce the student to web development with Javascript, HTML, CSS and project assignments using those languages. The content of the platform is free but you can make donations that will help them improve their services.

Green Tea Press: a publisher of programming e-books available in a a variety of electronic formats. Their most remarkable book is "Think Python: How to Think Like a Computer Scientist", an introduction to programming using Python and computer science concepts. All books in their website are under free licenses that allow anyone to download, copy and distribute the texts, but they sell physical copies of the books and accept donations.

Automate the Boring Stuff With Python: an online book with a pragmatic approach towards programming. The book focus on the basics of Python programming and the use of that knowledge to perform task automation involving files, webscrapping, Excel spreadsheets, PDFs, emails etc. The website also provides other interesting Python books, offer physical copies of the books for purchase and accept donations.

W3schools: an online platform full of interactive programming lessons and examples. The website is very usefull not only to learn programming basics but also to learn how to perform specific tasks and build components with Javascript, HTML and CSS.

Last considerations

Notes