I thought it would be easy to write backend if I knew JavaScript. In my imagination, it's simple because Node is JavaScript and you don't need to learn a new programming language. But how wrong I was. To study the backend is not easy. It took me years to develop and I will even say more, I am still learning constantly. I used to think that frontend and backend are the same because it's just code. However, as it turned out, my ideas were a big mistake. Frontend and backend are generally different beasts. I had to understand and accept their differences to master the backend well. If we explain the difference between frontend and backend in terms of implementation, we can say that frontend is perception and backend is communication.
Frontend is perception
When we develop something on the frontend side, we care about how users will perceive what we created. We always have a question in our head: “Does it look good? Does it make sense? Is it user-friendly? Is this available? Is it fast? ”We care about users and spend a lot of time searching for answers to these questions. There is a constant improvement in what the user sees. To this end, the following things are added: video/image/ gif; animations; a variety of color themes. But with each additional feature, we also have to consider their possible implications: “Are videos/images/ gifs too big? What if someone doesn't support our animations? The user prefers a light or dark theme? ”We consider many things from the user's perspective.
So I say that frontend is perception. We think about our users. And we build for them. Unfortunately, some developers are fooled into thinking that users are guessing as to how an element should work. They create websites for themselves instead of creating sites for people.
Backend is communication
When I say backend, I mean the stage between the frontend and the database. You can also say that this is the stage between frontend and any API that you want to contact.
When working on the backend, we notice that we do not create interfaces here. No need to fill out forms or push buttons. Backend is not a perception. No one should see anything. You just have to make it work. How to accomplish this task? As described above, the backend exists to allow and link between the frontend and the database (or any external API).
Imagine a telephone operator in the early days. If you were calling someone on the phone, these operators had to manually connect your call to the person you are calling. If they were wrong, you were calling the wrong number.
When you create a backend, you are kind of a telephone operator. You put things together to make them work. When developing backend, developers often ask themselves the following questions: “What information do we need from frontend? What information do we need to send to the database / API? Has the database / API operation been saved correctly? What information to retrieve from the database / API? What information should we send back to the frontend? Do we render a website? If so, which page should we display? What to do when information is incorrect or missing? ” Plus, you need to take care of speed and reliability.
Conclusions
When I started studying the backend, during the first days of the lessons, I identified some general patterns. I assumed things worked a certain way. Then I searched Google for ways to do things the way I thought (Google's results were empty). Then he broke it and did his structure. And all this to find out (much later) that my path is wrong. Almost always I was wrong because I was subconsciously relying on my experience with frontend when studying backend. I had to refine my thinking. Here is what I would advise you. Don't assume you don't know anything about what you learn. You are almost always mistaken. Act slowly so you have the time and space to study. Always check when you study, train your brain and memory.
Link at: https://zellwk.com/blog/frontend-vs-backend/