At the same time that you sit and look at the screen of your computer connected to the internet or are using any operating system, you should know that you are working with a set of symbols called source code . The same does not matter if it is the screen of a smartphone or a tablet.
What is the source code of a web page?
We understand source code as the set of files that, together, contains a group of precise instructions that are based on programming languages. Thus, it is used to compile various computer programs in such a way that, using said code, they execute the actions for which they have been programmed .
We also think of it as human readable text that is written as a programming language. Its ultimate goal is to create the provisions and standards that the computer will translate into its own language as the basis for programs, software, web pages, apps, etc
The first step that every web developer should take into account when creating a web page is to create a validated source code according to W3C standards. A validated source code is the basis for a quality web design that is often forgotten or put in the background in favor of heavy scripts and functionalities that the only thing that they offer us for sure is a lower loading speed performance .
Thus, a well-implemented and indexed source code is really important not only so that the web page at hand is displayed correctly in all browsers, but also so that it is optimized and facilitates the access of search engine robots. .
Let us also remember that every computer, even a simple home PC or a mobile terminal called a smartphone, works with a binary system . In other words, it is the famous language of 1 and 0. If we think of functions such as on and off, for example, it is easier to understand their double-use sequence.
These sequences are what tell the team what to do. Thus, over the years, various programming languages have appeared. Among the best known we find Java, BASIC, Python, JavaScript, C, C ++, Pascal or PHP , among many others.
Source code license
We now continue explaining what the source code license consists of. In this case we are referring to a software license that makes it easy for binary files and the source code itself to be modified. In this way they can be freely distributed without paying the original author.
There are various types of licenses. And it is that some can incorporate restrictions, as long as the name of the authors is maintained, or perhaps distributing their handling through the creation of a copyright statement.
Sometimes the licenses may also allow certain modifications to the code , as its use is permitted only for personal or non-commercial use in the redistribution of the software in question.
It is very common to find licenses such as the Open Source Initiative , which are open source, and which are based on Open Source Definition and can be used freely.
Be that as it may, you can look for public domain software like the one we just discussed, so you don’t have to pay anything for its use. Otherwise, you will find other options such as Microsoft Reference License , also called MS-RL, which is not compatible with Open Source Definition and requires payment for being a shared code license and which is very restrictive in its use.
Purposes of the source code
For a computer to understand the orders you send it, it is necessary that the commands be translated into the code of the machine, as we have already revealed throughout this article.
Thus, this translator that interprets the orders that we send to a program, a software or a website, basically has to carry out two tasks:
- Compile : that is, it compiles all the code that we send it so that the processor is able to understand what we want from it and how it can execute it. Thus, it is a code that ends up being stored as if it were an executable file.
- Interpret : We have already said it, but it is important to remember. Each line of the source code of a web page is interpreted and then directly executed. Remember that this second part is somewhat slower than compilation and translation, since it takes a considerable amount of memory to execute.
Also remember that the code of a web page is the term that will define the basic structure of the site. However, it will not be based so much on the programming language as on the HTML markup language. That is, the latter is the one that establishes the way in which the contents are going to be structured.
Let’s look at an example to illustrate the previous point. It will be the HTML code that will define each heading, each bold, each paragraph, each underline, etc. In other words, the HTML document cannot be considered as a program in itself, although it can somehow include JavaScript code, for example, a fact that will also be applicable in other markup languages, say, for example, XML. .
Source code organization
The source code of a website or software must comply with a specific organization to perfectly adapt to the conventions beyond the language that is being used. Otherwise it would not be valid.
Languages today are no longer created out of thin air. We use existing ones. That is why we have to be aware that certain elements will appear repeatedly.
That said, this is how the source code of a web page, a software, an app, etc is organized:
- Commands . They are the instructions that are sent, that is, the basis of everything. It indicates what you have to do according to the orders received.
- Variables . Spaces in which to insert data. They are referents through the assignment of names.
- Comparisons . They are decisive in the structures of the programs. They are queries that will work depending on the cause and effect scheme following a logical principle of proposition.
- Loops . Queries that are constitutive of foundation building for source text loops. It is a command that is repeated until certain values are reached so that the program leaves the loop and executes what is left of the code.
- Comments . It is allowed to comment with certain lines within the code, which later the program may not take into account. The author enters them as source text for himself, or for a developer who will work with that code in the future.
Source code history
Here is a brief history of programming languages that, surprising as it may seem, are already several decades if we compute them in years of life. Let’s see where they come from:
- Before 1940 . We can go back to 1801 to see the Jacquard loom machine, which already used cards with holes that represented movements of the weaving arms. Then, in 1843, Ada Lovelace found in her translation of the memoirs of the mathematician Luigi Menabrea that a certain Charles Babbage proposed the construction of an analytical engine. With it, the Bernoulli numbers could be calculated, which is why many consider it the first computer in history.
- From 1940 . However, it was not until the 1950s, after the appearance of Enigma , the machine that helped the Allies win World War II at the hands of Alan Turing, that the first modern programming languages appeared, called FORTRAN ( 1955), LISP (1958) and COBOL (1959).
- From 1960 . Since then, numerous languages have appeared. For example, Assembler, which uses words and numbers. CISC to provide instructions. RISC is energy efficient. And already, in 1980 onwards, codes such as C ++ appeared, which did not stop growing from the 90s with the arrival of the internet, so new languages such as Java were adopted for the creation of online software, web pages, etc. .
How to validate the source code or HTML of a website?
When validating the source code to know if it is correct we have to use a tool. There are several options, some online, others through software that we can use to check an HTML code, for example.
Among the editors that check and act as an HTML source code validator, we can use programs for PC or even for Mac. However, experts recommend the online service W3C . There are many more, but this is the most used.
What does the W3C service have to be the preferred online service to validate a web code? Mainly his authority. In addition, it is regularly updated and belongs to the international World Wide Web Consortium , which is made up of pioneering experts and researchers in the field.
Let’s see how to briefly use the W3C HTML validator to check the code step by step:
- The first step is to access the HTML Validator service.
- You can then enter the address of the page.
- You can also indicate the route to a website that is on our team if it is not yet available online.
- Or you can paste to check the HTML in the attached text box.
Tools to validate HTML or create the source code of your website
Having said that, we present below a couple more applications that can be used to monitor the source code of our developments to obtain higher quality pages.
- HTML Validator . It is my preferred Firefox add-on to make the necessary corrections to the source code. At all times it indicates to us in the lower right part, the number of errors and warnings that we have on the page that we are viewing. Without a doubt, highly recommended.
- Site Report Card . This online application is undoubtedly one of the most complete and will allow us to check from the Meta Tags to obtaining the loading time of our page, through knowing the popularity of our links, the existence of broken links , checking our keywords and , of course, validate the syntax of our source code.
Here you have, roughly, everything you need to know about the source code, its HTML validation and even its history. We hope this content has been useful and entertaining for you.