Have you happened to talk to the back-end developers about their sphere of business? Was it comparable to speaking to a foreigner? If yes, this guide is for you.
When you listen to these foreign words, a heap of questions runs through your mind: What is an API? When do we apply databases? And who is Json?
All these words are about a server. So let’s unveil all the truth about this notion and form more or less bearable conception of how it works.
Today’s life is so dependent on message systems that not participating might be regarded as a sign of bad manners. People send private messages, corporate e-mails, negotiate important business issues through popular apps, leave on-line requests, comments and take a great advantage of that possibility.
Moreover, the speed of communication is so fast and the means of transmitting is so convenient that most people naturally perceive the process of message delivery as a direct interconnection between devices. But they overlook the core part that makes this communication work, in particular, the server and its important role.
Talking about the web, we may clearly outline that the diversity of apps proves that this way of accessing the web has leaped forward and won the trust of users, leaving browsers far behind. But we should understand that the app is only one side of bigger something which is developed to make access visually and graphically easier for users. This part is called the front-end, and it is what we as consumers see when surfing the Internet via browsers or apps.
Let's go further and look at what we can't see but want to be somehow aware of in the times of fast IT development. The invisible to the user part is the back-end or the server. It is responsible for the whole process of information delivery. But how does it work?
A server is a computer that is connected to the internet and runs non-stop. Its responsibilities are data storage and transmission of information.
So, when you send a message on your phone, the app you use sends the message up to the server, where it is stored till your interlocutor checks in with the server. When the he does it, the server sends him all messages addressed to him.
If the app needs any information, it asks the server. When the app needs to connect to another user on the app, the server provides that connection.
The terms server, back-end, and API (application programming interface) are often perceived as the whole.
Let’s see what kind of information the server can store:
1. Photos, videos, and documents, which are stored in a structured way like files in folders on your computer.
2. Information required for apps proper work.
The information is organized similarly to spreadsheets. It may be user information, their login details the app requires for authorization. Or, for example, if your app is a restaurant directory, the server would store information about restaurants.
Apart from just storing the information, the server also remembers relationships between pieces of information. It memorizes users' preferences or the relationships the user maintains with particular pieces of information. For example, if you like this or that restaurant on the app, the server gets to know about it and records it.
This option makes possible to answer the following questions:
How many people like this restaurant?
What restaurants does this user like?
What cuisines do both of these users like in common?
Databases are space where all information and relationships between its pieces are stored. There are different kinds of databases, but despite this fact, they all have some common features:
• They store information
• They store relationships between pieces of information
• They respond to a query when there is need to obtain necessary information. And databases are able to provide this information in the amount you asked in your query.
Every type of database has its pros and cons and is not the aim of this particular article. So if you’ve ever heard something like SQL, MongoDB, CouchDB, and Redis, knowing that all these terms are for databases is enough.
One more function the server is responsible for is the information delivery. It means that the server’s work involves a countless amount of interconnections with apps and other servers, which is similar to communication that people use in their daily lives.
Let’s see what helps the server cope with such complicated tasks. Imagine that you search for particular information on the Internet. All that you write is sent to the server which provides you with the results. Another case: you send a message to another user. Accept it or not, but your message first goes up to the server and only then it’s sent to the user’s app, frequently in the form of a push notification. The way users communicate with the app on any device is called UI (user interface). It facilitates interaction between humans and computers.
The interface that developers create to support communication between servers and users’apps is called API. It serves as a software program interface which aim is to facilitate interaction between machines. So you see, while people enjoy smart and clear interfaces of their apps, servers and apps take advantage of structured and well-developed APIs. APIs have layers; one particular function in API is called an endpoint.
Despite a common goal to provide clear communication, two interfaces (UI and API) take absolutely different approaches to how they do this. The first is based on inputs and outputs which are easily understood by people. For example, as a user, you make a query with help of touch or voice and receive the feedback (output) in the form of images on the screen.
Another story goes with communication between machines. They use quite plane from the user’s point of view languages and formats to facilitate communication which absolutely lacks visualization.
The two most common communication format used for back-end communication are JSON and XML.
XML on the left and JSON on the right.
Servers can’t respond to the query without apps the same way as the user can’t send a message or the query without apps or browsers installed on their devices. A server application is built using specific frameworks such as Ruby on Rails, PHP, ASP.NET, Java, and Node.js.
The API is the door to your server, and users’ apps know how to call there. While your database is storage, your server application is the one that knows where everything is stored. It listens and responds to requests that come in on the API from users’ apps, inserts and retrieves information from the database, and makes decisions. For instance, when the user’s app sends the user’s login, the request comes in through the API, and the server’s app compares this information received through the API with the login stored in the database and respond to the user's app through the API.
Servers are of two kinds: virtual and physical, where the later might be really heavy and of an enormous size.
The companies like Facebook and Google have hundreds of servers all over the world. With millions of users involved, big companies prefer running their own servers as it’s cheaper and offer better performance, while smaller developers use cloud service.
Amazon Web Services, Azure, and Digital Ocean are companies which provide this kind of service. They own and maintain the hardware, and the developer just uploads the server’s application. Thus, you may avoid writing the server’s app yourself and use back-end-as-a-service providers who’ve already cared about it.
Apps usually have a back-end component, but not all of them. You may check it by switching on an airplane mode on your phone. If the app doesn’t work, it’s connected to the back-end server. Though, many apps use cache.
KapKan Games hope that with help of a bit informal approach, our team has managed to simplify hard technical stuff for better understanding of what the back-end of an app is.