The origin of the matter is as follows: A planet friend invited Songge to answer a question on Zhihu. The original question was:

  • Technical advice for Java backend programmers in the era of back-end separation?

Songgo looked at this problem carefully, and felt that there might be such a question for friends who contact with the separation of front and back ends for the first time, so he decided to talk about this topic with everyone through this article.

I’ll try to speak from the perspective of a Java programmer, so you can understand it better.

Start with a digression

As many of you may know, Songo went to school of Economics and Management as an undergraduate, but he knows a little bit about Adam Smith’s The Wealth of Nations. It is mentioned in the book that the essence of human society is division of labor and cooperation. Adam Smith believed that professional division of labor among human beings can greatly improve productivity and create wealth, and professional division of labor is also the foundation of the industrial Revolution. The development of human society is a process of continuous refinement and deepening of professional division of labor. From the earliest division of agriculture and animal husbandry to the division of industry and agriculture to the emergence of businessmen, in fact, are the embodiment of continuous refinement and deepening of professional division of labor.

Our development world is also a small universe, and specialization is also a trend. From this perspective, the separation of front and back ends is worth embracing.

There are two reasons for the sudden upsurge in development in recent years:

  1. Front-end development. After the development of recent years, the front-end is no longer the TRADITIONAL HTML+ drawing. Various concepts emerge in endlessly, such as Webpack, RxJs, Node, Redux, SSR, NuxtJs, etc. The front-end has been capable of many things and can also complete richer user interaction.
  2. The development of mobile Internet. In the past two years, with the boom of mobile Internet, many companies’ products have to be launched on multiple platforms, Android, iOS, small programs, public accounts, PC and other platforms have to be displayed. It is impossible to develop a back end for different devices, but multiple front ends share the same back end. This is not the traditional way to develop back-end programs. It is this business requirement that drives the development of front – and back-end separation.

Variable with the same

The way programmers work with each other changes, and so does the way they develop. But the changes are subtle and easy to pick up.

change

  • Change of job content

To be honest, after the separation of the front and back ends, the requirements for Java programmers are lower. Before everyone went out to interview Java engineers, if the front and back ends are not divided, the front end is basically required to ask, common questions are various element selectors, which is also very understandable, because in the development of the front and back end is not divided, Back-end engineers write more or less front-end code, and it’s hard to write Java code entirely. But in this case, the front-end code you want to write is actually very simple, not particularly difficult.

After the separation of the front and back ends, Java programmers only need to focus on the background business logic, receive the parameters from the front end, and give different responses according to the parameters, without writing front-end code. This is because the front-end at this time is different from the front-end at any time. After the front-end is separated, the front-end is still difficult to some extent. SPA applications are more common, involving NodeJS and Webpack, etc. At this time, if back-end engineers are required to write front-end code, the technical requirements for back-end engineers will be relatively high.

On the other hand, if you can write both the front end and the back end without the front end, you can get your boss a raise.

  • The interface change

There’s very little interface design when you don’t have a front and back end, so in the case of SpringMVC, you’re always going to return something like A ModelAndView, and when you separate the front and back end, you basically don’t need to return pages, and the back end is going to return JSON data, so the key is to design the interfaces.

A good practice is to design interfaces that satisfy RESTful specifications, with clear semantics, simplicity, and knowing what you want to do when you see the URL!

  • Development process changes

When the front and back end are separated, the front end cannot wait for the back end to develop the interface. If so, the project that was done in two months may take four months to complete.

Generally before the development, the whole project team needs to design a good interface document, generally can use Swagger to do interface document (SpringBoot integration Swagger2, no longer need to maintain interface document!) , the detailed information of the interface is agreed in the document. The front and back ends are respectively developed according to the established interface specifications. When the development is not completed, Mock can be used to test.

The front end is also tested with simulated data. After the development, the front and back end interfaces are coordinated to complete the test.

The same

Except for the changes in the way the front and back end interact, everything else remains the same.

Front-end separation, in general, doesn’t affect the back-end technology architecture, you’re using SSM or Spring Boot or Dubbo or microservices, whatever it is, and these technology architectures can support either your projects that have no front-end separation or your projects that have a front-end separation.

So I say backend technology architectures are not affected by the separation of the front and back ends.

Technology, on the other hand, at the same, you are doing Java development, for example, should the SSM/SpringBoot/Redis/Nginx/Dubbo SpringCloud/MySQL/MyCat/ELK /… Wait, I have to do it all.

So, go ahead and polish the code!

conclusion

If only from the perspective of a Java programmer, the way of separating the development of the front and back ends actually frees the Java programmer to focus on the back-end work, instead of writing front-end code, we can write better back-end code with expertise. Still, if you want to stay competitive, it’s important to understand the current trends in front-end development.

Front-end separation is not the end, it is just a point in the evolution of software development. There is still a long way to go. There is still a lot to learn.

Finally, I would like to recommend some of songo’s previous articles on the separation of the front and back ends:

  1. A Java program ape eye for front and back end separation as well as vue.js introduction
  2. Spring Boot + Vue end separation, two kinds of file upload methods summary!
  3. Spring Boot + Vue front-end and back-end separated development, front-end network request encapsulation and configuration
  4. Spring Boot + Vue before and after the separation of development, permission management ideas

Two more introductory projects are recommended:

  1. Micro personnel
  2. V tribe

Well, that’s all for this article. If you have any questions, please leave a comment.

Pay attention to the public account [Jiangnan little Rain], focus on Spring Boot+ micro service and front and back end separation and other full stack technology, regular video tutorial sharing, after attention to reply to Java, get Songko for you carefully prepared Java dry goods!