How to design a Java MVC framework

First of all, you should understand the main purpose of mvc framework: to separate view from logic, that is, to reduce the coupling between interface and code. I don't know if you're asking about mvc in java or mvc in dot-net, but the purpose is the same.

1. Rewrite routing and addressing, the configuration is greater than the design. C of MVC is the most important, that is, the controller is the most important, especially when your project is getting bigger and bigger, the modules are becoming more and more independent, and you should pay more attention to routing and addressing. Can effectively manage and develop different subsystems in the same project.

2. Dynamic matching. The dynamic and realistic information on all pages should be extracted as much as possible to make it match the data. Public information is generally stored in xml, while others are stored in the database. It is convenient for overall revision or upgrade in the future.

3. Layered development to reduce coupling. Minimize the coupling degree of interface layer, logic layer and data layer. For example, if you want to change the database, you only need to modify the code of the data layer, so the changes to the project are very small. Do not send the data found in the database directly to the UI layer. In this way, the transport entities between each layer must be defined.

4. Independent block, extensible. Can be as independent as possible into modules, so as to facilitate future maintenance and expansion. For example, you want to provide APIs for android and ios. You don't need to rewrite the same logic, just use the module directly.