2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
I have been working on the project for a while. I would like to share some of my personal thoughts and feelings during my spare time after get off work.
Several capabilities that the front end should have:
(1) The ability to prepare fake data (simulated data). Sometimes the backend interface is not ready and the frontend has no data. However, the schedule is tight and we cannot wait for the backend. The frontend must be able to create simulated data.
(2) The ability to skip a certain business logic. If a closed-loop business requires 5 steps to complete, if step 2 is stuck, then step 345 cannot proceed. Of course, it is a good idea to trouble the backend to modify the database, which is simple and crude. If it is a last resort and it is in a development environment, I think it is okay.
(3) Data processing capabilities. Sometimes, if the data is processed well by the backend, it is easier for the frontend to render directly. However, if the data returned by the interface cannot be used directly, the frontend needs to perform some data processing before rendering the page. Sometimes the workload of data processing is relatively large. This is a relatively vague question. You need to consider who should do the data processing work?
(4) Verification issues. Front-end verification can replace back-end verification and save a lot of verification work, but there will be problems if you use the Postman interface tool directly for testing. In some scenarios, verification issues are better handled by the front-end, such as form verification; in other scenarios, such as repetitive retrieval of large amounts of data, back-end verification is definitely the solution. It still depends on the specific scenario.
(5) When multiple projects are being developed simultaneously, what should be done if the backend development environment operation affects the iterative development of different versions of the frontend?
(6) Code branch management. Code management is particularly important when there are many projects or when the same project needs to iterate multiple versions at the same time. In previous projects, there was no standard in this regard. As the projects became more formal and more branches were written, new insights gradually emerged. It is indeed necessary to maintain this area. If code is lost or the project is released without merging the code, it is a serious release accident.
(7) The ability to encapsulate components. Here I would like to share some of my own thoughts. Based on my personal experience, I think that front-end components can be simply divided into common general function components and business components that implement business. General function components implement general functions that are common in the system and can facilitate the development of similar functional businesses in the future. Business components are closely related to our business needs. The data and logic in them are strongly coupled with our business and generally cannot be placed in other pages for use. One thing we really need to consider when encapsulating components on the front end is to avoid putting business data and logic into such general function components as much as possible. This will cause some code coupling, and it will be difficult to operate our project as it gradually becomes robust. Therefore, when operating components, try to prepare data and logic in business components. If we have to do this, it is best to write notes and try not to affect the previous code logic. I did run into this problem when I first started working on a project. As a result, too many ifs and elses were added to a table component that was originally encapsulated. I think it was because it was too tightly coupled with the business. On the other hand, the frequent iterations, long cycles, and many people involved made it more difficult to change. So in terms of encapsulating components, I have gradually discovered some points that can be optimized in the current project development. If you want to encapsulate components in subsequent project iterations, you should try to avoid some problems. This is also something that needs to be further optimized if there is sufficient time and schedule. After all, this can make it smoother for us to use components.
to be continued...