Friday, July 12, 2019

How Did I Become A Programmer?

Arya asked me from Germany, "How did you start with programming? Maybe write a blog about it? Your learning strategies".

To those of you who know me as a doctor, I'm a professional programmer who can work on any part of the stack (and even off the stack), and a free software advocate. To those of you know me as a programmer, I'm a professional modern medicine practitioner who can manage any kind of illness (including emergencies in the appropriate setting). To those of you who do not know me, I do much more than what I just described.

But how does one become a doctor and a programmer? As it takes indeed some explaining to do, the suggestion to write blog was excellent and here it is.

I have written about my privileges previously. So I won't repeat that. But it is important to know that some of the things I'm going to describe maybe either much easier for you or much more difficult for you depending on where you are in your life. In other words, your mileage may vary. But do read on, as there are some common principles which should apply to everyone.

Start early
I started in fifth standard, I think. With a simple programming language called MS Logo. I didn't know what a programming language was back then. All I was doing was moving a small turtle move on the screen and draw shapes. But the only way to move that turtle was by writing commands.

FD 50

The turtle would move forward 50 steps

LT 90

The turtle would turn left

FD 50

Another 50 steps forward, but this time to the left of your screen

You could write this 4 times each and get a square.

But soon you will feel like you are writing too many commands and that sometimes these are repetitive. For example, drawing the square above required the same two steps (FD 50 and LT 90) four times in a row. What if you could tell turtle to repeat the same?

REPEAT 4 [FD 50 LT 90]

That would make a square in logo! And that is what a loop is (pun not intended).

Loops are the biggest fundamental concept in programming. If you can understand a loop, you can understand the entirety of programming. That means, if you could read the above section and make sense of it, you have everything that is required to become a programmer. Only time and effort can hold you back now.

But there is so much more about it, right?

True.

Let's not digress. Where did we stop? Logo. Check this article/tutorial on logo. Don't try to run it or anything. Just go through the entirety of it. When you see the complex fructals that gets drawn towards the end of the page, you should be able to realize another big and fundamental truth about computers or programming - you can make the computer do anything, but only if you tell it exactly how to do it.

Well, that is what programming is, you see. Telling computer every single step of what needs to be done. The computer is insanely smart and insanely dumb at the same time. It can do anything and everything, but you have to tell it how to do it. And you have to tell it every single step of how to do it.

Imagine you are teaching the computer how to make tea. Let us have an imaginary conversation with the computer on how to make tea.

You: Make tea
Computer: How?
You: Heat water. Then put tea dust. Then put milk. Then put sugar. Then stir. Then pour to cup.
Computer: How to heat water?
You: Take water in a vessel. Then keep the vessel on the stove. Then switch on the stove. Then wait till the bubbles start coming in the water.
Computer: How to take water in vessel?
You: Move vessel under the tap. Switch on the tap. Wait till the vessel is filled half. Switch off the tap.
Computer: How to move vessel under the tap?
You: Find out where the vessel is. Pick it up by the handle. Find out where the tap is. Move till there. Keep the vessel perpendicularly under the tap with empty side up.
...

You get the point, right? If we go down this route till the level of physics, we will have made an electronic teapot. It will unfortunately not be able to make coffee though.

But that is all there is. Break down a problem into individual single steps till the point where a computer can natively "understand" what you mean to say. CPU is a rock that we tricked into thinking. It only "understands" electricity. All that we see in the computer world is manipulation of this electricity into configurations that we want it to be in.

But, that's so deep? How can we break down everything to such great level of detail? Is it even humanely possible? That brings us to the second fundamental tenet about computers - you build on the work of others.

You literally cannot build a computer all alone. There are thousands of parts to a computer which were made through even larger pathways that are possible only due to the combined human investment of effort in the past thousands of years. If you could take all the knowledge that exists in world today and go back a 1000 years, it would still be impossible to build a computer.

You build on the work of others. That's what you do in programming. People have built operating systems, libraries, applications, programming languages. There already is a lot of what you want to do out there in the world. Instead of trying to figure out everything by yourself, you build on others' work.

Even learning. People write about what they have learned. You can then use their learning as your learning. The programming world is an excellent model of co-evolution. A communist utopia.

You want to build a website? There are libraries and frameworks available for that.
You want to build a business? There are e-commerce frameworks.
You want to write a blog? There are blogging software.
What about that teapot? Well, you can build on existing work for that too.

There is one thing, though. You can't learn programming without doing programming. It is like cycling in that sense. You have to start slow, fall a lot of times. But once you get a hang of it, you can keep improving till you start doing tricks that make you look like a pro.

One approach that has helped me a lot is not giving up. Every programming task appears daunting in the beginning. But once you break it down into smaller steps and start working on each piece, you feel a bit more confident. And then you inevitably run into trouble. But there are literally thousands of resources on the internet to help you.

Understanding what exactly your problem is, and then looking for solutions to that problem helps. At this point, I will be less of a hacker, if I don't link to ESR's article on how to become a hacker, instead choosing to repeat what has already been accomplished. While you are at it, also learn how to ask smart questions.

Still feel like you need a prescription? Here you go:
Set up linux on your computer.
Pick up python or javascript.
Find out a problem you want to solve, and use python or javascript to solve that.
Keep repeating.
Pick up other technologies on the way.
Don't leave anything as "I don't know that, it is not for me", instead tell "I don't know it yet, so I should learn it now".


If you like what you're reading, subscribe!

Get posts via email:




One more time, subscribe via email: