Author: Kyaw Tan

In this part of the article, we will learn about: how the Internet works, how frameworks differ from CMS, as well as briefly about integration, crowns, agents and programming languages.

Those who follow us on Youtube have probably already appreciated the material on technical literacy for young and hot digital project managers. We decided to make a useful cheat sheet out of it, collecting everything in one place. We will touch on the basic things: how the Internet works, what the site consists of, what frameworks are, a little bit about servers and deployment. 

How the Internet works

Every device on the network has an IP address. This is a unique number that looks like a group of four digits separated by dots. Each digit is from 0 to 255, that is, four bytes of information. For example — 127.0.0.1 (this is your personal IP address, in order to knock on yourself).

When you enter a domain into the browser, press enter, — the request does not immediately go to some server. First, he needs to match the domain with the place to go, that is, with the IP address. First, the request will go to the root DNS servers (the DNS system - Domain Name Services — is responsible for the fact that a specific IP address can be assigned to each domain. Although, everything is somewhat more complicated there — several IP addresses can correspond to one domain name (used as one of the techniques for fault tolerance and load balancing), and vice versa, but the point is to find an IP address by domain name.

When a request is sent to a specific address, the program code starts executing on the server. For example, PHP code that programmers write (although you can write in a lot of languages on servers, and more on that below). But in addition to the code, a database is stored on the server: the site needs to get information from somewhere to display it on the browser page (news, articles, etc.). When a request comes to the server, it responds with generated HTML - Hypertext Markup Language (Hypertext markup language). In fact, this is the structure of the document — for example, a header with a specific text, articles with a specific text, footer.

The browser accepts this HTML, analyzes it, downloads scripts, makes additional requests (if necessary), downloads images, CSS and JS styles.

HTML is only the structure of the page, without any visual component, CSS is already styled (for example, that the header is of a certain height and blue color, the footer is at the bottom, articles are made with cards, etc.). JS is the behavior of elements on the page, that is, processing reactions to user actions (when hovering over the card, displaying it in an expanded form, when you click add something to the cart, and so on).

Everything that works on the server side (executed by PHP when accessing the database) is the backend. Everything that is executed in the browser (HTML, CSS) is frontend.

This is the simplest scheme, but for now it is enough to understand the general principles.

What does CMS refer to?

CMS (content management system) is executed on the server side (kernel modules, highloads, infoblocks, etc.) — and this is the backend. But at the same time, for example, there are standard components for Bitrix and rather dirty standard modules that work partly on the frontend. In general, there is both.

What are programming languages?

A programming language is how a program is written, and it consists of two parts. The first is syntax: what the programmer writes. You have just presented the numbers, as in the movie "The Matrix", but no. The programmer does not write in machine codes — he writes code that is more or less understandable to a person (with conditions and subsequent actions).

The second part of the language is a compiler or interpreter that analyzes the code written by the programmer and translates it into machine instructions — instructions for the processor to execute.

Language versions are the addition of new features to them. Something is becoming obsolete, something is being added - programming languages are developing, just like an ordinary natural language: new terms are being added, some words come from other languages, some are becoming obsolete.

Choice of programming languages

In addition to the syntax and interpreter, there are also standard language methods. Python has many functions for working with some mathematical operations, and it is often used by mathematicians. In PHP, there are fewer such opportunities to work with mathematics, and it is much less often used to work with mathematical functions. But it is much easier to work with texts and process requests from the browser.

There are several languages that are convenient to use on the server side — PHP, Python, server-side JavaScript (Node.JS ), Asp.net . In addition to the capabilities of the language itself, the amount of code already written in it for a special task differs. For example, a bunch of frameworks and CMS are written in PHP, there are only a few of them in Python, and there are no frameworks for working with websites in C++ at all.

We most often use PHP for websites, because there are many ready-made solutions for working with websites, convenient features in the language itself for processing requests, and it is quite simple: it is easier to train an intern in PHP than in some other language.

How cookies and sessions work

Communication with the server goes over the HTTP protocol (Hypertext Transfer Protocol) — a protocol for transferring hypertext. It doesn't contain states by default, which means it doesn't remember which pages you requested before. That is, if you walk around the site for three hours and request some next page, for the server it looks like someone came and asked for the page for the first time.

For authorizations, memorization and saved baskets, a special mechanism has been invented — sessions (a period of time in which the server "remembers" about you that it is you). It is usually implemented via cookies. When the first request from the user's browser comes to the server, in addition to HTML, a unique identifier (a string of 32 characters mixed letters and numbers) comes. Only you will have this code, and with each subsequent request, the browser adds this cookie to any request — so the server can understand that this is you, this is your authorization, this is your shopping cart, and so on.

But unless some additional processing is done, the protocol by default does not remember which pages you visited before. And this is one of the reasons why when the terms of reference say "make a link on the detailed product page that goes "back" with the restoration of the catalog page and filter settings", programmers don't like it very much. Because by default there are no mechanisms for this — and we have to be sophisticated.

Cookies are also associated with the concept of "session" — by default, this is a 30-minute session. If the page is not updated during this time and no actions occur with it, then the session is considered completed. The good news is that the session length can be changed manually in the server settings.

About why all sites now report that they use cookies, and what GDPR has to do with it, we have a separate big material-an investigation. Wait, even two.

What are frameworks and how do they differ from CMS

The server framework is actually a framework to write code faster (for example, PHP) on the server (on the backend) and to make it easier to maintain later. Usually frameworks contain blanks of typical operations, a modular structure and provoke writing the entire project in a certain paradigm. It is clear that you can do without a framework, but code written from scratch is unlikely to be supported: often another programmer does not want to understand what someone wrote without using standard approaches. Standardization is the key.

Therefore, in any adequate development, either some framework or some CMS is used. 

 

What are their differences:

 

Frameworks

A framework is still a thing created by programmers for programmers. It is easier to develop with it, but most often there is no admin panel in frameworks in which it would be convenient to fill in content. But this is not a problem — there are third-party admins, like Voyager for the Laravel framework or whole admin generators.

Most of the frameworks are modular (a set of necessary modules responsible for different functionality that can be installed separately as needed) and almost all are free (open source). Frequently used frameworks are Laravel, Symfony, YII, Zend Framework. They solve the same tasks, but they have different entry thresholds: some are simpler, some are more complicated, but in general — close. Having understood any of the frameworks listed above, the programmer, at least, will be able to immediately understand the code written for another (not counting the internal complexity of the project — the logic of work).

CMS (Site management systems)

Made by programmers for non-programmers (content managers, salespeople, and so on). They are distinguished by user friendships (everything is relative here): inside, as a rule, there are admin panels and basic business things like sales, online stores, discounts and so on. Minus — coding in them is not so convenient, because there are a number of restrictions dictated by the CMS system. The most used CMS, except Bitrix, are Joomla, Wordpress, Drupal, NetCat, ModX, Magenta.

Programming in pure PHP without a framework is like building a house from scratch and without tools: digging a pit, pouring the foundation, bringing communications, building walls, and so on. A hut or a dugout can be built somehow.

If you use a framework, it's like taking an already built building without internal partitions, to which communications are already connected: you can design the insides as it should and as it will be convenient. At the same time, there are plenty of tools, and they are very reliable.

Coding with CMS is like a built building, but already with partitions, storefronts, warehouses that can be used for a typical task. But for an atypical one, you will have to suffer and demolish everything inside for your task. Sometimes there is a risk of collapsing the entire building.

SEO in CMS and frameworks

Bitrix has built-in capabilities for managing SEO, frameworks, since they are not focused on any specific SEO-friendly sites by default, there are no such capabilities in the basic set of classes. The framework is good because it is flexible: you can modify almost anything. But not like in Bitrix, where you take a ready-made information block, and it has a ready-made tool for managing SEO. In the framework, you create some kind of table for data, and you have to figure out how to manage SEO for this table.

Why do we use Bitrix

He was very much promoted, and now there is a high demand for him. Bitrix has a relatively convenient admin panel (although there are questions about it), it has more or less convenient customization options - there are places where you can "finish" something yourself. This is the so-called "business framework" — still not a full-fledged framework, but an attempt to make a more or less customized tool. Other advantages: good integration, compliance with the legislation of most countries (support for online sales registers).

But not everything is so cloudless. According to 95% of programmers, it is better not to get into the Bitrix code once again:

Reason one

Bitrix writes components (ready-made pages that can be customized - for example, a catalog) and tries to make them as customizable and versatile as possible. And when there is a narrow task, most of the code written by Bitrix is not needed and only confuses programmers and prevents them from solving it.

Reason two

Bitrix tried to make the code simpler so that a content manager with a minimal training course behind him could get in there and fix something. But for complex structural changes and non-standard things, this complicated the development. In other words, they write "the most widely-used code", which is difficult to understand and difficult to modify.

But Bitrix still has more advantages. Another weighty argument in its favor when choosing a CMS for a project is its widespread use. Changing a CMS to some other one is a very labor—intensive (and expensive) process.

It is for this reason that when there is a chance to agree to work on a framework, or the client says "can I not use Bitrix?!", we can offer a framework. They are built on relatively similar principles (for example, our project on Laravel or on Symphony).

What is a "self-written website"?

As a rule, students who write "for food" sin in this way. A self-written website is a code in which, in 9 cases out of 10, the programmer does not follow any of the programming principles, but writes the code as he wants.

Plus frameworks — strict rules: how the pages are processed, how the work with the database is going, how some business cases are built, what chains of actions take place there. And if you have figured out the conditional Laravel, then you understand in any site on Laravel in 30 minutes what is there and how it works.

But if you take a self-written site, there is zero understanding: it is unknown how the request is being processed, how the database is working, where to look for configurations… You have to read the code from the beginning and to an end and figure it out. And even if the code is written well and follows some rules, you still have to dive into it completely. Self—written - it also means that there is no community support, there is no modification of modules, there is no closure of any vulnerabilities during updates. Therefore, this is one of the worst options that can only be.

Bitrix has its own guideline on how to write code and how to process it correctly. Bitrix also has a bunch of courses — the entry threshold for coders is low. PHP is also a fairly simple language, also with a fairly low entry threshold. As a result, not quite literate people often call themselves "Bitrix developers" and "write" code for Bitrix.

For each project that comes to our technical support, you need to do a code review. And here the question often arises, are there any bugs in the code that came to us, and will we be able to refine the pages through specific components (and will it not turn out as a result that some button is displayed in an incomprehensible way).

Due to the low threshold for entering Bitrix and because of the flexibility of PHP as a language, there is a very high probability that the code does not follow the guidelines, and it has pitfalls. This means that there will be very large costs to support such code.

The temptation to write a project on a framework is high. Moreover, the code on the framework turns out to be more beautiful — why use Bitrix when you can make almost perfect code from the programmer's point of view? The option takes place for complex tasks that would take longer and more expensive to do on Bitrix. But sometimes the "van love framework" approach turns into difficult support and limitations in the future.

The criterion for choosing a framework is the one with which you have more experience. By and large, there is little that distinguishes them: there is no difference in the simplicity of the code, performance or speed of development (the latter depends only on the skill of the coders). We often use a bundle of Bitrix and ZendFramework or Laravel.

What is a "clean build"?

A long time ago we chose Bitrix to write websites on it. Gradually, while we were doing something on it, we accumulated a large number of our own solutions — files with already established patterns of writing code for specific elements (classes, settings, and so on). And now, not every programmer installs Bitrix for himself anew, but takes a copy of the standard set of ready-made solutions that are already stored on our test server. "Deploy a clean build" means to take a copy of what is already on the disk.

A clean build on Bitrix is when there is no data associated with some client, there are no configured integrations, but there are many templates and code blanks needed for the rapid development of a new site. If there are new cool solutions that we have applied on some projects, we add them to a clean build.

Also in the pure assembly there are special classes for working with the database (which are not in Bitrix) — the so-called models. Despite the long history of Bitrix development, it is still not very convenient to work with its infoblocks. Since the most common thing that is required when working with a site is to get some data, somehow process it and output it, in a clean assembly we wrote our own classes for working with the database.