JavaScript #1 — What is programming

Ondrej Kvasnovsky
4 min readFeb 28, 2021

--

These JavaScript articles are written for people who are interested in coding and are meant to provide an introduction to the programming world.

This article contains a high-level explanation of what is programming and how the programs are written.

What is programming

Programming is a way to instruct a computer to perform a task. The instructions are written as code using a programming language.

For example, a very simple program could calculate 1 + 2 and displays the result on the screen. Another example of a program is a program that would ask the user for his age and calculate what is expected income based on his profession and years of experience.

Read and study the following definitions of programming by Khan Academy and Wikipedia.

Programming is the process of creating a set of instructions that tell a computer how to perform a task. Programming can be done using a variety of computer programming languages, such as JavaScript, Python, and C++.
— by Khan Academy, watch the video with their explanation

Computer programming is the process of telling a computer to do certain things by giving it instructions. These instructions are called programs. A person who writes instructions is a computer programmer. The instructions come in different languages; they are called programming languages. There are many programming languages. Sometimes, programmers use special software, such as integrated development environments (IDEs), which have many special parts, including a text editor, to help them to type and edit programs.
— by Wikipedia, read more about programming

There are many languages to choose from. Every language has some advantages and disadvantages. Programmers choose a programing language based on what they need to create.

For example, it is possible to write an iOS app in JavaScript language, but it will be never as good as an iOS app written in the Swift language. Because Swift is the official programming language supported by Apple, thus Swift is always going to support the latest hardware. For that reason, it might be a good decision to write iOS apps in Swift and not in JavaScript. But it depends on other factors as well. If you are interested in the comparison between Swift and JavaScript for iOS apps, have a look here.

Here are few examples of languages and what they are good for.

  • JavaScript language is the main language for writing web pages.
  • Swift language is the main language for making apps for iOS or macOS.
  • Java is great for backend systems and the development of Android apps.
  • Python language is great for data manipulation and machine learning.

Programming Languages

Have a brief look at the following pieces of code that calculate what is 1 plus 2 and print out the result. It is here to demonstrate how programming languages look like and how they are different. You might be able to recognize the similarities and differences between each language.

JavaScript

let numberA = 1;
let numberB = 2;
let sum = numberA + numberB;
console.log(sum);

Swift

let numberA = 1
let numberB = 2
let sum = numberA + numberB
print(sum)

Java

int numberA = 1;
int numberB = 2;
int sum = numberA + numberB;
System.out.println(sum);

Python

numberA = 5
numberB = 10
sum = numberA + numberB
print(sum)

Writing programs

The code is written as text that follows certain rules. The rules are defined by a programming language, where every language has its own grammar. We need to learn the grammar of a programming language in order to be able to write the code.

To write a program, we need to do the following steps:

  1. write the code into a text file
  2. run (a.k.a execute) the code
  3. observe the results from code execution

Then we repeat steps 1, 2, and 3 until the program does what we want it to do.

It is never that easy that we would just write a program, run it and everything would work as expected. Writing the code is an iterative work that consists of:

  • write a couple of lines of code
  • try to run it and see if the code can run or not
  • if it cannot run, then there are errors in the way we wrote the code, we need to first fix the error and then continue with adjusting (developing) the code
  • if it can run and it gives a result, observe the result and decide: is it expected or unexpected
  • if it is the expected result, we are done
  • if the result is unexpected, we need to modify the code and run it again until it is giving the expected result

Programmer

A programmer is somebody who knows how to write and execute code in one or many languages.

You might be thinking, can I become a programmer? Do I have the right qualities to learn to write the code?

These are the qualities and skills you need to develop and master.

Self-Motivation

Self-motivation is a force that drives us to do things. It's easy to be motivated to learn and get better when everything around is going well. It is way more difficult to find motivation when we struggle to understand programming concepts for a long period of time when we are tired of code that does not do what we want. If that happens, don’t overthink it, take a break to let your brain recharge and come up with ideas. It is going to get better over time.

Read more about Self-Motivation

Perseverance

Don’t give up when you face difficult issues. Don’t expect you are going to know everything immediately, be patient. Keep learning bit by bit every day.

Perseverance is the quality of continuing with something even though it is difficult.
CollinsDictionary

Other qualities

There are other qualities like problem-solving, proficiency with programming languages, or independence. Those will come over time if you stay self-motivated and preserve the course of your everyday actions.

Final words

Now you have a better understanding of what is programming but still lacking practical knowledge. The next step section is going to take you closer to writing your first program.

Next Step

JavaScript #2 — Setup — you are going to learn how to get started with programming in JavaScript

--

--