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:

Thursday, May 2, 2019

How To Travel in Bangalore

I've been traveling extensively in and around central Bangalore for the past 6+ months. I have experimented with various modes of transport and various tools that assist finding the right transport in these journeys. Today when I met Nishan on his first day of a new life in Bangalore, I realized I have been traveling long enough to give some travel advice.

Disclaimer: This may not apply to all parts of Bengaluru, especially the Electronic City side (which actually should come under Chennai metro)

What is the best way to travel in Bangalore? It depends. What time is it? Where are you going? How much time do you have?

BMTC
BMTC is the most connected public transport system in Bangalore. The frequency of buses is usually inversely proportional to how badly we want to reach somewhere quickly. But, if we leave enough time to wait for the right bus, there will always be a bus. 

The BMTC app on play store is a hit and miss. If you've used it successfully in a particular route and if the time is before 8pm there is a high chance that the "Trip planner" will show buses that actually are plying. In fact, in such situations the information is so accurate (location, bus number plate, etc.) that I've been thinking about an Uber like service on top of the BMTC app.

There is a monthly pass if it works for you. For ₹1100 in ordinary buses and ₹1700 in AC buses you can travel wherever you want how much ever you want for a month. These passes can be got from any of the bus stations. There is also a daily pass which can be got from bus conductors.

Metro
Namma metro is simple. It either goes where you are going or it doesn't. Indiranagar, Jayanagar, Majestic, Mysore Road, Yeshwanthpur - these are best connected by the metro. The unfair advantage metro has over any other means of transport is that at 7 o'clock when the entire road network is jammed up, the metro rail just flies over the traffic.

In rush hour, if possible, always choose metro.

Get a metro card. It saves 15%. It can be recharged online. And it can be kept in wallet which allows you past gates by waving the wallet over them.

Uber/Ola/Rapido/Speedo/Ludo/Bodo/whatever-do
Uber and Ola are for business class travel. Also, when it is late night and there is no other way to travel. Rapido is for teenagers who aren't afraid of dying. Avoid all these unless absolutely trapped.

Google maps
The only tool you need to figure out the best route to anywhere is Google maps. It may not always get the timing right (especially for buses), but it always calculates the quickest route. Use the public transport tab. Use options and choose "subway" whenever there is a chance. Experiment with the starting/ending point a bit and there may be more convenient routes.

When using Google maps for planning travel, always be mindful of the time of day for which the calculations are made. Change this in the "arrive by" or "depart at" setting.

To conclude, traveling cheaply in Bangalore is possible. The secret is in planning and timing. Use the tips I've laid out with your own judgement and enjoy traveling!


If you like what you're reading, subscribe!

Get posts via email:

Sunday, March 17, 2019

Making Time

Yesterday Swathi and I visited Anivar and Joshina and their kids. It has been at least 5 months since we started planning this visit. And we finally made time for it, yesterday.
The moment we stepped inside Noonu and Ilan were on us - showing their toys, making us read story books, laughing at jokes, jumping, dancing, and purely enjoying. I burst out laughing at one particular joke in Balarama and could not control myself for half a minute. We had lots of food for stomach and mind.
I had asked Joshina about her work some time in the recent past. She told me about her current life philosophy which resonates with what Anivar told about his life philosophy a few weeks back, both of which struck a chord in me. The following is what it boils down to.

The society will expect superhuman things from you. Whenever you do something, there will be a few people to ask you about that next thing that you haven't done. If you keep trying to satisfy all these "next things", you will never be able to keep up. Because it is humanly impossible. But more importantly, you will be happy only if you are doing the things you want to do and those are things that bring you happiness.
A few weeks ago, I had said to myself "the secret to getting things done is to have more things to do". I think I was not entirely right. The focus should never be on getting things done. The focus should be on finding out things worth doing.
Today, coincidentally, I read Make Time: How to Focus on What Matters Every Day (affiliate link). I started it today and I made time to finish it today. And now I have made time to write this blog post today. The book gave me a strategy to implement the theory I learned in The One Thing (affiliate link).
The idea is to focus on life and not let it wither away. To focus on things that make sense to you. Things that are meaningful to you. Things that you will regret not doing. Make time for those things.


If you like what you're reading, subscribe!

Get posts via email:

Sunday, February 24, 2019

On (Not) Judging People

Human beings have an in-built sense of "morality" that they routinely apply against everything that they come across. There are multiple ways one's sense of what is moral and what is immoral emerges - including religion, upbringing, exposure, rationality, mental health, and so on.

Is morality necessary?

Morality is necessary. Not just because it allows people to live together without killing each other. But also because it helps an individual answer their own questions about what to do in any particular situation. It is the moral compass that often shows the direction to forge.

Should we use morality to judge others?

A distinction needs to be made before answering this. When "judging" someone, are you judging the person or their action? The answer matters a lot.

When you judge a person for a particular action, you are labeling that person as "good" or "bad" based on that action. For example, if you see the CEO of a company scolding an employee for a "small" thing and judge the CEO to be a bad person, you may be making two mistakes.
1) You do not know the reasons why the CEO is scolding the employee. It may even be for the good of the employee in the long term.
2) By labeling the CEO as a bad person, you have created a barrier between you personally and them which might make it difficult for you to work with them.

There are several cases where reason 1 does not apply at all. For example, say the CEO is actually doing something, say, being corrupt, which they themselves might not be able to defend.

But reason 2 is more important for someone who is trying to get things done. People are not dispensable. Human resource is hard to come by. If you start judging people by a few of their actions and dismiss them as "bad". If you make it impossible for you to be working with them. Then you have one less person to work with. And when we are all humans and everyone will have some or the other "follies", especially when you are viewing them through your sense of morality (which, having been formed by your own unique experiences in life, is going to be different from anyone else's sense of morality), judging people will soon leave you with nobody you can work with.

In other words, every human is different. If you keep looking for people who think, walk, and talk exactly like you to forge teams, you will never be able to move forward.

But, does it make sense to judge actions? Yes. As long as the judgement does not spill over to the person as a whole. In fact, judging actions is natural and direct consequence of morality. But extrapolating that judgement to an entire person is human bias.

But what if someone is wrong in all areas of their life? I think it is quite right to be mathematical here. The total value of a person is the sum of all their individual values and the added value that interaction of values give them.


If you like what you're reading, subscribe!

Get posts via email:




One more time, subscribe via email: