


What is the difference between front-end and back-end separation and non-separation?
Difference: When the front-end and back-end are not separated, the effects seen on the front-end page are controlled by the back-end, and the back-end renders the page or redirects, that is, the back-end needs to control the display of the front-end and the coupling between the front-end and the back-end. The degree is very high. In the separation of front-end and back-end, the back-end only returns the data required by the front-end, no longer renders HTML pages, and no longer controls the effects of the front-end. The coupling between the front-end and the back-end is relatively low.
#The operating environment of this article: windows10 system, thinkpad t480 computer.
Related recommendations: "Programming Video"
1. The concept of front-end and back-end separation
1. Front-end and back-end separation
- Front-end and front-end separation is an architectural pattern. To put it simply, the page cannot be seen in the back-end project
(JSP | HTML)
, the back-end provides an interface to the front-end, the front-end just calls theREST
style interface provided by the back-end, and the front-end focuses on writing the page(html|jsp)
and rendering(JS|CSS|Various front-end frameworks)
; Just focus on writing code on the backend. - The core of front-end and back-end separation:The background provides data, and the front-end is responsible for display
1. Software architecture model
Most familiar with the MVC
design pattern, Model—View-Controller
Model-View-Controller
- How it works ? In layman's terms: you enter a URL
(Request)
on the page, where does this URL go? Just call the interface(REST style)
. This interface is actually a piece of code (method) that accesses the backend. There are many methods in the backend. - How to determine which method is accessed? The interface is defined, for example:
177.25.26.7/idp/user/login
, whereidp
represents a
service (a project),user
represents a class,login
represents the specific method to be called. Once you press Enter, the backend method is directly called, and the backend method goes to the database(MySQL| Oracle|Others)
Get data. Each row of data in the database table represents an object, that is, aJavaBean
, which is finally saved to the collection frameworkusing
pojomethod ( List|Map|Set|etc.)
, the method returns this set, then the result of calling this interface is(Response)
gives you a result set, and the front end gets the data. Then it is displayed through the page(html|Jsp)
. What the user sees is what theView
layer does.
2. Reasons for separation of front-end and back-end
In the past, I heard that TDD (Test-driven development, test Driven development)
can improve the quality of the code, so we implemented TDD
; then, we heard that BDD (Behavior-driven development, behavior-driven development)
can deliver products that meet business needs For software, we implemented BDD; later, we heard that DDD (Domain-driven design, domain-driven design)
can separate business code and basic code, so we implemented DDD
. Today, I heard that front-end and back-end separation is very popular, so we implemented front-end and back-end separation - this is the legendary HDD (Hype-driven Development)
.
Process: TDD -》 BDD -》 DDD =》 HDD
3. Advantages of front-end and back-end separation
The separation of front-end and back-end can well solve the problem of uneven division of labor between the front-end and front-end. More interactive logic is assigned to the front-end for processing, while the back-end can focus on its own work. For example, it provides API
interface for permission control and calculation work. Front-end developers can use nodejs
to build their own local server, develop directly locally, and then forward api
requests to the background through some plug-ins, so that they can completely simulate the line. scene and decoupled from the background. The front-end can independently complete the entire process of interacting with users. Both can start working at the same time without relying on each other. The development efficiency is faster and the division of labor is relatively balanced.
The advantages are summarized as follows:
- Improve development efficiency
- Perfectly cope with complex and changing front-end requirements
- Enhance code maintainability
2. The difference between front-end and back-end separation and front-end and back-end non-separation
1. The front and back ends are not separated
- In the application mode where the front and back ends are not separated, the effects seen on the front-end page are controlled by the back-end, which renders the page or redirects, that is, the back-end needs to control the display of the front-end, and the front-end and The backend is highly coupled.
- This application mode is more suitable for pure web applications, but when the backend is connected to
App
,App
may not require the backend to return aHTML
Web page, but just the data itself, so the original interface of the backend that returns the webpage is no longer applicable to the front-endApp
application. In order to connect to theApp
backend, another set of interfaces needs to be developed. .
2. Separation of front-end and back-end
- #In the application mode of separation of front-end and front-end, the back-end only returns the data of the front-end. The required data is no longer rendered, the
HTML
page is no longer rendered, and the front-end effect is no longer controlled. As for what effects front-end users see and how the data requested from the back-end is loaded into the front-end, it is up to the front-end itself. Web pages have their own processing methods, andApp
has their own processing methods. method, but no matter which front-end is used, the required data is basically the same, and the back-end only needs to develop a set of logic to provide data to the outside world.In the application model where the front and back ends are separated, the coupling degree between the front end and the back end is relatively low.
- In the application model where the front and back ends are separated, we usually call each view developed by the back end an interface, or API
- . The front end adds, deletes and changes data through the access interface. check.
The above is the detailed content of What is the difference between front-end and back-end separation and non-separation?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



React front-end and back-end separation guide: How to achieve front-end and back-end decoupling and independent deployment, specific code examples are required In today's web development environment, front-end and back-end separation has become a trend. By separating front-end and back-end code, development work can be made more flexible, efficient, and facilitate team collaboration. This article will introduce how to use React to achieve front-end and back-end separation, thereby achieving the goals of decoupling and independent deployment. First, we need to understand what front-end and back-end separation is. In the traditional web development model, the front-end and back-end are coupled

How to use Java to handle form data interaction with front-end and back-end separation? With the popularity of front-end and back-end separation architecture, it has become a common way for the front-end to send form data to the back-end through AJAX requests. In this article, we will learn how to use Java to handle form data interaction with front-end and back-end separation. We will use SpringBoot as the backend framework and demonstrate the entire process through a simple example. First, we need to create a SpringBoot project and add related dependencies. in p

The separation of front-end and back-end is an upgrade that must be carried out in project management when software technology and business develop to a certain extent. It is a necessity and not an accident! To put it bluntly, it is an adjustment to the company's departmental structure.

With the continuous development of front-end technology, the architectural model of separation of front-end and back-end is becoming more and more popular. The advantages of front-end and back-end separation are obvious. The front-end and back-end can be developed independently, each with its own technology selection and development rhythm, which can improve the maintainability and scalability of the system. As a popular front-end framework, Vue can bring a better user experience. This article will introduce in detail how to use Vue to implement the architectural pattern of front-end and back-end separation, and demonstrate the interface docking method. 1. Back-end implementation For the back-end implementation, we can choose

Combination of Vue.js and Java language: realize front-end and back-end separation development. The front-end framework Vue.js and the back-end language Java are both very popular and widely used technologies at present. They each have strong capabilities in front-end and back-end development. . Combining Vue.js with the Java language can achieve separate development of front-end and back-end, making project development more efficient and maintainable. This article will introduce how to use Vue.js and Java language for front-end and back-end separation development, and give corresponding code examples. CreateV

With the rapid development of Internet technology, the idea of front-end and back-end separation is increasingly widely used by developers. The separation of front-end and back-end can separate and parallel the development of front-end and back-end, improve development efficiency, reduce development complexity, and improve system performance and scalability. In an architecture where the front and back ends are separated, the front end requests data from the back end through the interface, and the back end processes the requested data and then returns it to the front end. In this process, Nginx can play a role in transmitting and forwarding data through reverse proxy technology. This article explains how to

With the rapid development of the Internet and the increasing number of hundreds of millions of users, the demand for high-quality, high-performance Web applications is also increasing. In this context, the PHP project development model with front-end and back-end separation is increasingly favored by people. This article will introduce the development practice of PHP projects with front-end and back-end separation, including development process, technology selection and precautions. 1. The concept of front-end and back-end separation. Front-end and back-end separation refers to developing and deploying the front-end and back-end of a web application separately, and conducting data interaction and business logic through interfaces.

In front-end and back-end separate development, the debate over the choice between Go language, PHP, and Java. With the rapid development of the mobile Internet, the front-end and back-end separate development model is becoming more and more popular. In this development model, the front end is responsible for the display and interaction of the user interface, while the back end is responsible for processing the logic and persistent storage of data. Regarding the choice of back-end languages, the more common ones currently on the market include Go language, PHP and Java. So how to choose between Go language, PHP and Java? This article will focus on performance, development efficiency and ecological environment.
