Introduction to programming

Beknazar
8 min readFeb 14, 2021

Your program will do exactly what you tell it to do. Nothing extra and nothing less.

Agenda for this article:

  1. Sit and learn.
  2. There is no best programming language to learn.
  3. Programming is not for me excuse.
  4. Actual introduction to programming.

Sit and learn

Are you looking for one ideal course or book to learn to code? So right after you will become a coding master? I have bad news — there is no such course or book. Look, the best universities in the world are offering their Computer Science courses online on YouTube.

Harvard.

MIT.

And still, we are looking for an ideal solution that will solve all our problems in becoming great software engineers. So the main problem of failing to learn to program is not about the course or learning source.

It is all about us - if we can sit on our desk for 3 hours daily and learn or not. It is all about how much effort we put. It doesn’t really matter if we learn it from Harvard or from articles on medium.

I remember when I was a student back home, I used to attend English classes. And then one day one of my classmates asked me about the course, how do we learn and so on. I described the activities we do like listening, reading, writing, and a lot of homework. He was kind of interested to attend and then he said I don’t like reading and writing because it is boring, I’m looking for a course where I can play games and do interactive activities and everything in this manner. Back then I didn’t pay much attention to this conversation but now when I started teaching by myself I learned how wrong was my classmate. Look, if we do easy learning activities(like just watching lecture videos) where our brain is not working much, we won’t learn much. Difficult activities like coding, solving coding challenges, doing our own projects, and might be focus reading are the best approaches for us to learn because when we think, we learn. If you have a mindset as my old classmate had, it is a good time to change it.

There is no best programming language to learn

Another question I want to talk about here is what programming language should I learn.

It doesn’t matter, just pick one of the modern programming languages(Java, JS, Python). The main thing, to start, is to learn one programming language super well. Super well means you need to know the all mechanisms and small details about your programming language.

One of my pieces of advice — don’t jump from one language to another language. By trying to be Superman, Batman, and Ironman, we might end up being noman!

How do we know if we reached the level in one programming language where we can say I know it? I can give a good example from Java. We can get certifications, I would say these two certifications are good milestones:

  1. OCA
  2. OCP

Programming is not for me excuse

At some point in learning, you might feel frustrated and your brain starts coming up with smart excuses. One of them is programming is not for me. It is hard to argue with this excuse because we have to do what we like to do. In my opinion, you can still learn to program and you need to start working and in a few years if you still feel like it is not yours then it is not yours.

it’s not for me within the first year of learning is an excuse(that is what I think.) Because learning and actually knowing it and using it is totally different.

Actual introduction to programming

A program is a set of instructions that can be executed by a computer to perform a specific task. Your program will do exactly what you tell to do. Nothing extra and nothing less.

Computer

A computer is a hardware machine. To list some computers: your laptop, your smartphone, your smartwatch, your fridge, etc. Almost every computer has input devices, output devices, CPU(central processing unit), RAM(random access memory), auxiliary memory(secondary memory).

Some input devices: keyboard, mouse, microphone.

Some output devices: screen, speaker.

CPU(central processing unit) is the brain of the computer that executes program instructions. The CPU performs basic arithmetic, logic, controlling, and input/output operations.

RAM(random access memory) holds data of the current running program. The data stored in RAM disappears when you shut down your computer. RAM is much faster than auxiliary memory.

Auxiliary memory. The data remains in auxiliary memory when the computer’s power is off. Hard Driver is an auxiliary(secondary memory).

Program

A program is a set of instructions that can be executed by a computer to perform a specific task.

Most of the programs will fit in the above diagram. The program takes input and processes it and produces output. Our job is to write a code that will process input and produce output. A requirement of the program will tell us what kind of task we are trying to achieve.

Let’s take for example google.com search engine. It takes input as a search key and processes it and gives us output as a result of the search.

Every program is solving a certain problem otherwise it won't exist.

An algorithm is a sequence of instructions to solve a problem. Algorithms play a big role in the progress of information technologies. A well-designed algorithm can boost the efficiency of the program by 100s or even 1000s times, especially when dealing with big input data.

Phone Book Algorithm by David J. Malan

Pseudocode is a plain language description of an algorithm. The pseudocode should have detailed steps of an algorithm.

Abstraction

You might already hear that the computer can only work with 0 and 1. This is a binary system. Computer use 0s and 1s because it uses electrical switches which can be in off or in on stages. On — there is power, off — there is no power.

Humans use the decimal system and computers use the binary system. it’s all abstraction or we can say rules to store some amount of data(numbers).

Let’s say in a decimal system I have 101 as a number. How do we know by looking into 101 that it’s actually representing one hundred one pieces (amount) of something? If an alien will read 101 he might think it actually 2(1 + 0 + 1) or whatever. We know that it’s really one hundred one because we know how does the decimal system work. In decimal, we have ten numbers to represent all possible amounts.

The same story with a binary system. Binary uses only two numbers to represent different amounts. These two numbers are 0 and 1. One hundred one in binary is 1100101.

We can think about memory in the computer as a canvas of cells. Each cell is a switch that can by 0 or 1.

101 in binary is 1100101

Each cell is a bit. The bit is the smallest measurement.

Memory hierarchy

The above picture shows the memory measurements hierarchy. Now, when you say I have 8 GB RUM memory on my laptop, you know that you are talking about 64,000,000,000 bits which can store 0 or 1 only.

Ok, we have learned about numbers. How about characters? How do we work with characters if we can store only numbers using a binary system?

Each character has a specific number representation. We have a standard mapping for characters. The name for this standard encoding is ASCII.

https://simple.wikipedia.org/wiki/ASCII

ASCII is an abbreviation for American Standard Code for Information Interchange.

How about pictures and videos?

The screen consists of small blocks known as pixels. Each pixel can take a specific color. By mixing red, green, and blue we can have all spectrums of colors.

A group of pixels makes a picture
A pixel consists of 3 Bytes

And the video is a collection of pictures executed in sequence.

Did you see how we went from 0, 1 to videos? Because we always abstract things out and create some kind of interface to able make it more comfortable for us. You will see the same pattern when we will start writing code in Java. We will not use 0 and 1 to write our programs. Java is a high-level programming language and we will deal with keywords that are pretty much intuitive and understandable.

--

--