A variable in programming is fully characterized by what?

In programming, a good job description does not always mean solving it. But any description of a problem always brings it closer to its solution. Algorithmization and programming have recently been considered with great exaggeration as synonymous words.

Programmers are increasingly called developers. The result of programming is always a description (variables + algorithm) of the solution to the problem.

the variable in programming is fully characterized

In what language what and how is done - it does not matter.

A little touching story

Algorithmization and programming initially went hand in hand, but then their paths diverged. At this point, much is not worth remembering - this applies to the first. It is always necessary to have a clear idea of ​​variables and algorithms - this applies to the second.

The prosperity of modern programming is largely due to the thorny path along which there was an understanding of information, a description of the data and their processing algorithms in programs.

The first languages ​​were simple as punch cards, but they worked. Variables, variable types, variable declaration and description order were most strictly regulated.

algorithmization and programming

As a rule, variables were divided into dynamic (those that can be changed) and static (constants, they cannot be changed).

The very first was a pointer-type variable (this is the merit of a better and "eternal" language - "Assembler"). Not in all languages ​​it was preserved at different times, but in modern programming, the use of pointers is at the top of the code's perfection.

Basic rules: how it all began

The variable should be described before the first use, and most often at the very beginning of the program, and even more often - in a specific section of the program. The variable must be written in Latin letters, with or without numbers. Some languages ​​allowed the symbol "_". The first must be a symbol.

The variable had a characteristic feature: it had to know how many bytes were in memory and how it would align to the boundary of a word, or even a double word.

The latter was very important for mathematical programs. Features of the organization of RAM and the work of the mathematical coprocessor obligated the programmer not only to describe the variable correctly and in time, but also to think about how it would fit in the RAM.

Note The "bowels" of RAM are inaccessible to modern programming in the vast majority of cases. Previously, the organization of memory had to be strictly considered.

The first data structures - sets of variables - functioned as variables with a certain semantics, but to access them it was necessary not only to know how many bytes it took, but also to take into account that some types of data were automatically aligned to the word boundary by the compiler.

All this led to serious errors in the programs. In memory of those harsh times, it should be noted that the first languages, for all their punctuality and exactingness, provided variables, types, data structures in programming and development with safe syntactic control.

If the program passed syntax control and successfully linked, problems with execution began only with a fatal programmer error or hardware failure.

Our time, Internet programming

Some programming languages ​​have remained committed to the strict description of variables. Most allow a description, but allow you to change the type of variable as convenient for the programmer.

PHP: here a variable in programming is completely characterized by a name, a value, but the type depends on the place in the code and the time when it was needed. Some do not really like to name variables with the "$" sign, but you can have these names: $ 1, $ 2, $ 3.

Ranges of values ​​exceed the required limits, and many possible types are provided. For the vast majority of tasks, there are enough lines, integers, sometimes real and logical. There is no pointer as such, but there is the ability to pass an indication of the place of the variable.

JavaScript: a variable in programming is completely characterized by the fact that it must be described, although in some cases the language will forgive the lack of description, there will be little chance of getting valid code. JavaScript simply will not work with something that does not fit into its syntax or it could not execute.

Ranges of values ​​are also off-scale, but lowercase variables are most popular.

variable variable types variable declaration

Programming in languages ​​related to the Internet is indirect, that is, C #, C ++, Pascal, Delphi are strict. In C #, you need to not only describe, but also initialize.

What are the variables

First of all, by their name, to which different languages ​​impose strict requirements. If in PHP the $ sign must always appear before the variable name, then in Java this is beyond the scope of the convention. In general, in terms of naming variables, in addition to the ideas of language syntax, there are a lot of ideas from developers.

Starting to write in a specific language, one should listen to the opinion of colleagues and see the latest ideological manuals on the style of the language.

The second characteristic of a variable is its value. It is always there. Even if there is no value, it is also a value. Characteristic: for example, PHP, many functions that return a number as a result can produce a boolean as a result - what is not the result?

A type is not important, presence is important, and many JavaScript constructs are satisfied with the presence of a value, regardless of its type.

The last thing that matters is, in fact, the value of the variable.

Basic data types

In general, the world of description, the world of variables, despite the dialects and styles in naming, has not developed much with respect to basic types.

Mostly programmers use strings, often integers (int, integer), if necessary real numbers (double, real), some still retain the concept of a sign (char).

You can’t even talk about databases (from small to large), there the number of variations of the basic types is provided for all occasions, and many types of data are inherited from the time of Ada and Babbage.

variable in programming type name value

Currently, the best variable in programming itself is completely characterized by an indication of itself, assuming that its value, type, and who it is in general will be clear only when it is needed.

Variables and Algorithms

The lonely variable in programming is fully characterized by the desire to be in a company like her. This is a historical phenomenon, and little depends on the will of the developer.

what are the variables

If the creation of a program begins with a technical assignment, especially if specialists accept for development, for whom, in the subject of “algorithmization and programming,” the first word has more significance than the second, then there will be a great many variables. Usually this option stops at the stage of variable description.

If the creation of the program begins with an analysis of its main task, and it is the main point of the task that is taken as the basis, then the chances of getting a working result are enough.

Describing the main point and creating an algorithm that serves it is not just a programming variable, type, name, values ​​and place of description, but the beginning of the process. The process of describing variables and the algorithm that works with them is important.

Important movement:

  • first approach to the goal;
  • result, analysis and refinement of the description;
  • second approach to the goal.

Usually after creating the second or third description comes an understanding of where to start. And the task went to work.

Indication of Variables

It’s not much to start a program with basic variables: not names, types and values ​​play a major role. A lone variable, data structure, array, and even an object is simply a statistical solution to the problem.

A tree of objects describing the task, that is, variables and algorithms encapsulated in a single code - an object, and all objects in a common object - a system of objects - this is the thing. This is the real and modern creation of variables.

types of data structures in programming

Such variables can interact with their own kind, and thanks to inheritance, each of them can move along its own pedigree branch, that is, a pointer to what and where it is currently used, and how it does it, is relevant, but its content itself is not. In this case, the content plays a role, when it does, the pointer moves to the next content.

Source: https://habr.com/ru/post/K9725/


All Articles