Designer for generating back-end code based on visual UML (Unified Modeling Language) model diagram
Through the back-end code designer based on visual UML model diagrams, the UML model diagram is optimized to be suitable for back-end code design and operation, and the problems of high learning costs and insufficient semantic consistency in the existing technology are solved, and efficient and standardized back-end code generation and optimization are achieved.
Patent Information
- Application Number
- CN202510079507.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-18
- Publication Date
- 2025-05-16
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology for generating back-end code based on visual UML model graphs has high learning costs and insufficient semantic consistency, which leads to the automatic generation of code not fully meeting the performance optimization needs, and developers need to manually adjust and optimize.
A back-end code designer based on visual UML model diagram is proposed. Through the establishment, transformation, storage, code generation, integration, deployment and testing of UML models, the UML model diagram is optimized to be suitable for back-end code design and operation.
Automatically generate code frameworks and infrastructure through UML models, reduce the time for manually writing duplicate code, reduce code error rate, improve code design quality, meet performance optimization needs, and ensure coding specifications and consistency through automation tools.
Smart Images

Figure CN120010815A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of code design, and in particular to a backend code designer generated based on a visual UML model diagram. Background Art
[0002] In the prior art, UML is a standardized graphical modeling language used in the field of software engineering. It provides various types of diagrams, such as use case diagrams, class diagrams, sequence diagrams, and state diagrams, to help developers model and design at different stages of software development;
[0003] Therefore, generating backend code based on visual UML model diagrams can effectively improve development efficiency, improve the quality of code design, and ultimately reduce the error rate of code. However, there are still some shortcomings in generating backend code based on visual UML model diagrams, such as high learning cost and insufficient semantic consistency, which makes the automatically generated code unable to fully meet the needs of performance optimization and requires developers to manually adjust and optimize.
[0004] Therefore, the present application proposes a backend code designer generated based on a visual UML model diagram, which optimizes the existing visual UML model diagram to make it more suitable for the design and operation of the backend code. Summary of the invention
[0005] The purpose of the present invention is to solve the shortcomings of the prior art and to propose a back-end code designer based on a visual UML model diagram.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] A backend code designer is generated based on a visual UML model diagram, comprising the following steps:
[0008] S1: Establish the UML model, determine and judge the required UML model type and specific functions;
[0009] S2: Convert and store UML models;
[0010] S3: Select appropriate programming language and framework to generate code;
[0011] S4: Integration and deployment;
[0012] S5: Test and iterate.
[0013] Preferably: S2 further comprises:
[0014] Use JHipster to generate code skeletons from UML models and define UML elements based on mapping rules;
[0015] Use a template engine (such as FreeMarker) to generate code templates based on UML models;
[0016] After the UML model is established, the relational database is used to store the UML model data structure.
[0017] Preferably: the specific operation process of S3 includes the following steps: S31 generates basic code, S32 adjusts and optimizes.
[0018] Preferably: S31 further includes:
[0019] Generate the basic framework of the project according to the UML model, including directory structure and configuration files. Specifically, it includes: automatically generating entity class code, including properties, basic methods of getters / setters;
[0020] Generate service layer interfaces and implementation classes based on business logic;
[0021] Generate RESTful API or MVC controller code.
[0022] Preferably: S32 further comprises:
[0023] Modify and optimize the automatically generated code according to specific needs, and write unit test cases to ensure the functional correctness of each module.
[0024] Preferably: S4 further comprises:
[0025] Use object-relational mapping (ORM) tools (such as Hibernate and MyBatis) to map entity classes to database tables and generate database initialization scripts, including table structures, indexes, and initial data;
[0026] Set up continuous integration and continuous deployment processes, automate the build, test and deployment process, and package the application into Docker images for easy deployment in different environments.
[0027] Preferably: S5 further comprises:
[0028] Functional testing, which includes: unit testing, integration testing, and system testing;
[0029] Use APM tools (such as NewRelic, Prometheus) to monitor system performance and optimize code based on performance bottlenecks;
[0030] Iterative development collects user feedback, continuously optimizes and improves system functions, uses Git version control tools to manage code changes, and keeps the code base clean and traceable.
[0031] Based on the above solution: After the backend code is designed and produced, when it is unit tested, the testing method includes the following steps:
[0032] Determine requirements Understand the requirements of the software in detail, including input and output requirements;
[0033] Design test cases Design test cases based on requirements, covering normal situations, boundary conditions, and abnormal situations;
[0034] Write test code Choose appropriate black box testing tools, such as Selenium and Postman, to write and execute test code;
[0035] Execute test code according to the designed test cases and record the test results;
[0036] Analyze the results to compare the test results with the expected results, analyze the differences and determine if there are defects;
[0037] Quality assessment combines quantitative test coverage and defect tracking reports to comprehensively evaluate the quality of application software and the work progress and efficiency of the development team;
[0038] Modify the code to locate and fix defects in the code based on the test results.
[0039] Based on the above solution, it is preferred that the unit test also includes:
[0040] Use assertions to verify results, ensuring that each test runs automatically and provides clear result feedback;
[0041] Maintain the independence of unit tests and ensure that each test case does not depend on each other;
[0042] Make sure unit tests cover all parts of the code, including boundary values, normal input, and abnormal input;
[0043] When writing unit tests, use mock objects to isolate the interactions of the tested code with other dependencies.
[0044] Integrate unit testing into the continuous integration (CI) process to ensure that unit tests are automatically run after each code submission to detect and fix problems in a timely manner.
[0045] The beneficial effects of the present invention are:
[0046] 1. Automatically generate code frameworks and infrastructure through UML models, reducing the time of manually writing repetitive code. By creating system prototypes, it is convenient to discuss and verify requirements between buyers and sellers.
[0047] 2. Writing code through automated tools reduces the errors that may occur when writing code manually, while ensuring coding standards and consistent code style.
[0048] 3. As the core document of the project, the UML model facilitates communication and understanding among team members, effectively manages code changes, and keeps the code base clean and traceable.
[0049] 4.UML provides a variety of views (such as class diagrams, sequence diagrams, state diagrams), which can comprehensively describe all aspects of the system and support the modeling of complex systems. The UML model can be expanded according to specific needs, and custom elements and rules can be added to meet the specific needs of different projects. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of a process for generating a backend code designer based on a visual UML model diagram proposed by the present invention. DETAILED DESCRIPTION
[0051] The technical solution of the present invention is further described in detail below in conjunction with specific implementation methods.
[0052] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0053] Embodiment 1:
[0054] A backend code designer based on visual UML model diagrams, such as Figure 1 As shown, the following steps are included:
[0055] S1: Establish the UML model, determine and judge the required UML model type and specific functions:
[0056] Using Enterprise Architect as the UML modeling tool, the modeling process includes the following steps:
[0057] (1) Installation
[0058] First, access the Enterprise Architect interface and download the installation package;
[0059] Select the installation location and start the installation. After the installation, exit the installer and start the software.
[0060] (2) Create a new project
[0061] Create a new project on the EA main interface;
[0062] (3) Create a model diagram
[0063] Create a new package: Select "New" -> "Package" to store the model diagram, right-click on the new package, select "New" -> "Class", drag the class icon from the design panel to the canvas, open the property window, set the class name, properties, and methods, and use the relationship icons in the toolbar (such as inheritance, association, etc.) to establish relationships between classes.
[0064] (4) Draw the UML diagram
[0065] Select the appropriate UML diagram type (such as use case diagram, class diagram, activity diagram, etc.) according to the requirements;
[0066] (5) Code Generation
[0067] After completing the design of the UML diagram, generate codes in different programming languages through EA;
[0068] (6) Generate document report
[0069] Modify the source code type and language settings of the project as needed, then export the generated code and select the appropriate format to generate a document report, including PDF, RTF and HTML formats;
[0070] Identify entities and their attributes in the system. For example, in an enterprise management system, entities include employees, departments, and projects.
[0071] Implement the interaction between the system and the outside world, such as communication and connection between employees and customers;
[0072] The information of the displayed object is transmitted during the interaction process, such as the transmission of various files and data between enterprise employees and customers.
[0073] After describing the business process, operate the changes of the displayed objects, such as after-sales service between employees, departments, projects and customers, and changes in customer needs;
[0074] S2: Convert and store UML models
[0075] Use JHipster to generate code skeletons from UML models and define UML elements based on mapping rules;
[0076] Use a template engine (such as FreeMarker) to generate code templates based on UML models;
[0077] After the UML model is established, the UML model data structure is stored using a relational database. Preferably, in this embodiment, the diagrams table is used to store the basic information of the UML model, and the elements table stores the elements in the UML model.
[0078] S3: Select a suitable programming language and framework to generate code. The specific operation process includes the following steps:
[0079] S31: Generate basic code
[0080] Generate the basic framework of the project according to the UML model, including directory structure and configuration files, which specifically include:
[0081] Automatically generate entity class code, including properties, getters / setters and basic methods;
[0082] Generate service layer interfaces and implementation classes based on business logic;
[0083] Generate RESTful API or MVC controller code;
[0084] S32: Adjustment and Optimization
[0085] Modify and optimize the automatically generated code according to specific needs, and write unit test cases to ensure the functional correctness of each module;
[0086] S4: Integration and Deployment
[0087] S41: Use object-relational mapping (ORM) tools (such as Hibernate and MyBatis) to map entity classes to database tables and generate database initialization scripts, including table structures, indexes, and initial data;
[0088] S42: Set up continuous integration and continuous deployment processes to automate the build, test, and deployment process, and package the application into a Docker image for easy deployment in different environments;
[0089] S5: Testing and Iteration
[0090] S51: Functional test, which includes:
[0091] Unit testing: ensure the functional correctness of each module;
[0092] Integration testing: verifying the collaboration between different modules;
[0093] System testing: Simulate real user scenarios for comprehensive testing;
[0094] S52: Use APM tools (such as NewRelic, Prometheus) to monitor system performance and optimize code based on performance bottlenecks;
[0095] S53: Iterative Development
[0096] Collect user feedback, continuously optimize and improve system functions, use version control tools such as Git to manage code changes, and keep the code base clean and traceable;
[0097] After the backend code is designed and produced, when it is unit tested, the testing method includes the following steps:
[0098] 1: Determine the requirements
[0099] Understand the software requirements in detail, including input and output requirements. For example, for a login system, the requirements may include that users can log in with the correct username and password, and that corresponding prompts are given when errors occur;
[0100] 2: Design test cases
[0101] Design test cases based on requirements, covering normal situations, boundary conditions, and abnormal situations. For example, for a login system, you can design test cases to verify usernames and passwords in different formats (such as valid, invalid, empty, etc.);
[0102] 3: Write test code
[0103] Choose appropriate black box testing tools, such as Selenium, Postman, etc., to write and execute test code;
[0104] 4: Execute the test code
[0105] Execute the test code according to the designed test cases and record the test results. During the execution process, attention should be paid to tracking and managing the defects found;
[0106] After fixing the defect, rerun the relevant test cases to verify whether the defect has been fixed correctly. When executing the test code, it is fully automatic and non-interactive. Use assertions to verify the results, ensure that each test can be run automatically and provide clear result feedback, maintain the independence of unit tests, ensure that each test case is not dependent on each other, and ensure that unit tests cover all parts of the code, including boundary values, normal inputs, and abnormal inputs. When writing unit tests, use mock objects to isolate the interaction between the tested code and other dependencies, integrate unit tests into the continuous integration (CI) process, ensure that unit tests can be automatically run after each code submission, and find and fix problems in a timely manner;
[0107] 5: Analyze the results
[0108] Compare test results with expected results, analyze differences and determine if defects exist;
[0109] 6: Evaluate Quality
[0110] Combined with quantified test coverage and defect tracking reports, a comprehensive evaluation is conducted on the quality of the application software and the work progress and efficiency of the development team.
[0111] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A backend code designer based on a visual UML model diagram, characterized in that: The following steps are involved: S1: Establish the UML model, determine and judge the required UML model type and specific functions; S2: Convert and store UML models; S3: Select appropriate programming language and framework to generate code; S4: Integration and deployment; S5: Test and iterate.
2. A backend code designer based on a visual UML model diagram according to claim 1, characterized in that: S2 also includes: Use JHipster to generate code skeletons from UML models and define UML elements based on mapping rules; Use a template engine (such as FreeMarker) to generate code templates based on UML models; After the UML model is established, the relational database is used to store the UML model data structure.
3. A backend code designer based on a visual UML model diagram according to claim 2, characterized in that: The specific operation process of S3 includes the following steps: S31 generates basic code, S32 adjusts and optimizes.
4. A backend code designer based on a visual UML model diagram according to claim 3, characterized in that: S31 also includes: Generate the basic framework of the project according to the UML model, including directory structure and configuration files. Specifically, it includes: automatically generating entity class code, including properties, basic methods of getters / setters; Generate service layer interfaces and implementation classes based on business logic; Generate RESTful API or MVC controller code.
5. A backend code designer based on a visual UML model diagram according to claim 4, characterized in that: S32 also includes: Modify and optimize the automatically generated code according to specific needs, and write unit test cases to ensure the functional correctness of each module.
6. A backend code designer based on a visual UML model diagram according to claim 5, characterized in that: S4 also includes: Use object-relational mapping (ORM) tools (such as Hibernate and MyBatis) to map entity classes to database tables and generate database initialization scripts, including table structures, indexes, and initial data; Set up continuous integration and continuous deployment processes, automate the build, test and deployment process, and package the application into Docker images for easy deployment in different environments.
7. A backend code designer based on a visual UML model diagram according to claim 6, characterized in that: The S5 also includes: Functional testing, which includes: unit testing, integration testing, and system testing; Use APM tools (such as NewRelic, Prometheus) to monitor system performance and optimize code based on performance bottlenecks; Iterative development collects user feedback, continuously optimizes and improves system functions, uses Git version control tools to manage code changes, and keeps the code base clean and traceable.
8. The backend code designer based on visual UML model diagram generation according to claim 7, characterized in that: After the backend code is designed and produced, when it is unit tested, the testing method includes the following steps: Determine requirements Understand the requirements of the software in detail, including input and output requirements; Design test cases Design test cases based on requirements, covering normal situations, boundary conditions, and abnormal situations; Write test code Choose appropriate black box testing tools, such as Selenium and Postman, to write and execute test code; Execute test code according to the designed test cases and record the test results; Analyze the results to compare the test results with the expected results, analyze the differences and determine if there are defects; Quality assessment combines quantitative test coverage and defect tracking reports to comprehensively evaluate the quality of application software and the work progress and efficiency of the development team; Modify the code to locate and fix defects in the code based on the test results.
9. The backend code designer based on visual UML model diagram generation according to claim 8, characterized in that: Unit testing also includes: Use assertions to verify results, ensuring that each test runs automatically and provides clear result feedback; Maintain the independence of unit tests and ensure that each test case does not depend on each other; Make sure unit tests cover all parts of the code, including boundary values, normal input, and abnormal input; When writing unit tests, use mock objects to isolate the interactions of the tested code with other dependencies. Integrate unit testing into the continuous integration (CI) process to ensure that unit tests are automatically run after each code submission to detect and fix problems in a timely manner.