Ray Dalio, one of the most successful investors of all time describes success as a path in which you climb a series of mountains, and, once on top of one of them you realize that the next one is taller and more difficult to climb,
This never-ending cycle brings you to higher goals and higher success during your life and career.
How do you know which one is the next mountain to climb, and what if you are going it the wrong direction?
To answer these questions, in this blog post, I describe the whole world of web development giving you a broad vision of what is its history, how it evolved throughout the years and the current situation and tools.
In the following episodes, we will delve into the details of the language and its future prospects.
PHP is one of the most used programming languages for the web nowadays ,
But the web has a much longer history than PHP itself.
Before going into detail and revealing all the secrets of PHP, let's see what the web is and where it comes from.
It all started during the year 1969.
Researchers from the ARPA, a government agency based in Los Angeles, sent the first pieces of data to another site that resided in Stanford, still in California but several miles to the north.
The technology used at that time was called the ARPANET, before the end of the year, two more computers were added to the network.
The Arpanet project was such a success from its initial phase that in 1971, only two years after the first communication via the web, another 15 computers were added to the network covering different parts of the American soil.
Improvements to the network were immediately visible,
in 1972 emails, a tool that we use a lot nowadays was introduced.
The first international connections were established just a year later in '73.
The USA is connected with the United Kingdom and Norway.
During the 1980s, networks began to appear in rapid succession for several government agencies, including NASA and the energy department.
At that time all these networks were still difficult to use and each of them used a different protocol.
This was set to finish soon.
In 1989 a researcher at CERN in Switzerland invented the World Wide Web as we know it now.
The researcher was Tim Berners-Lee and it is thanks to him that today you can chat with your friends on Facebook or spend hours watching series on Netflix.
What Mr Berners-Lee did was provide a standard for different connected computer networks to communicate with each other.
It made communications incredibly easier and faster
Thanks to these advances, a primordial version of the Internet was published in 1990.
The first service provider that offered an internet connection via telephone was in Brookline, Massachusetts.
From there it was a complete climb, in '93 the first search engine was launched, it made the web searchable and eliminated the need for indices.
In 1994 the data said that there were already 11 million Americans connected to the Internet.
In 1996 the web conquers mobile devices thanks to a Nokia product,
In 2000 there are already 1bln of online web pages, a little more than a dozen years later there would be a billion users on Facebook.
At the moment you are reading almost the whole world is connected online with fast connections and the G5 technology has already arrived between us and promises to make everything even faster
Being able to understand what HTTP is, is a fundamental one for anyone who wants to enter the world of web development.
HTTP is an acronym and stands for " Hyper Text Transfer Protocol", and is the basic protocol for which you can view pages online.
Understanding how the HTTP protocol functions is not at all complicated, there are only a few points that need to be carefully observed.
Let HTTP be your waiter
This protocol follows the Request/Response standard , where we have a client and a server.
The client, through a web browser, communicates the request that is to be handed down using the HTTP protocol to a server that responds by sending the requested data, it can be both a physical server and in the clouds, it does not really matter.
An easy to understand comparison is one of a customer at the restaurant, the customer (client) orders a meal (request) to the kitchen (server/cloud), the kitchen responds (response) by sending the requested dish to the table (web browser), everything happens through the use of a waiter (protocol).
Application Layer Protocol
Communication between two objects occurs through the use of different protocols and levels.
HTTP is an application-level protocol,
It resides just above a transport layer protocol, which is the protocol that is in command and defines how information is transported.
In most cases HTTP uses TCP as a transport layer protocol, it doesn't matter how the data is transported, the only thing that matters is that a client receives the requested data and the server responds with the right data.
State, actually: stateLESS
The HTTP protocol has no status , what it means is that, by itself, it does not save and jeopardize the result of any request,
A widely used example is to throw a coin, regardless of the previous results the probability is always 50% you can throw heads 10 times in a row, the eleventh time you throw heads still has a 50% chance.
Same thing for a web request.
There are several techniques used to make the HTTP stateful protocol
Stateful is the opposite of stateless, and these techniques still manage to get data, previously saved, from a client.
It can be done through the use of sessions and cookies
There are different types of actions that a client can request,
They are also called request methods
Here is a brief description of each of them:
- GET Very simple to explain, the get method gets a resource from a page, it only needs to receive data and should never have other effects.
- HEAD The HEAD method requires a response similar to that of a GET request, But as specified using this method we are only asking to get the head and get all the meta-information, without having to worry about the body of the answer.
- POST The POST method orders the server to accept the entity included in the request as a new element of the web resource identified by the URI. This method is often used to create a new element on the page or to add a record to a database.
- PUT The PUT method has functions similar to the POST method, It requires the entity to be stored in the URL provided. If the URL refers to an existing resource, it is modified; if instead the resource does not exist yet the server can create the resource with that URI.
- DELETE Rather self-explanatory, when this method is used the specified resource is deleted.
- TRACE This method repeats the request received so that a client can see what changes have been made by the servers.
- OPTIONS The OPTIONS method returns all HTTP methods supported by the server according to the URLs specified.
- CONNECT This method converts the connection of the request into a transparent TCP / IP tunnel, It is used to make SSL (HTTPS) communication simpler via an unencrypted HTTP proxy.
- PATCH The PATCH method takes a given resource on the server and performs some partial changes on it.
Headers are nothing but small bits of information that the client sends together with the request and returns along with the response, the purpose of the headers is to modify the behaviour of the request.
It is used to indicate the type of content we want the request returns to if, for example, we want to send a request to a web page but we want the result to be in text format, what we do
is to indicate the type of content, same speech applies if we want an HTML or JSON file
Server Status Codes
These status codes are issued by the servers in response to requests made by clients.
There are 5 different categories or classes of responses available, they are categorized using the first digit of the status code, with it, there are usually two more digits and a warning message.
The 5 classes are:
- 1xx (Informative): the request has been received.
- 2xx (successful): the request has been received, understood and accepted, usually a correctly displayed web page returns the code 200.
- 3xx (Redirect): both the client and the server work correctly, but there is a problem with the web page served. Various actions must be implemented to complete the request successfully.
- 4xx (Client error): the request contains incorrect syntax or cannot be satisfied, the error 404 is famous in case of a request on use page does not exist.
- 5xx (Server error): the server failed to satisfy an apparently valid request, given the lack of feedback returned by a 5xx, for a web developer, this is the most difficult error to solve
This is the 404 page of GitHub, it has a real funny parallax effect go and try it
If you are new to web development, words like front-end and back-end may seem complicated and meaningless.
To be able to understand the difference between the two, just think about how a restaurant works.
I'm sure you happened to enter a restaurant,
After you have sat down on the table a waitress or a waiter approaches the table and asks you what you want to order.
The order is transferred to the kitchen, where expert cooks prepare the meal that promptly returns to the waiter who carefully hands it under your eyes.
The similarities with a web company are wasted.
A front-end developer is, the majority of the time, an expert in UX and design,
through its abilities, it is able to show you the web pages on the browser of your choice.
It is said that it, therefore, works "client-side".
One of the first tools you must learn to use if you want to enter the web and HTML development mode,
Also invented by Tim Berners-Lee during his employment at CERN in Geneva in 1989
It creates the structure of the page and, not being a real programming language but only a markup language, IT IS INCREDIBLY EASY TO LEARN.
This language uses tags that are formed by codes or words surrounded by angle brackets.
At the time of writing, the latest released version is HTML5 and includes tags like aside, nav, article and footer.
Another fundamental tool is CSS that is the acronym for Cascading Style Sheets,
To make it easier, consider this:
HTML creates the structure of the page, like the foundations, the walls, the doors and windows of a house, the CSS takes care of beautifying the house.
It uses selectors to retrieve certain classes or elements of a web page and embellish them by adding features such as colour, decorations, but also the height and type of positioning
that the element must have on the page.
At the beginning of the internet, the pages communicated with each other via HTML and CSS files, as previously mentioned they are not programming languages and their power is limited to a few hundred commands.
In 1995 some developers at Netscape, (the most important web browser in those years) began to develop their own programming language viewable and usable on the client side instead of on the server.
If you've never heard of Netscape,
In this way, when a web page is downloaded from a user's web browser, the PC can also read a .js file that runs on the web browser.
They are CSS preprocessors,
CSS is a pretty stupid "language", you can't do almost any kind of calculation.
The syntax can be described as a selector and a set of commands that describe the characteristics that the selector must have.
With preprocessors, the music changes.
Here we are already at a level a little more advanced than front-end development. And the code becomes a lot more fun to write.
But above all much more powerful,
Sass & Less and the other peers of the same type make you capable of making calculations, adding conditions, mixing, functions but above all, and this is why I love them, they allow you to divide the style into different pages connected to each other.
You never have to use 3000-line CSS pages again.
Just create different files each with its purpose.
There are several online resources that teach CSS and preprocessors take a look at the youtube channel The NinjaNet
It is my personal impression and one of several peers that the syntax used by this language is not the best in both writing and reading the code.
It is for this reason that, when John Resig decided to create and publish Jquery, a library that simplifies language by leaving access to AJAX and event management, it did not take too long to become a worldwide phenomenon.
A little story about me,
Remember: As Mr. Miyagi taught you during the Karate kid movie, "first the fundamentals then the fun things"
At the time of writing there are several frameworks, the most popular are:
- React it is the top framework from 2017, technically it is nothing but a library but its speed and the number of components makes React the preferred framework for most front-end developers.
- Vue.js if you are new and at the beginning of your career, or if you are mainly focused on the back-end Vue is a great place to start. Created by Evan You a former Google employee with the idea of simplifying Angular, this framework saw its boom immediately after being chosen by Taylor Otwell as a built-in framework for Laravel.
Another feature of web programming is responsive design,
With the invention of smartphone and tablet devices, the need was created to make web applications available everywhere and to optimize all pages regardless of the screen used.
Gone are the times when tables were used to create HTML layouts, fortunately.
Now it's all based on media queries and screen ratios.
A principle taught in all web design specific schools is the one called Mobile First.
We start by designing a layout for the mobile, with few features that then go on to increase as the screens to consider become larger.
In the end,
the result should be complete and easy to develop an application for desktop screens.
Let's finally get to the juice of this article.
it is called "learn PHP" which is one of the main back-end languages.
Let's start with the definition.
What is the back-end?
The back-end consists of the whole mechanism that lives behind the scenes.
It consists of all the information and logic that are on the server.
As an analogy,
just think of the kitchen of a restaurant, you usually don't see the chefs at work but you know they are there and that, a few minutes after ordering, a succulent meal will arrive on your table.
The back-end works in the same way,
it does not use an interface but helps the user via connections with the information contained in the database and creates communications through different APIs.
A back-end developer must feel comfortable working with databases, both regarding their design, connection and sending and requesting information.
Do not forget a fundamental role for this type of software writing and data validation, it must be validated and secured before being saved on the server.
a back-end programmer must be able to understand and integrate his code with elements present on the front-end, if the user clicks on the "log-in" button there is a high probability that he wants to log into his account, etc.
There are several programming languages that, although they have the same purpose and fundamentals, differ in terms of syntax and operating principles.
Among the most important back-end languages we can name:
The main purpose of the back-end languages is to create useful functions for the user and to connect with the databases
There is a multitude of them for every language and new ones are released almost on a daily basis.
Among the most famous we can name Ruby On Rail (Ruby), Django and Flask (Python), Express (NodeJs).
As for PHP a while ago I wrote an article in which I reviewed 24 of the most popular frameworks, in that article I not only illustrated the features highlighting the pros and cons of each of them but interviewed the developers of some of giving them the vision of the creators.
Where to start in back-end programming?
for a beginner who wants to venture into server-side languages, it is advised to follow the established steps.
Evaluate the languages present and choose one with which to become profitable
Learn how to serve content to the client side of the application, deepen the knowledge of HTTP requests (described above) and API creations, connection with the database, save and request records.
As a professional PHP developer, I am sure you will forgive me if I write my opinion and some history regarding my favourite language.
As you can see from the title in this article we will focus mainly on PHP, here you will discover its basics to some of its secrets.
PHP was first conceived and published in 1994 by Rasmus Lerdorf.
In the beginning,
it was not a real language but consisted of a set of Common Gateway Interface (also called CGI) written in C.
The reason why Mr. Lerdorf started writing this language was very trivial, he simply wanted to track the number of visitors in his online resume.
The name he gave to this primordial script was P ersonal H ome P age tools,
Did you see it?
Given the success of this script and the speed of execution on the web pages, he decided to write a second version of the script, in which he added several improvements.
PHP 2.0 was published in 1995.
Unlike the first writing in this second version, the code was now able to interpret and extract information sent via a form.
It becomes the first official version of the language.
They did an enormous job in rewriting the language and gave a new name to the language that from 1998 onwards became PHP Hypertext Preprocessor.
PHP 3 and the first version with a code that is similar to the one we use now.
In 1999 Suraski and Gutmans formed a company called Zend and they rewrote PHP again by implementing new constructs, syntaxes and increasing performance.
With the publication of the Zend 2 engine, the fifth version of the programming language was also released, which presented several improvements to the OOP and more performing performance.
This edition was the last published for about 10 years, in fact, after having decided to skip PHP 6 completely, the core team of developers directly publishes the PHP version 7 in which you can see all the improvements in this series of posts I published at its release
The first thing to notice when we talk about the database is the word 'data'
Data are given about a single object (colour, height, size, format etc)
A database is a system that organizes different types of object.
To organize and manage a database you need a DBMS.
A DBMS is a collection of programs that enables users who can access the database to manipulate data and represent this data when requested.
The use of DBMS is not a new concept, the first data store was in fact invented by Charles Bachmen in the 60s.
Virtually everyone uses databases
Just think of your agenda which contains the names, addresses and phone numbers of your friends and colleagues.
Or to multinational companies that keep data concerning billing, problems with clients and various accounts.
There are different types of DBMS:
- Hierarchical It is structured like a tree with the nodes that represent the records and the different branches that represent the fields, today it is not frequently used anymore, A famous example of recent use is the Windows registry in Windows XP.
- Network DBMS The databases included in this category are able to create rather complicated structures, one of the main reasons is its support for "many to many" relationships.
- Relational DBMS The relationships in this type of database is in a table format, this database does not support "Many to Many" type relationships that are instead created through an interlude table. This has been and still is the most popular type of DBMS currently available on the market. Some of the most famous relational databases are MySql and Oracle.
- Object-Oriented This type of database defines the date that must be kept in the form of objects, each object has attributes that, like the fields of other databases, define the characteristics of a given element, a famous database is PostgreSQL
To query these databases you need to use a language called SQL (Structured Query Language) it is the standard language when dealing with relational databases.
SQL is used to insert, search, update and delete records within databases, it also helps in optimizing and maintaining the database itself.
NoSql represents a very large database category, originally they were created to handle a large number of database readings and writes, and scale horizontally.
As you saw earlier SQL allows you to create and manage very structured databases, the exact opposite, and Hadoop-type databases are much less common.
NoSql database is exactly in the middle,
They give a basic structure using key type relationships: value (name = "Mattew") but at the same time the structure is very free, in fact, the fields (the keys) can be modified even after the script has started.
One of the advantages of using NoSQL instead of SQL database is precisely the flexibility,
A NoSQL database can accept records even if the structure is not already in place.
Amazon DynamoDB is a database owned and operated by Amazon AWS.
It is a NoSQL type database which means it supports data structures with the key-value format
As mentioned, it is part of the group of services offered by Amazon Web Services.
Dynamo had a multi-master design
in which the client had to recover any conflicts.
DynamoDB instead uses synchronous replication on multiple data centres for high durability and availability.
DynamoDB was officially published in January 2012 to replace another AWS database called Amazon SimpleDB.
It is part of the NoSQL database category,
MongoDB uses documents, the format is JSON type.
MongoDB Inc. the company that created the database has licensed the software with Server Side Public License (SSPL).
MongoDB is considered as one of the best databases available at the moment, it supports field searches, query ranges and regular expressions.
Queries can also be highly customizable and return random samples of variable size.
MongoDB has been released in different versions, each designed for different use.
At the time of publication of this post, the versions that can be used are MongoDB Community Server, MongoDB Enterprise Server, MongoDB Atlas.
MongoDB also holds an annual developer conference hosted by MongoDB, Inc called MongoDB World.
As you saw in the HTTP section, communication between different machines via the Internet is possible through a set of rules and protocols.
One of the protocols is FTP which is an acronym for File Transfer Protocol.
File Transfer Protocol is a network protocol that is used to transfer files from a machine, usually called the client and another, the server).
This communication takes place within a computer network.
The FTP protocol is very old, in fact, its first use date back to before the operating systems use graphical interfaces.
FTP is based on a client-server model architecture.
It uses control connections and separate data between the machines.
Users can use this protocol both anonymously and with clear access,
using username and password.
This protocol also supports secure connections, reserving access via SSL / TLS (FTPS) or replacing access with SSH File Transfer Protocol (SFTP).
Nowadays FTPs client software have been developed, and it is possible to use them both on Windows operating systems, on Unix and Linux both on desktop and on mobile devices
Even if the technology is advancing at ever higher speeds, sometimes it happens to be in front of software and more general ideas that radically change the way we develop web applications.
One of this software is without a doubt, Docker.
Surely you happened to have working code in a machine but that when moved to another one stops working without any warning.
Think about how serious this problem is in companies where there are 5, 10 or 1000 different programmers.
Docker solves this problem once and for all.
Docker is a software development platform that makes it extremely easy to develop and produce apps in virtualized containers.
It allows applications to work in the same way regardless of the machine in which they run.
As mentioned docker uses containers that can be deployed in any machine without complexity.
These containers work like small computers within your system, each with its own operating system and their isolated CPU.
A developer starts by accessing an account on DockerHub an online repository of Docker containers and pulls a container with a pre-configured environment.
In a way,
the logic behind Docker resembles that of Virtual Machines but here the resources are shared so you can run more containers at once.
Once you have learned how to use Docker and feel ready for the next step, you can switch to Kubernetes.
Kubernetes is a platform that allows you to work better with containers.
Kubernetes also works with other container systems, you don't have to use Docker.
The main use of Kubernetes is to improve the work process and increase the scalability of web applications that live in containers.
Kubernetes provides three main advantages, better use of the deployment, better management of scalability and the possibility to monitor an application.
Continuous Integration and Continuous Deployment are relatively new practices in the world of web development.
Although the two approaches are very similar, one even implements the other, there are differences between the two that need clarification.
Let's start with Continuous Integration (abbreviated CI)
The concept of CI is very simple. In a team of engineers, all work on a different part of the code at the same time, allowing us to integrate small pieces of code modified by one or more developers in the master code.
After each change that is pushed towards the master code, the application takes care of automatically running a series of tests that check the code.
If the modified code passes this series of exams and no error returns the code goes to the next phase,
the code contains problems, the CI application returns an error message that tells the programmer that something is wrong as it should.
The basic idea is that as developers we want to capture errors as soon as possible instead of under stressful situations directly in the production environment.
Continuous Deployment is often mistaken for Continuous Delivery.
Automated deployment is the ability to obtain software deployed in any environment (be it staging or production) at any time,
Continuous Delivery is the ability to deploy this software in any environment (be it staging or production) at any time,
Every change a developer creates is automatically sent to the production environment.
Often Continuous Deployment is not recommended, especially for large '.com' companies,
on the other hand,
CONTINUOUS DELIVERY IS A PRACTICE THAT MUST BE EXERCISED, and that in the long run makes the software much more resistant and easier to handle.
The future is already here, I'm sure you've heard the term Cloud several times in recent years.
What is the Cloud?
To take an easy-to-understand example, think of a cloud in real life, it is made up of hundreds of thousands of water molecules that, when viewed from afar, appear as a single gigantic solid.
The concept in cloud computing is exactly the same, so many computers each with a specific task work in unison to provide a service that, in the eyes of the user, seems like using a single machine or server.
The advantage of using the cloud is the ease of use, speed, and security.
There are several Cloud services nowadays, let's have a look at the most popular together.
Amazon Web Service provides the foundation you can assemble to create any working structure you prefer.
At the time of writing, AWS is undoubtedly the most popular cloud platform and in many respects the best if compared to the competition.
The AWS payment scheme is incredibly profitable, you choose which services to use, and once created the system only pays for what you use, both in terms of services and in terms of usage time.
AWS is a collection of hundreds of different services that are designed to work together to create scalable solutions,
Delivered online, it gives the user storage, low-cost computing, databases, and dozens of tools that allow you to better manage these resources.
All the files and services of the application that we decide to use are available in various copies through different datacenters around the world, in order to lower redundancy and be available even in case of natural calamities.
It supports many of the operating systems, tools and programming languages that you prefer to use.
Here is another cloud platform,
You may have already heard of Azure Services, it is a service that allows developers to create, deploy and manage applications.
Azure uses a technology called virtualization,
Azure uses a Hypervisors to separate the association between a CPU and a machine's operating system.
The Hypervisor simulates all the CPU functions in a virtual machine, and indeed, allows you to create different virtual machines that run on different operating systems at the same time.
Even Microsoft like Amazon, has dozens of data centres around the world, to make our files safe and always available.
Azure uses the orchestrator concept.
An orchestrator is a software that is responsible for everything that happens within Azure, how to manage files and respond to user requests.
It does this through the use of its web API which is called via the Azure portal.
we must admit that the start was not the strongest and it left so much gap to the competition but in 2019 according to various surveys, the product of the company based in Menlo
Park has not only gained ground but it is now seen as one of Dev-Ops favourite cloud services from web developers.
The reasons are easy to understand, still having a lower customer base than Azure and AWS the prices for services are lower, offering in many cases equal or even better performance.
Another point to consider is security.
All data travelling through Google's data centres is encrypted,
He has worked for years and continues to have business associations with some of the most important ISPs in the world, it is a fundamental factor when it comes to security and data transmission.
The web development field is enormous in size and it increases every year with new technology and new cool stuff.
In this blog post,
I have just touched the surface, providing you with an overview of all the most important concept,
On the following part, there will be special consideration of the PHP programming language with a detailed description of the Object Oriented principle, design pattern and security,
Then we will conclude the series with all the ecosystem, going from Composer to the detailed review of the most important PHP frameworks and several web development tools.
eventually, you will see the state of the competition and various CMS to end up with PHP 8 and its rumours.
A lot of content is on my blog and a lot more content is coming, Subscribe to the mail list to be notified as soon as it will be published.