Programming

ImprimirCitar

Programming is the process of creating a set of instructions that tells a computer how to perform some kind of task. But not just the action of writing code for the computer or software to run. It also includes all the tasks necessary for the code to work correctly and fulfill the purpose for which it was written.

Currently, the notion of programming is closely associated with the creation of computer applications and video games. In this sense, it is the process by which a person develops a program, using a tool that allows them to write the code (which can be in one or several languages, such as C++, Java and Python, among many others) and another that is capable of “translating” it into what is known as machine language, which can "understand" the microprocessor.

How a program works

To create a program and have it interpreted and executed by the computer, the instructions must be written in a programming language.

The language understood by a computer is known as machine code. It consists of sequences of basic instructions that the processor recognizes, encoded as strings of numbers 1 and 0 (binary system). In the early days of computing, it was programmed directly into machine code. Writing programs like this was too complicated, it was also difficult to understand and maintain once written. Over time, tools were developed to facilitate the work.

Early scientists working in the area decided to replace sequences of ones and zeros with mnemonics, which are English abbreviations for the function that a processor instruction performs. For example, to add you could use the letter A of the English word add (to add). They thus created a family of higher-level languages, known as assembly language or simply assembler (in English, assembly). Over time, assemblers incorporated additional facilities, but always maintaining a direct correspondence with processor instructions. On a conceptual level, then, programming in assembler is very similar to doing it in machine language, only in a friendlier way.

As the complexity of the tasks performed by computers increased, assembly language began to show limitations. To make a program, you had to know in detail the operation of the computer where it was going to be executed, what instructions it provided and how to use them. Sometimes the instructions were too basic, for example there could be one to add two numbers but not to multiply, and then it was necessary to program an algorithm that would perform the multiplication based on more basic instructions. Other times, the way to use the instructions was cumbersome. Furthermore, if another model of computer was used, in many cases the program had to be rewritten with other instructions. The next step was to create the high level languages.

Once you finish writing a program, you need to somehow translate it into machine language, which is all the processor understands. This task is automatic, by means of an additional program that takes the written code and processes it. There are different approaches to this processing. The classical approach is called compilation: the program takes code in one language and generates code in the other; the translator program is called a compiler. In general we talk about compilation and compilers when the source language is high level; if the translation is from assembly language, it is called assembly and the program is called assembler (you have to distinguish assembly language from assembly program; in English it is clearer, they are assembly language and assembler respectively). There is usually a post-compilation phase called linking (linking in English). Programs can be written in separate parts and can also use resources provided by libraries. The linking, performed by a program called a linker, combines all the components and thus generates a complete executable program.

In some programming languages, a different approach may be used that doesn't require compiling and linking: a program called an interpreter reads the code and instantly performs the actions that the program would do. Generating separate code is avoided, and the experience is that code is being executed in the high-level language, even though the processor doesn't understand it natively.

Lexicon and programming

Programming is governed by rules and a more or less reduced set of orders, expressions, instructions and commands that tend to resemble a bounded natural language (in English); and which also have the particularity of a reduced ambiguity.

In programming languages, various elements are distinguished, including the language's own lexicon and semantic and syntactic rules. Within the lexicon, symbols and words with specific functions within the language are generally used. These words are usually taken from English and cannot be used differently: they are the so-called reserved words. Another peculiarity of languages is allowing programmers to use comments: phrases or paragraphs without functionality in the program, which are discarded by compilers or interpreters and are only intended to be read by people; this way you can leave explanations that help to understand the code to whoever reads it.

Programs and algorithms

An algorithm is an unambiguous, finite, and ordered sequence of instructions that must be followed to solve a given problem. A program typically implements and contains one or more algorithms. An algorithm can be expressed in different ways: in graphical form, such as a flowchart, in code form, such as in pseudocode or a programming language, in explanatory form.

Programs are often subdivided into smaller parts, called modules, so that the algorithmic complexity of each part is less than that of the entire program, which helps simplify program development. This is a widely used practice and is known as "progressive refinement".

According to Niklaus Wirth, a program is made up of algorithms and data structures.

Programming can follow many approaches, or paradigms, that is, different ways of formulating the solution to a given problem. Some of the main programming paradigms are:

  • Declarative programme
  • Peremptive programme
  • Structured programme
  • Modular programme
  • Object-oriented programming
  • Events-oriented programming

Compilation

The program written in a high-level programming language (easily understood by the programmer) is called source program and cannot be executed directly on a computer. The most common option is to compile the program obtaining an object module, although also, if the language supports it, it can be executed directly but only through an interpreter. Some languages, such as BASIC, have both forms of execution, which makes it easier to debug and test the program.

The source code of the program must undergo a translation process to convert it to machine language or to an intermediate code, thus generating a module called "object". This process is called compilation.

Usually the creation of an executable program (a typical.exe for Microsoft Windows or DOS) involves two steps: the first step is called compilation (proper) and translates the source code, written in a programming language and stored in a text file, to low-level code (usually object code, not directly into machine language). The second step is called linking in which the low-level code generated from all the files and subprograms that have been sent to be compiled is linked and the code of the necessary functions residing in external libraries is added., so that the executable can communicate directly with the operating system, thus finally translating the object code into machine code, and generating an executable module.

These two steps can be done separately, by storing the output of the compile phase in object files (a typical.o for Unix,.obj for MS-Windows and DOS); to link them in later phases, or directly create the executable; so the build phase can be stored temporarily. A program might have parts written in multiple languages, such as Java, C, C++, and assembler, that could be independently compiled and then combined to form a single executable module.

Software programming and engineering

There is a tendency to identify the process of creating a computer program with programming, which is true when it comes to small programs for personal use, and far from reality when it comes to large projects.

The software creation process, from an engineering point of view, minimally includes the following steps:

  1. Recognize the need for a program to solve a problem or identify the possibility of automating a task.
  2. Collect the program requirements. It should be clear what the program should do and what it takes.
  3. Perform the analysis of program requirements. It must be clear. What? tasks must perform the program. Tests that check the validity of the program can be specified at this stage.
  4. Design the architecture of the program. The program must be broken down into parts of approachable complexity.
  5. Implement the program. It consists of a detailed design, completely specifying the entire operation of the program, after which the encoding (programming itself) should be immediate.
  6. Try the program. Check that they pass tests that have been defined in the analysis of requirements.
  7. Introduce (install) the program. It consists of putting the program into operation together with the necessary components (data bases, communications networks, etc.).

Software engineering focuses on the planning and design steps of the program, while in the past (craft programming) the realization of a program consisted almost solely of writing the code, with only knowledge of the requirements and with a modest analysis and design phase.

Historical references

The work of Ada Lovelace, daughter of Anabella Milbanke Byron and Lord Byron, that she did for Babbage's machine earned her the title of world's first female computer programmer, although Babbage never completed the machine. machine construction. The name of the programming language Ada was chosen as a tribute to this programmer.

Objectives of programming

Programming should seek to obtain quality programs. For this, a series of factors that determine the quality of a program are established. Some of the most important quality factors are:

  • Correction. A program is correct if you do what you should do as it was established in the pre-development phases. To determine if a program does what it should, it is very important to clearly specify what the program should do before its development and, once finished, compare it to what it really does. By verifying this behavior you are meeting that objective.
  • Clarity. It is very important that the programme be as clear and legible as possible to facilitate both its development and its subsequent maintenance. In developing a program you should try to make your structure simple and coherent, as well as take care of the programming style. In this way the work of the programmer is facilitated, both in the creation phase and in the subsequent phases of error correction, extensions, modifications, etc. Phases that can be made even by another programmer, thus clarity is even more necessary for others to continue work easily. Some programmers even use ASCII Art to delimit code sections; a common practice is to make clarifications in the same source code using lines of comments. Contrary to this, some programmers perform actions that tend to introduce confusion to prevent a comfortable analysis of other programmers, resort to the use of outlaw code,
  • Efficiency. It is a matter that the program, in addition to doing what it was created (i.e., it is correct), will do so by managing in the best possible way the resources it uses. Usually, when talking about the efficiency of a program, reference is usually made to the time it takes to perform the task for which it has been created and the amount of memory it needs, but there are other resources that can also be considered to improve the efficiency of a program, depending on its nature (discussion space it uses, traffic in the network it generates, etc.).
  • Portability. A program is portable when it has the ability to run on a platform, either hardware or software, different from that in which it developed. Portability is a very desirable feature for a program, as it allows, for example, a program that has been developed for the GNU/Linux system that can also be run in the family of Windows operating systems. Consequently the program can reach more users.

Software Life Cycle

The term software life cycle describes the development of software, from the initial phase to the final phase, including its functional state. The purpose is to define the different intermediate phases that are required to validate the development of the application, that is, to guarantee that the software meets the requirements for the application and verification of the development procedures: it ensures that the methods used are appropriate. These methods originate from the fact that it is very expensive to correct errors that are detected late in the implementation phase (proper programming), or even worse, during the functional phase. The life cycle model tries to detect bugs as soon as possible and therefore allows developers to focus on software quality, implementation deadlines and associated costs. The basic life cycle of a software consists of, at least, the following procedures:

  • Requirements analysis, design feasibility and specification of functions defined in programming language.
  • Analysis of architecture in the creation, development, correction and implementation of the system.
  • Tests in the integration of modules, and subprogramme(s) with each set or subset.
  • Beta or validation tests that ensure that all the original specifications are met in the application procedure.
  • Maintenance of correction of errors and restrictions.
  • Documentation of all information.

The order and presence of each of these procedures depends on the type of lifecycle model agreed upon between the customer and the development team. In the case of free software, there is a much more dynamic life cycle, since many programmers work simultaneously developing their deletions.

Contenido relacionado

Monotype

The monotype is a printing system developed by the company Monotype. It consists of a machine with a keyboard, as if it were a typewriter, with which the text...

Graphics (computer)

Graphics or graphics, in computing, is the name given to any image generated by a...

Energy (technology)

From the social and economic point of view, energy is a primary or derived natural resource that allows work to be done or serves as a subsidiary to economic...
Más resultados...
Tamaño del texto:
Copiar