Programming basics 1: concepts

in #developer5 years ago

cover of the day

It is common that when trying to learn a programming language, be a novice or already have experience in development, you inmerse yourself fully in knowing the language and its use, then hastily develop a project without knowing the most basic concepts of programming. As we nive firwardm we move forward, we find many impediments that limit us when developing certain applications, as we are not clear about certain concepts that are elementary in this world.

In this section we are going to expose a set of concepts that you should know as a pogrammer, which we often ignore. I do not pretend to be full of theory, so we are going to analyze a little better what each of them and their utilities are about.

Introduction

When talking about computer programming we usually always sell the definition that "is the action of programming" or "a sequence of step to solve a computer problem", apply to any area that refers to programming, either when we plan an itinerary or when We designate roles and tasks in an organization, programming is simply describing a set of steps to achieve an objetive.

When we talk about computer programming, we must bear in mind that the result of the action of programming is a program, the program tells the computer the instructions that must be done to complete an objetive.

The computer can not perform a task on its own because it is an illiterate fool.

The computer does not have autonomous learning capacity, so it can not execute certain functions by itself, if it does not have and external agent that orders the instructions, that is where the programmer enters.

Program

A program is a sequence of instructions that comprise the computer to solve a problem, the computers are capable of executing said instructions through a sequence of logic gates represented in binary.

In order for a computer program to complete its objetive, it requires a temporary memory and / or permanent storage, an entrance and an exit, in order to interact with other actors, whether users or other computers.

The computer can not perform a task on its own because it is an illiterate fool.

The computer does not have autonomous learning capacity, so it can not execute certain functions by itself, if it does not have an external agent that orders the instructions, that is where the programmer enters.

Outline of a program

Figure 1. Example of a program: add two random numbers.

Temporary memory

The temporary memory in computer science is the storage capacity of volatile information in the computer, during the execution of the instructions of a program, the computer allocates a determined space of memory that can be used and discarded as many times as necessary by the program during its execution.

A program is useless if it does not have memory, memory makes the learning of a program.

if we are not able to retain information temporarily during the execution of a program, the result will not be the desired, now let's look at an example.

We are going to simulate that our brain is a computer, for this we will execute the program of figure 1, which consists of adding two random numbers where "x" and "y" are the input, the sum is the procedure and the result will be the exit, for this a person must mention two random numbers and another one will represent the program mentioning the result.

Outline of a program

Figure 2. Entering an exit obtaining a result.

The first user mentions two numbers where x = 48, y = 36, then the program mentions the result f(x, y) = 84, but if the program does not have memory when receiving the inputs "x" and "y" can not retain their value so they can not perform the operation.

Outline of a program

Figure 3. Program without memory

The same happens if a program runs out of memory space, the program stops working because it can not retain the incoming values.

Permanent storage

When we talk about permanet storage we can associate the term persistence of data, it consists of passing certain relevant information from the temporary memory to a specific space, permanently (until its elimination).

Following the previous example of a program that adds two random numbers, we will increase the level of difficulty a little, if the user mentions multiple random numbers the program will run on each entry and return its value by cleaning itself its temporary memory, and if between its numbers it repeats twice the same pair (x,y), because the program does not have the result in its temporary memory, it is executed again and returns its value, cleaning again its temporary memory. Now what would happen if the program we add a notebook of annotations.

Outline of a program

Figure 4. Program with a permanent record.

While the program receives new entries the program performs the operation and stores in its notebook or record the key of the entries and the result, so when the same pair of numbers is repeated it accesses its notebook or record and obtains the value without making the effort to operate it.

Outline of a program

Figure 5. Program using permanent storage.

Keep in mind that for a program it is easier and faster to accesss its temporary memory than its permanent storage, since these are usually external to the central processing unit, so in practice you will find that tempoorary memory is used to storage information that is processed continuously and the rest of them in permanent storage, this due to the space limitations of a temporary memory compared to a permanent one.

I hope you liked this summary about the basic concepts of programming, for the next tutorial we will talk about algorithms and how programming languages work. Do not forget to vote to make this project grow and subscribe if you want to keep getting new content.

Sort:  

Congratulations @matajm! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 10 upvotes. Your next target is to reach 50 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Vote for @Steemitboard as a witness to get one more award and increased upvotes!