Software processing method and device
By analyzing the design pattern of the code of the target software, the design information of the design pattern is obtained, which solves the problem of users' difficulty in quickly understanding the software design intention and achieves a clear understanding of the software design architecture.
Patent Information
- Application Number
- CN202310886703.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-18
- Publication Date
- 2025-01-21
AI Technical Summary
The prior art is difficult to help users quickly understand and determine the design intention and architecture of software.
By performing design pattern analysis and processing on the code of the target software, the design information of at least one design pattern is obtained, so that users can clearly understand the design intent and architecture of the software.
It realizes the rapid determination of the design intention of the software and improves the efficiency of users' understanding of the software design architecture.
Smart Images

Figure CN119336298A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software engineering technology, and in particular to a software processing method and device. Background Art
[0002] In the field of software engineering, users can view and read the code in the software through some code reading tools. For example, the language server protocol (LSP) service (Server) is integrated in the integrated development environment (IDE) software. LSP Server provides some commonly used language services, including: reading code, finding where a function is called, finding where a parameter of a certain type is defined in a function, etc. For example, in Visio Studio Code, you can read C++ code by installing the C++ LSP Server.
[0003] Currently, users can only read the software code, which is not conducive to users' understanding of the code. Summary of the invention
[0004] The present application provides a software processing method and device for quickly determining the design intent of the software, thereby enabling users to clearly understand the design architecture of the software.
[0005] In a first aspect, the present application provides a software processing method. The method can be applied to Figure 1 The computing device in the system architecture shown. The method includes:
[0006] The computing device obtains the code of the target software; then, the computing device performs design pattern analysis on the code to obtain design information of at least one first design pattern; wherein the at least one first design pattern is used to represent the design intent of the target software.
[0007] Through this method, the computing device can perform design pattern analysis on the code of the target software to obtain design information of at least one design pattern contained in the software. In this way, the user or the computing device can quickly determine the design intent of the software through the design information of the design pattern in the software, so that the user can clearly understand the design architecture of the software.
[0008] Exemplarily, the computing device may perform design pattern analysis on the input code through a pre-trained design pattern analysis model (AI model), wherein the design pattern analysis module is trained based on multiple design pattern samples, and any design pattern sample contains a design information sample and a code segment sample of the design pattern. For another example, the computing device may identify the class names and call relationships in the code, thereby obtaining the design information of at least one design pattern based on these class names and call relationships.
[0009] In one possible design, the computing device may obtain the code of the target software stored locally.
[0010] In one possible design, the computing device may obtain the code of the target software stored locally through the following steps: in response to a first operation of a user in a first user interface, starting a code reading tool; wherein the first operation is used to start a design pattern display function; obtaining the code of the target software stored locally through the code reading tool; in this case, after obtaining the design information of at least one first design pattern, the computing device may also display a second user interface; wherein the second user interface includes a first display area, and the design information of the at least one first design pattern is displayed in the first display area.
[0011] Through this design, the computing device can start the design pattern display function through the user's local operation, and after obtaining the design information of at least one first design pattern, display it to the user in the user interface.
[0012] In one possible design, after displaying the second user interface, the computing device may also display a second display area within the second user interface in response to a second operation of the user in the second user interface; wherein the code is displayed in the second display area, and the second operation is used to start the code reading area of the code reading tool.
[0013] Exemplarily, the second user interface may include a button or menu for starting the code display function, and the second operation may be a click operation of the user on the button or menu in the second user interface.
[0014] Through this design, the computing device can open the code reading function in the second user interface through the user's operation, so that the code of the target software can be displayed in the second display area of the second user interface. In this way, the computing device can display the design information of at least one first design pattern in the target software through the first display area, and can also display the code of the target software through the second display area in the same user interface, so that the content displayed in the second user interface is richer and the user's reading efficiency is improved.
[0015] In a possible design, the second user interface further includes a second display area, and the code is displayed in the second display area.
[0016] In this design, the computing device directly starts the code reading function when displaying the second user interface. The second user interface in the initial state displayed by the computing device includes not only a first display area for displaying the design information of at least one first design pattern in the target software, but also a second display area for displaying the code of the target software. Through this design, after starting the design pattern display function, the computing device can display the design information of at least one first design pattern in the target software through the first display area, and display the code of the target software through the second display area in the same user interface without user operation, so that the content displayed in the second user interface is richer and the user's reading efficiency is improved.
[0017] In one possible design, the computing device may further save the correspondence between the design information of each first design pattern and the code segment; wherein the code segment corresponding to the design information of any first design pattern is the code segment from which the design information of the first design pattern is analyzed in the code; based on this, the computing device may further display in the second display area the code segment corresponding to the design information of the first target design pattern in the code in response to the user's third operation in the second user interface on the design information of the first target design pattern displayed in the first display area; wherein the first target design pattern is any one of the at least one first design pattern, and the third operation is used to select the design information of the first target design pattern.
[0018] Through this design, in order to further improve the user's reading experience, the computing device can synchronously display the design information of a first design pattern in the first display area, and display the code segment corresponding to the first design pattern in the second display area, that is, realize real-time synchronization of the display content between the two display areas.
[0019] In one possible design, the computing device may also save the correspondence between the design information of each first design pattern and the code segment; wherein the code segment corresponding to the design information of any first design pattern is the code segment from which the design information of the first design pattern is analyzed in the code; based on this, the computing device responds to the user's third operation in the second user interface on the design information of the first target design pattern displayed in the first display area, opens the second display area in the second user interface, and displays the code segment corresponding to the design information of the first target design pattern in the code in the second display area; wherein the first target design pattern is any one of the at least one first design pattern, and the third operation is used to select the design information of the first target design pattern.
[0020] Through this design, in order to ensure the user's reading experience, the computing device can open the second display area in the second user interface to start the code reading function based on the user's operation on the design information of the first target design pattern in the first display area, and display the code segment corresponding to the first design pattern in the second display area, that is, to achieve real-time synchronization of the displayed content between the two display areas.
[0021] In a possible design, the computing device may also display the code segment corresponding to the design information of the second target design pattern in the code in the second display area, and display the design information of the second target design pattern in the first display area in response to the user's fourth operation on the second display area in the second user interface. The fourth operation is used to cause the computing device to display the code segment corresponding to the design information of the second target design pattern in the second display area. Exemplarily, the fourth operation may be a page turning or line skipping operation on the code in the second display area, or a control operation on the scroll bar in the second display area.
[0022] Through this design, the computing device can also display the code segment corresponding to the design information of a certain design pattern in the second display area and display the design information of the design pattern in the first display area by operating the second display area. This design can further achieve real-time synchronization of the displayed content between the two display areas in the second user interface.
[0023] In one possible design, the computing device may also perform design pattern analysis on the edited code in response to the user's editing operation on the code in the second display area in the second user interface to obtain design information of at least one second design pattern; wherein the at least one second design pattern is used to represent the design intent of the target software update.
[0024] In this way, after the user edits and updates the code of the target software, the computing device can perform design pattern analysis and processing on the latest code of the target software in real time to obtain the latest design information of the design pattern.
[0025] In one possible design, after obtaining the design information of at least one first design pattern, the computing device may also compare the design information of the at least one first design pattern with the preset architecture information of the target software to determine the design pattern change information; wherein the preset architecture information includes the design information of at least one preset design pattern of the target software.
[0026] Through this design, the computing device can obtain the current design pattern change information of the target software, thereby protecting the software architecture of the target software and preventing the software architecture from being destroyed.
[0027] In a possible design, after determining the design mode change information, the computing device may further display the design mode change information.
[0028] Through this design, the computing device can remind the user of the design mode change information.
[0029] In one possible design, the computing device may receive the code of the target software from a remote device; based on this, after obtaining the design information of at least one first design pattern, the computing device may also send the design information of the at least one first design pattern to the remote device.
[0030] In a possible design, the design information of any first design pattern includes the type of the first design pattern and at least one design pattern role included in the first design pattern.
[0031] In a possible design, when the first design pattern includes multiple design pattern roles, the design information of the first design pattern further includes dependencies between the multiple design pattern roles.
[0032] In a second aspect, an embodiment of the present application provides a computing device, comprising a unit for executing each step of the method provided in the first aspect above. Optionally, the computing device comprises an acquisition unit and a processing unit; wherein the acquisition unit is used to acquire the code of the target software; and the processing unit is used to perform design pattern analysis on the code to obtain design information of at least one first design pattern. Exemplarily, the computing device may also include a display screen for displaying a user interface.
[0033] In a third aspect, an embodiment of the present application provides a computing device, the computing device comprising a processor and a memory; the processor is coupled to the memory, and the processor is used to read a computer program stored in the memory to execute the method provided in the first aspect. Optionally, the computing device also includes a display screen.
[0034] The computer program code includes computer instructions.
[0035] In a fourth aspect, an embodiment of the present application provides a chip, the chip includes a processor, the processor is coupled to a memory, and the processor is used to call a computer program stored in the memory at runtime to implement the method provided in the first aspect above. Optionally, the chip may also include at least one of the following: the memory, a communication interface, and a power supply unit. The memory is used to store computer programs, the communication interface is used to receive and send data; and the power supply unit is used to power the processor.
[0036] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer, the computer executes the method provided in the first aspect above.
[0037] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes a computer program; when the computer program is run on a computer, the computer executes the method provided in the first aspect.
[0038] The technical effects that can be achieved in any of the second to sixth aspects mentioned above can refer to the description of the technical effects that can be achieved by any possible design in the first aspect mentioned above, and the repetitions will not be discussed here. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 An architectural diagram of a software processing system provided in an embodiment of the present application;
[0040] Figure 2 A flowchart of a software processing method provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of design information of a design mode provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of a software processing example provided in an embodiment of the present application;
[0043] Figure 5 A flowchart of a software processing example provided in an embodiment of the present application;
[0044] Figure 6 A schematic diagram of a user interface of an IDE software provided in an embodiment of the present application;
[0045] Figure 7 A schematic diagram of another software processing example provided in an embodiment of the present application;
[0046] Figure 8 A schematic diagram of design mode modification information provided in an embodiment of the present application;
[0047] Fig. 9 A structural diagram of a computing device provided in an embodiment of the present application;
[0048] Fig.10 A structural diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The present application provides a software processing method and device for quickly determining the design intent of the software, so that the user can be more clear about the design architecture of the software. The method and the device are based on the same technical concept. Since the principles of the method and the device for solving problems are similar, the implementation of the device and the method can refer to each other, and the repeated parts will not be repeated.
[0050] Some terms in this application are explained below to facilitate understanding by those skilled in the art.
[0051] 1) Computing device, which is a device or apparatus with software running, data computing and processing functions. Optionally, the computing device has a display screen, so that a user interface can be displayed to realize the interaction between the device and the user. The computing device can also be called a computing device, a computing unit, etc.
[0052] For example, the computing device may be, but is not limited to, a computer, a tablet computer, a laptop, a netbook, a car computer, or other electronic device, and may also be a virtual machine, a server, a cloud service platform, or a functional module in various devices, etc. The embodiments of the present application do not limit the specific form of the computing device.
[0053] 2) Software is a collection of computer instructions and data organized in a specific order to implement a certain business or function of a computing device. The collection of computer instructions and data in the software can also be collectively referred to as the software code or source code.
[0054] Software is also called software program, and the two can be interchangeable. For example, according to the functional classification, software can include system software, application software, and middleware between the two. Among them, application software can also be called application (APP), application software or application program.
[0055] For example, application software (or application tools) used for software development may include, but are not limited to: IDE software, continuous integration (CI) software, Java development kit (JDK), .NET development platform, etc.
[0056] 3) Design patterns represent best practices and are usually adopted by experienced object-oriented software developers. Design patterns are solutions to common problems faced by software developers during software development. These solutions are summarized by many software developers after a long period of experience and mistakes. Users can understand the design intent behind the software through the design patterns in the software.
[0057] Design patterns are a set of code design experiences that can be used repeatedly and are known to most people. Design patterns are used in software development to reuse code, make it easier for others to understand the code, and ensure code reliability. As a solution that has been proven to be effective in many practices, design patterns have the following main advantages:
[0058] (1) Make software design solutions easier to understand and reduce the difficulty of communication among developers.
[0059] (2) Design patterns are proven effective solutions in practice and are the best solutions to certain specific problems. Therefore, when software developers face these problems, they can directly reuse these design patterns without additional design, thus saving software design costs.
[0060] (3) Object-oriented design principles such as the open-closed principle and the dependency inversion principle are widely used in design patterns, making the design more flexible and easy to modify and expand.
[0061] Precisely because design patterns have the above-mentioned advantages, they have been widely used in the field of software engineering. For example, design patterns are widely used in JDK class libraries and .NET frameworks.
[0062] For example, with the practice of software development, there are currently many design patterns. For example, 23 design patterns are mentioned in the reference book of design patterns. These patterns can be divided into three categories: creational patterns, structural patterns, and behavioral patterns.
[0063] Creational patterns include: Factory Pattern, Abstract Factory Pattern, Singleton Pattern, Builder Pattern, and Prototype Pattern.
[0064] Structural patterns include: Adapter Pattern, Bridge Pattern, Filter Pattern, Composite Pattern, Decorator Pattern, Facade Pattern, Flyweight Pattern, and Proxy Pattern.
[0065] Behavioral patterns include: Chain of Responsibility Pattern, Command Pattern, Interpreter Pattern, Iterator Pattern, Mediator Pattern, Memento Pattern, Observer Pattern, State Pattern, Null Object Pattern, Strategy Pattern, Template Pattern, and Visitor Pattern.
[0066] It should be noted that the above are some examples of design patterns and do not constitute any limitation on the design patterns provided in the embodiments of the present application. Other design patterns may also exist in software development practice.
[0067] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
[0068] In the embodiments of the present application, descriptions such as "when...", "in the case of...", "if" and "if" all mean that the electronic device will make corresponding processing under certain objective circumstances. It does not limit the time, nor does it require the electronic device to make a judgment when implementing it, nor does it mean that there are other limitations.
[0069] It should be noted that in this application, "used for indication" can include being used for direct indication and being used for indirect indication. When describing that a certain information is used to indicate A, it can include that the information directly indicates A or indirectly indicates A, but it does not mean that the information must carry A. Taking the first information used to indicate the first content as an example, the first information can include the first content, and can also include a part of the first content or an identifier or index of the first content, and can also include an algorithm for determining the first content, a calculation parameter, etc. This application does not limit the method of "indication".
[0070] In the present application, "including / comprising A" may be equivalent to "including / comprising A information". A information is used to indicate A.
[0071] In addition, it should be understood that, in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing the description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.
[0072] The embodiment of the present application provides a software processing method and device. Through this solution, a computing device can perform design pattern analysis on the code of the target software to obtain design information of at least one design pattern contained in the software. In this way, a user or a computing device can quickly determine the design intent of the software through the design information of the design pattern in the software, so that the user can clearly understand the design architecture of the software.
[0073] The solution provided in the embodiments of the present application is described in detail below with reference to the accompanying drawings.
[0074] Figure 1 FIG. 1 shows an architecture of a software processing system to which the method provided in an embodiment of the present application is applicable. Figure 1 As shown, the architecture includes a computing device and a hardware layer. Optionally, the architecture may also include an application layer.
[0075] The computing device can realize its own design pattern analysis function based on the hardware resources provided by the hardware layer. The unit or module in the computing device responsible for the design pattern analysis function can also be called a design pattern mining tool. Figure 1 As shown, according to the specific logical function division of the computing device, the computing device may include a code analysis module, a design pattern analysis module, and a design pattern output module.
[0076] The code analysis module has the function of obtaining, viewing or reading the code of the software.
[0077] The design pattern analysis module is used to perform design pattern analysis on the code after the code analysis module obtains the code of the software, so as to obtain design information of at least one design pattern of the software. Exemplarily, the design pattern analysis module can perform design pattern analysis on the input code through a pre-trained design pattern analysis model, wherein the design pattern analysis module is trained based on multiple design pattern samples, and any design pattern sample contains a design information sample and a code segment sample of the design pattern. For another example, the design pattern analysis module can identify the class names and calling relationships in the code, so as to obtain the design information of at least one design pattern based on these class names and calling relationships.
[0078] The design pattern output module is used to output the design information of at least one design pattern analyzed by the design pattern analysis module. For example, the design pattern output module can send the obtained design information of at least one design pattern to other devices or other functional modules of the computing device for subsequent processing.
[0079] For the specific form of the computing device, please refer to the terminology description in point 1) above, which will not be repeated here.
[0080] The hardware layer provides various hardware resources for the design pattern analysis function of the computing device, such as the computing hardware, storage hardware, and network hardware shown in the figure. Optionally, the computing hardware is used to provide computing and processing capabilities, and may include various dedicated or general-purpose processors, such as central processing units (CPU), graphics processing units (GPU), data processing units (DPU), etc. Storage hardware is used to provide storage capabilities, for example, it may include memory, hard disks, disks, or network attached storage (NAS). Network hardware is used to provide network communication capabilities, for example, it may include hardware with network devices such as network cards, gateways, switches, and routers.
[0081] It should be noted that the hardware resources provided by the hardware layer can be located inside the computing device, or in other devices or other equipment, or can be hardware resources provided by at least one physical infrastructure. For example, the system can use resource virtualization technology to abstract the hardware resources in at least one physical infrastructure device into virtual resources, thereby realizing the integration of physical hardware resources, and physically decoupling the hardware resources of the computing device and the hardware layer to provide virtual resources to the computing device.
[0082] The application layer includes various applications, such as IDE software and CI software for user software development shown in the figure. In addition, the application layer may also include other applications that can realize specific business (applications that have been developed).
[0083] It should be noted that the applications in the application layer can be installed inside the computing device or in other remote devices. The applications in the application layer can obtain the design information of the design patterns of some software through the design pattern analysis function of the computing device for subsequent processing. Of course, the software code for the computing device to perform design pattern analysis can not only come from the user's input, but also from any application in the application layer, and this application does not limit this.
[0084] Generally, when these applications in the application layer are running, they can display corresponding user interfaces on the display screen to achieve user interaction. For example, when the application obtains the design information of the design mode of the software through the computing device, the design information of the design mode can be displayed in the user interface, or the design mode change information can be displayed.
[0085] It should be noted that Figure 1As an example of a software processing system, it does not constitute any limitation on the application scenarios to which the software processing method provided in the embodiments of the present application is applicable. In practical applications, the software processing system may have other deployment forms. For example, the code analysis module may be a functional module that does not belong to the internal design pattern mining tool of the computing device, but is deployed outside the design pattern mining tool. For example, the code analysis module may be a code reading tool with code analysis and code reading functions integrated in some applications for software development.
[0086] At present, in some software development platforms in the field of software engineering, users can view and read the code in the software through code reading tools, but the code is composed of some computer instructions and data, which is not conducive to user understanding. Users may need to jump through the code continuously and read the entire content of the code slowly to roughly understand the design intent of the software. This method not only wastes manpower and is inefficient, but is also prone to misunderstandings, that is, users cannot quickly and accurately understand the design intent of the software.
[0087] In order to quickly determine the design intent of the software so that the user can clearly understand the design architecture of the software, the embodiment of the present application provides a software processing method. The method can be applied to Figure 1 The computing device in the system architecture shown below Figure 2 The flowchart shown illustrates the method provided in the embodiment of the present application.
[0088] S201: The computing device obtains the code of the target software.
[0089] Optionally, the computing device may obtain the target software code in the following ways, but is not limited to:
[0090] Method 1: The computing device obtains the target software code input by the user.
[0091] Method 2: The computing device obtains the code of the target software stored locally.
[0092] Method 3: The computing device receives the code of the target software from a remote end.
[0093] S202: The computing device performs design pattern analysis on the code to obtain design information of at least one first design pattern; wherein the at least one first design pattern is used to represent the design intent of the target software.
[0094] Optionally, in an embodiment of the present application, the design information of any design pattern may include: the type of the design pattern, and at least one design pattern role included in the design pattern. Optionally, when the design pattern includes multiple design pattern roles, the design information of the design pattern may also include dependencies between the multiple design pattern roles.
[0095] Take a first design pattern as an abstract factory pattern as an example. The design information of the first design pattern may include the type of the abstract factory pattern, the class names of multiple design pattern roles included in the first design pattern, and the dependencies between the multiple design pattern roles. Figure 3 As shown, "abstract factory pattern" in the design information of the first design pattern is the type or name of the design pattern; "FilterFactory", "CategoryFilterFactory" and "NonInstantiableFilterFactory" in the black box in the figure are the class names of the three design pattern roles in the design pattern, and the names of the design pattern roles corresponding to the class names are in brackets; the arrows in the figure are used to indicate the dependency relationship between the three design pattern roles, that is, the design pattern roles corresponding to CategoryFilterFactory and NonInstantiableFilterFactory respectively depend on the design pattern role corresponding to FilterFactory.
[0096] In S202, the process of the computing device performing design pattern analysis can refer to Figure 1 The introduction to the design pattern analysis module in the article will not be repeated here.
[0097] Through this method, the computing device can perform design pattern analysis on the code of the target software to obtain design information of at least one design pattern contained in the software. In this way, the user or the computing device can quickly determine the design intent of the software through the design information of the design pattern in the software, so that the user can clearly understand the design architecture of the software.
[0098] Optionally, in the embodiment of the present application, after the computing device obtains the design information of at least one first design pattern in the target software through the above steps, it can also perform some subsequent processing steps based on the information.
[0099] The first application scenario: the code of the target software is stored locally in the computing device. For example, the computing device is installed with an application for software development, such as IDE software, CI software, etc. The computing device can execute the software processing method provided in the embodiment of the present application while running the application.
[0100] Optionally, a design pattern mining tool that implements the design pattern analysis function in the computing device can be integrated / coupled in the application; it can also be an independent application or functional module in the computing device, which is not limited in this application.
[0101] In this embodiment, when the computing device executes S201, it can obtain the code of the target software stored locally. For example, the computing device can obtain the code through a code reading tool. The function of the code reading tool can be equivalent to Figure 1 The code analysis module in .
[0102] In this application scenario, the computing device may implement the method provided in the embodiment of the present application through, but not limited to, the following implementations:
[0103] First implementation mode: When the computing device is running an application for software development (hereinafter referred to as the first application for ease of description), the software processing method provided by the embodiment of the present application can be started by the user triggering the operation of the design pattern display function. The code reading tool and the design pattern mining tool are integrated in the first application.
[0104] Optionally, in this embodiment, the computing device displays a first user interface when running the first application. The first user interface is the user interface of the first application. In response to the user's first operation on the first user interface, the computing device starts the code reading tool, so that the code of the target software stored locally can be obtained through the code reading tool. Among them, the first operation is used to start the design pattern display function of the first application. In this way, the computing device can perform design pattern analysis and processing on the acquired code of the target software to obtain the design information of the at least one first design pattern. Finally, the computing device can also display the second user interface of the first application. Among them, the second user interface includes a first display area, and the design information of the at least one first design pattern is displayed in the first display area.
[0105] Exemplarily, a button or menu for starting the design mode display function may be displayed in the first user interface, and the first operation may be a click operation of the user on the button or menu in the first user interface.
[0106] Optionally, the computing device may first start a code reading tool to read the code of the local target software. When it detects that the user has started the design pattern display function for the target software, the pre-acquired target software code is analyzed and processed. The subsequent steps can refer to the above content and will not be repeated here.
[0107] In one design, after the computing device displays the second user interface, in response to a second operation of the user in the second user interface, the computing device may further display a second display area in the second user interface, wherein the code of the target software is displayed in the second display area, and the second operation is used to start the code reading area (i.e., the second display area) of the code reading tool.
[0108] Exemplarily, the second user interface may include a button or menu for starting the code display function, and the second operation may be a click operation of the user on the button or menu in the second user interface.
[0109] In this way, the computing device can open the code reading function in the second user interface through the user's operation, so that the code of the target software can be displayed in the second display area of the second user interface. In this way, the computing device can display the design information of at least one first design pattern in the target software through the first display area, and display the code of the target software through the second display area in the same user interface, so that the content displayed in the second user interface is richer and the user's reading efficiency is improved.
[0110] In another design, the computing device directly starts the code reading function when displaying the second user interface. The second user interface in the initial state displayed by the computing device includes not only a first display area for displaying design information of at least one first design pattern in the target software, but also a second display area for displaying the code of the target software.
[0111] In this way, after starting the design mode display function, the computing device can display the design information of at least one first design mode in the target software through the first display area and the code of the target software through the second display area in the same user interface without user operation, thereby enriching the content displayed in the second user interface and improving the user's reading efficiency.
[0112] It should be noted that due to the limitations of the physical sizes of the first display area and the second display area, the two display areas may not be able to display the corresponding complete content (i.e., the physical size of the first display area may only be sufficient to display part of the design information of the first design pattern, and the physical size of the second display area may only be sufficient to display part of the code in the target software). Therefore, the two display areas may also include working areas such as scroll bars so that users can adjust the content displayed in the two display areas in real time.
[0113] In this embodiment, due to the above two designs, the second user interface may include a first display area and a second display area. In order to further improve the user's reading experience, the computing device may synchronously display the design information of a first design pattern in the first display area, and display the code segment corresponding to the first design pattern in the second display area, that is, to achieve real-time synchronization of the display content between the two display areas.
[0114] Optionally, when the computing device performs S202 and performs design pattern analysis on the code of the target software, each time the design information of a first design pattern is obtained through analysis, the corresponding relationship between the design information of the first design pattern and the code segment from which the design information of the first design pattern is analyzed (i.e., the code segment corresponding to the first design pattern) is saved. That is, the computing device saves the corresponding relationship between the design information of each first design pattern and the code segment; wherein, the code segment corresponding to the design information of any first design pattern is the code segment from which the design information of the first design pattern is analyzed in the code of the target software. Based on this, the computing device can display the corresponding code segment in the second display area based on the user's selection operation of a first design pattern in the first display area. The specific steps are as follows:
[0115] In response to a third operation by the user on the design information of the first target design mode displayed in the first display area in the second user interface, a code segment corresponding to the design information of the first target design mode in the code of the target software is displayed in the second display area; wherein the first target design mode is any one of the at least one first design mode, and the third operation is used to select the design information of the first target design mode. Figure 3 Taking the design information of the abstract factory pattern shown as an example, when the user selects any class name in the design information of the abstract factory pattern in the first display area, the computing device can jump the code displayed in the second display area to the class corresponding to the class name.
[0116] Optionally, when the computing device saves the correspondence between the design information of each first design pattern and the code segment, the second user interface does not display the second display area by default, and the user does not open the second display area through the second operation, the computing device may open the second display area in the second user interface in response to the third operation to start the code reading function, thereby achieving real-time synchronization of display content between the two display areas, and the specific steps are as follows:
[0117] In response to a third operation performed by the user in the second user interface on the design information of the first target design pattern displayed in the first display area, the second display area is opened in the second user interface, and a code segment corresponding to the design information of the first target design pattern in the code of the target software is displayed in the second display area; wherein the first target design pattern is any one of at least one first design pattern, and the third operation is used to select the design information of the first target design pattern.
[0118] Exemplarily, the third operation may be a click operation on the design information of the target design mode.
[0119] In order to further achieve real-time synchronization of displayed content between the two display areas in the second user interface, the computing device may further display a code segment corresponding to design information of a certain design pattern in the second display area and display the design information of the design pattern in the first display area based on a fourth operation performed by the user in the second display area, and the specific steps are as follows:
[0120] In response to the user's fourth operation on the second display area in the second user interface, the computing device displays the code segment corresponding to the design information of the second target design pattern in the code of the target software in the second display area, and displays the design information of the second target design pattern in the first display area. Exemplarily, the fourth operation can be a page turning or line skipping operation on the code in the second display area, or a control operation on the scroll bar in the second display area. In short, the fourth operation is used to enable the computing device to display the code segment corresponding to the design information of the second target design pattern in the second display area.
[0121] In addition, when the second display area included in the second user interface has a code editing function, the user can also perform an editing operation on the code of the target software displayed in the second display area in the second user interface.
[0122] Optionally, in this embodiment, in response to the user performing an editing operation on the code of the target software in the second display area in the second user interface, the computing device may also re-analyze the edited code to obtain design information of at least one second design pattern. The at least one second design pattern is used to represent the design intent of the target software update. Afterwards, optionally, the computing device may update and display the design information of the at least one second design pattern in the first display area of the second user interface. In this way, the user can view the latest code of the target software and the latest design information of the design pattern in real time.
[0123] It should be noted that the present application does not limit the deployment position and form of the first display area and the second display area in the second user interface. The two can be located in the working area of the second user interface, or can be two independent windows opened in the second user interface.
[0124] The second implementation method: When the computing device is running an application for software development (hereinafter referred to as the second application for ease of description and distinction), the computing device obtains the current design mode of the target software by executing the software processing method provided in the embodiment of the present application, thereby protecting the software architecture of the target software and preventing the software architecture from being destroyed.
[0125] In this embodiment, when the computing device runs the second application, it can start the design pattern care task of the second application. In this way, the computing device can start the code reading tool, so that the code of the target software stored locally can be obtained through the code reading tool. The computing device can perform design pattern analysis on the obtained code of the target software to obtain the design information of the at least one first design pattern.
[0126] After the computing device obtains the design information of the at least one first design pattern through S202, the computing device may compare the design information of the at least one first design pattern with the preset architecture information of the target software to determine the design pattern change information. The preset architecture information includes the design information of at least one preset design pattern of the target software. Optionally, the preset architecture information may be designed by an architect of the target software.
[0127] After obtaining the design mode change information, the computing device may display the design mode change information to remind the user. For example, the computing device may display the design mode change information in the user interface of the second application.
[0128] The second application scenario: the code of the target software is stored in a remote device. For example, the remote device is installed with applications for software development, such as IDE software, CI software, etc. When the remote device is running these applications, if there is a need for design pattern analysis, the code of the target software can be sent to the computing device, and the computing device will perform design pattern analysis. After the computing device obtains the design information of at least one first design pattern through S202, it can send it to the remote device, and the remote device will perform subsequent processing. In this application scenario, the computing device can be a server, a virtual machine, a functional module in a cloud service platform, or any other device except the remote device.
[0129] Exemplarily, when the application running on the remote device has a design pattern display function, the remote device can adopt the first implementation in the first application scenario to display the received design information of at least one first design pattern in the user interface of the application.
[0130] For another example, when the application running on the remote device has a design mode care function, the remote device can adopt the second implementation method in the first application scenario, compare it with the preset architecture information of the target software, and obtain the design mode change information.
[0131] based on Figure 2The method provided by the embodiment shown, the present application also provides the following several examples, which are distinguished according to different applications and different application execution steps after obtaining the design information of the design pattern. Each example is described below in conjunction with the accompanying drawings. It should be noted that the following examples are used as examples and do not constitute any limitation on the software processing method provided by the present application.
[0132] Example 1:
[0133] This example provides a software processing method, such as Figure 4 This example also provides a structural form of IDE software installed in a computing device. As shown in the figure, the IDE software integrates a code reading tool and a design pattern mining tool. In addition, the IDE software also has a user interface.
[0134] In IDE software, the code reading tool is used to read the code of the target software stored locally in the computing device. Since IDE software generally has code reading and code editing functions, the IDE software can display a code reading area (or code editing area) in the user interface based on user operations or other triggering methods. In the code reading area, the user can read the entire code of the target software. In addition, the user can also edit the code of the target software in the code reading area. Exemplarily, the code reading tool of the IDE software may include, but is not limited to: Vim editor, VisioStudio Code editor (Editor), etc.
[0135] The design pattern mining tool is mainly used to perform design pattern analysis on the code of the target software to obtain the design information of at least one design pattern contained in the target software. The IDE software can start the design pattern mining tool through user operation. The design information of any design pattern may include the type of the design pattern and at least one design pattern role contained in the design pattern; when the design pattern contains multiple design pattern roles, the design information of the design pattern also includes the dependency relationship between the multiple design pattern roles, such as Figure 3 shown.
[0136] The user interface of the IDE software can provide interactive services between the IDE software and the user. For example, after the design pattern mining tool analyzes and obtains the design information of at least one design pattern contained in the target software, the IDE software can display a design pattern display area containing the design information of the at least one design pattern in the user interface.
[0137] Optionally, the user interface of the IDE software can simultaneously display the code reading area and the design pattern display area, so that it can display both the code of the target software and the design information of at least one design pattern contained in the target software, thereby making the content displayed in the user interface richer. In addition, the content displayed in the code reading area and the design pattern display area can be synchronized in real time. For example, when the user selects the design information of the target design pattern in the design pattern display area, the IDE software can synchronously display the code segment corresponding to the design information of the target design pattern in the code reading area, thereby further improving the user's experience and facilitating the user to review and edit the code. For another example, when the user controls the code reading area to display the code segment corresponding to the design information of a target design pattern, the IDE software can also synchronously display the design information of the target design pattern in the design pattern display area.
[0138] Combine the following Figure 5 The flowchart shown and Figure 6 The user interface shown further illustrates the method provided in this embodiment.
[0139] S501: The IDE software displays a first user interface during operation. In response to a user's operation on the first user interface of the IDE software, the IDE software triggers a design mode display function of the target software.
[0140] The first user interface may display files in the project of the target software, and may also display a button for starting the design mode display function. Thus, when the user clicks the button, the IDE triggers the design mode display function of the target software.
[0141] After the IDE software triggers the design pattern display function, the code of the target software stored locally on the computing device can be read through a code reading tool; then the acquired code is subjected to design pattern analysis and processing through a design pattern mining tool to obtain design information of at least one first design pattern contained in the target software.
[0142] S502: After obtaining the design information of at least one first design pattern included in the target software, the IDE software displays the design information of at least one first design pattern included in the target software in the design display area of the second user interface.
[0143] For example, Figure 6 The second user interface of the IDE software is shown. As shown in the figure, the design mode display area in the second user interface can display the design information of the at least one first design mode.
[0144] In addition, based on the user's operation or the design mode display function default user interface layout, the second user interface may also include a code reading area for displaying the target software code, such as Figure 6 shown.
[0145] When the IDE software performs design pattern analysis on the acquired code, the corresponding relationship between the design information of each first design pattern and the code segment in the at least one first design pattern can be recorded and saved, so as to achieve real-time synchronization of the displayed content between the code reading area and the design pattern display area. The code segment corresponding to the design information of any first design pattern is the code segment from which the design information of the first design pattern is analyzed in the code of the target software.
[0146] S503: In response to the user's selection operation on the design information of the target design mode in the design mode display area, the IDE software may display the code segment corresponding to the design information of the target design mode in the code reading area of the second user interface.
[0147] Continue with Figure 6 Take this as an example. When the user clicks the class name "FilterFactory" of the design pattern role in the "Abstract Factory Pattern" displayed in the design pattern display area, the IDE software can jump to the class corresponding to "FilterFactory" (i.e. Figure 6 Optionally, the IDE software can also mark the file where the class name selected by the user is located in the file directory area in the second user interface, such as Figure 6 The files enclosed in a frame in the file directory area.
[0148] Optionally, in order to achieve real-time synchronization between the contents displayed in the code reading area and the design mode display area, in response to the user's control operations in the code reading area, the IDE software may display the code segments corresponding to the design information of a target design pattern in the code reading area, and display the design information of the target design pattern in the design mode display area.
[0149] S504: In response to the user's editing operation on the code in the code reading area, the IDE software may refresh and display the design information of at least one second design mode included in the target software after the update in the design mode display area.
[0150] In the process of S504, after detecting that the editing operation is completed, the IDE software may continue to re-analyze the edited code through the design pattern mining tool to obtain design information of at least one second design pattern included in the updated target software.
[0151] Through the method provided in this example, the IDE software in the computing device can perform design pattern analysis on the code of the target software, obtain the design information of at least one design pattern contained in the software, and display the obtained design information of the design pattern to the user. In this way, the user or the computing device can quickly determine the design intent of the target software through the design information of the design pattern in the target software, so that the user can clearly understand the target design architecture of the software. In addition, the user interface of the IDE software can simultaneously display the code reading area and the design pattern display area, so that both the code of the target software and the design information of at least one design pattern contained in the target software can be displayed, so that the content displayed in the user interface is richer. Furthermore, the IDE software can realize real-time synchronization of the displayed content between the code reading area and the design pattern display area in the user interface, which is convenient for users to view and edit the code.
[0152] Example 2:
[0153] This example provides another software processing method, such as Figure 7 This example also provides a structural form of CI software installed in a computing device. As shown in the figure, the CI software is internally integrated with not only a pipeline task scheduling tool but also a design pattern care tool. Optionally, the CI software may also have a user interface.
[0154] The pipeline task orchestration tool can deploy the design pattern monitoring task to the CI pipeline. In this way, during the execution of the CI pipeline, the design pattern monitoring task can be executed through the design pattern monitoring tool, thereby monitoring the software architecture and preventing the software architecture from being damaged.
[0155] The main function of the design pattern guard tool is to detect whether the modifications made by developers to the target software during the software design process violate the design intent of the software architect.
[0156] like Figure 7 As shown, the design pattern care tool mainly includes a design pattern mining tool and a comparison module.
[0157] Among them, the design pattern mining tool is mainly used to perform design pattern analysis and processing on the code of the target software submitted by the software developer to obtain the design information of at least one design pattern contained in the target software. Optionally, after the design pattern mining tool obtains the design information of the at least one design pattern, the CI software can display the design information of the at least one design pattern in the user interface for relevant persons to view. For example, the user interface of the CI software can include a design pattern dashboard for displaying the design information of at least one design pattern obtained by the design pattern mining tool analysis.
[0158] The comparison module is used to obtain the design information of at least one design pattern analyzed by the design pattern mining tool, and then compare the design information of the at least one design pattern with the architecture information of the target software to determine the design pattern change information. The architecture information of the target software is pre-designed by the software architect of the target software. The architecture information contains the design information of at least one preset design pattern of the target software. The design pattern change information is the change content of the design information of at least one design pattern currently contained in the target software relative to the architecture information of the target software.
[0159] Optionally, after the comparison module obtains the design mode change information, the CI software can also display the design mode change information in the user interface. For example, the user interface of the CI software can include a design mode change dashboard for displaying the design mode change information obtained by comparing the modes.
[0160] In this way, relevant personnel can view the design pattern change information of the target software through the user interface of the CI software, and make subsequent decision-making. For example, technical experts (Committers) can use this information to decide whether to merge the code. For another example, software developers can also see the change information of the design pattern of the code they designed.
[0161] For example, the design mode change information displayed in the user interface can be as follows: Figure 8 shown.
[0162] It should also be noted that each step involved in the above embodiments can be performed by a corresponding device, or by a chip, processor, or chip system in the device, and the embodiments of the present application do not limit them. The above embodiments are only described by taking the execution by the corresponding device as an example. In addition, the specific implementation methods or examples in the above embodiments do not limit the solutions provided in the embodiments of the present application.
[0163] It should be noted that in the above embodiments, some steps can be selected for implementation, and the order of the steps in the diagram can be adjusted for implementation, and this application does not limit this. It should be understood that executing some steps in the diagram, adjusting the order of the steps, or combining them for specific implementation all fall within the scope of protection of this application.
[0164] It is understandable that, in order to implement the functions in the above embodiments, the various devices involved in the above embodiments include hardware structures and / or software modules corresponding to the execution of the various functions. It should be easily appreciated by those skilled in the art that, in combination with the units and method steps of the various examples described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0165] It can be understood that the above-mentioned system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Ordinary technicians in this field can know that with the evolution of network architecture and the emergence of new services, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0166] It should be noted that the "steps" in the embodiments of the present application are only for illustration, and are a method of expression used to better understand the embodiments, and do not constitute a substantial limitation on the execution of the scheme of the present application. For example, the "steps" can also be understood as "features". In addition, the steps do not constitute any limitation on the execution order of the scheme of the present application. Any changes in the order of steps, step merging, or step splitting made on this basis that do not affect the implementation of the overall scheme, and the resulting new technical solutions are also within the scope of the disclosure of the present application.
[0167] Based on the same technical concept, the present application also provides a computing device, which can implement the methods provided in the above embodiments or examples. Fig. 9 As shown, the computing device 900 includes: an acquisition unit 901 and a processing unit 902. Optionally, the computing device 900 may also include a display screen 903, and the display screen 903 is used to display a user interface. The functions of each unit are introduced below.
[0168] The acquisition unit 901 is used to acquire the code of the target software. Optionally, the acquisition unit 901 can be used to acquire the code of the target software stored locally in one case; in another case, it can be used to start a code reading tool in response to a first operation of a user on a first user interface displayed on the display screen 903; and acquire the code of the target software stored locally through the code reading tool; wherein the first operation is used to start the design mode display function.
[0169] The processing unit 902 is used to perform design pattern analysis on the code to obtain design information of at least one first design pattern; wherein the at least one first design pattern is used to represent the design intent of the target software.
[0170] The processing unit 902 may also be used to display a second user interface on the display screen 903 after obtaining the design information of at least one first design pattern; wherein the second user interface includes a first display area, and the design information of the at least one first design pattern is displayed in the first display area. The processing unit 902 may also be used to display a second display area in the second user interface in response to a second operation of the user in the second user interface after the second user interface is displayed on the display screen 903; wherein the code is displayed in the second display area, and the second operation is used to start the code reading area of the code reading tool. Optionally, the second user interface may also include a second display area, and the code is displayed in the second display area.
[0171] In an optional implementation, the processing unit 902 can also be used to save the correspondence between the design information of each first design pattern and the code segment; wherein, the code segment corresponding to the design information of any first design pattern is the code segment from which the design information of the first design pattern is analyzed in the code; in response to the user's third operation on the design information of the first target design pattern displayed in the first display area in the second user interface, the code segment corresponding to the design information of the first target design pattern in the code is displayed in the second display area; wherein, the first target design pattern is any one of the at least one first design pattern, and the third operation is used to select the design information of the first target design pattern.
[0172] In another optional implementation, the processing unit 902 can also be used to save the correspondence between the design information of each first design pattern and the code segment; wherein, the code segment corresponding to the design information of any first design pattern is the code segment from which the design information of the first design pattern is analyzed in the code; in response to the user's third operation in the second user interface on the design information of the first target design pattern displayed in the first display area, the second display area is opened in the second user interface, and the code segment corresponding to the design information of the first target design pattern in the code is displayed in the second display area; wherein, the first target design pattern is any one of the at least one first design pattern, and the third operation is used to select the design information of the first target design pattern.
[0173] In one embodiment, the processing unit 902 can also be used to display a code segment corresponding to the design information of the second target design pattern in the code in the second display area in response to a fourth operation of the user on the second display area in the second user interface, and to display the design information of the second target design pattern in the first display area.
[0174] In another embodiment, the processing unit 902 can also be used to respond to the user's editing operation on the code in the second display area in the second user interface, perform design pattern analysis on the edited code, and obtain design information of at least one second design pattern; wherein the at least one second design pattern is used to represent the design intent of the target software update.
[0175] Optionally, the processing unit 902 is further used to, after obtaining the design information of at least one first design pattern, compare the design information of the at least one first design pattern with the preset architecture information of the target software to determine the design pattern change information; wherein the preset architecture information includes the design information of at least one preset design pattern of the target software.
[0176] In a possible implementation, the processing unit 902 may also be used to, after determining the design mode change information, display the design mode change information on the display screen 903. The acquisition unit is specifically used to receive the code of the target software from a remote device; the processing unit 902 is also used to, after obtaining the design information of at least one first design mode, send the design information of at least one first design mode to the remote device.
[0177] Optionally, the design information of any first design pattern includes the type of the first design pattern and at least one design pattern role included in the first design pattern. When the first design pattern includes multiple design pattern roles, the design information of the first design pattern further includes dependencies between the multiple design pattern roles.
[0178] It should be noted that the division of modules in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0179] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0180] Based on the same technical concept, the present application also provides a computing device, which is suitable for running Figure 1 The software processing system architecture shown is used to implement Figure 2 The software processing method shown has the following features: Fig.10 The functions of the computing device 900 are shown. Fig.10 As shown, the computing device 1000 includes: a processor 1001 and a memory 1002. Optionally, the computing device 1000 may also include a communication module 1003 and a display screen 1004.
[0181] The processor 1001 is interconnected with other components. Optionally, the processor 1001 and other components can be interconnected via a bus; the bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0182] The communication module 1003 is used to receive and send data. Exemplarily, the communication module 1003 can be a communication interface or a transceiver, which is not limited in this application. Optionally, the computing device 1000 can receive the code of the target software of the remote device based on the communication module 1003, and send the design information of at least one design pattern to the remote device.
[0183] The display screen 1004 is used to display a user interface.
[0184] The processor 1001 is used to implement Figure 2 The software processing method shown can be specifically described in the above embodiment and will not be repeated here.
[0185] The memory 1002 is used to store computer programs and data. Optionally, the computer program may include a program code, which includes instructions for computer operations. The memory 1002 may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The processor 1001 executes the program instructions stored in the memory 1002 to implement the method provided in the above embodiment.
[0186] Based on the above embodiments, the embodiments of the present application further provide a computer program, which, when executed on a computer, enables the computer to execute the methods provided in the above embodiments.
[0187] Based on the above embodiments, the embodiments of the present application further provide a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a computer, the computer executes the method provided in the above embodiments.
[0188] The storage medium may be any available medium that can be accessed by a computer. For example, but not limited to, a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.
[0189] Based on the above embodiments, the embodiments of the present application further provide a chip, the chip including a processor, the processor is used to read the computer program stored in the memory, and implement the method provided in the above embodiments. Optionally, the chip may also include at least one of the following: the memory, the communication interface, and the power supply unit. The memory is used to store the computer program, the communication interface is used to receive and send data; the power supply unit is used to power the processor.
[0190] Based on the above embodiments, the embodiments of the present application provide a chip system, which includes a processor for supporting the functions involved in the computing device in the above embodiments. In one possible design, the chip system also includes a memory, which is used to store the necessary programs and data for the computing device. The chip system can be composed of a chip, or it can include a chip and other discrete devices.
[0191] In summary, the embodiments of the present application provide a software processing method and device. Through this solution, a computing device can perform design pattern analysis on the code of the target software to obtain design information of at least one design pattern contained in the software. In this way, a user or a computing device can quickly determine the design intent of the software through the design information of the design pattern in the software, so that the user can clearly understand the design architecture of the software.
[0192] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0193] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0194] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0195] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0196] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A software processing method, characterized in that: include: Get the code of the target software; Performing design pattern analysis on the code to obtain design information of at least one first design pattern; wherein the at least one first design pattern is used to represent the design intent of the target software.
2. The method according to claim 1, characterized in that The code for obtaining the target software includes: The code of the target software stored locally is obtained.
3. The method according to claim 2, characterized in that The obtaining the code of the target software stored locally includes: In response to a first operation of a user in a first user interface, starting a code reading tool; wherein the first operation is used to start a design mode display function; Obtaining the code of the target software stored locally through the code reading tool; After obtaining the design information of at least one first design pattern, the method further includes: Display a second user interface; wherein the second user interface includes a first display area, and the design information of the at least one first design mode is displayed in the first display area.
4. The method according to claim 3, characterized in that After displaying the second user interface, the method further includes: In response to a second operation of the user in the second user interface, a second display area is displayed in the second user interface; wherein the code is displayed in the second display area, and the second operation is used to start the code reading area of the code reading tool.
5. The method according to claim 3, characterized in that The second user interface also includes a second display area, and the code is displayed in the second display area.
6. The method according to claim 4 or 5, characterized in that The method further comprises: Saving the correspondence between the design information of each first design pattern and the code segment; wherein the code segment corresponding to the design information of any first design pattern is the code segment from which the design information of the first design pattern is analyzed in the code; In response to a third operation by the user in the second user interface on the design information of the first target design pattern displayed in the first display area, a code segment corresponding to the design information of the first target design pattern in the code is displayed in the second display area; wherein, the first target design pattern is any one of the at least one first design pattern, and the third operation is used to select the design information of the first target design pattern.
7. The method according to claim 3, characterized in that The method further comprises: Saving the correspondence between the design information of each first design pattern and the code segment; wherein the code segment corresponding to the design information of any first design pattern is the code segment from which the design information of the first design pattern is analyzed in the code; In response to a third operation by the user in the second user interface on the design information of the first target design pattern displayed in the first display area, the second display area is opened in the second user interface, and a code segment corresponding to the design information of the first target design pattern in the code is displayed in the second display area; wherein the first target design pattern is any one of the at least one first design pattern, and the third operation is used to select the design information of the first target design pattern.
8. The method according to claim 6 or 7, characterized in that The method further comprises: In response to a fourth operation performed by the user on the second display area in the second user interface, a code segment corresponding to the design information of the second target design pattern in the code is displayed in the second display area, and the design information of the second target design pattern is displayed in the first display area.
9. The method according to any one of claims 4 to 8, characterized in that: The method further comprises: In response to the user's editing operation on the code in the second display area in the second user interface, design pattern analysis is performed on the edited code to obtain design information of at least one second design pattern; wherein the at least one second design pattern is used to represent the design intent of the target software update.
10. The method according to any one of claims 2 to 9, characterized in that: After obtaining the design information of at least one first design pattern, the method further includes: The design information of the at least one first design pattern is compared with the preset architecture information of the target software to determine the design pattern change information; wherein the preset architecture information includes the design information of at least one preset design pattern of the target software.
11. The method according to claim 10, characterized in that After determining the design mode change information, the method further includes: Displays information about design mode changes.
12. The method according to claim 1, characterized in that The code for obtaining the target software includes: Receiving the code of the target software from a remote device; After obtaining the design information of at least one first design pattern, the method further includes: The design information of the at least one first design pattern is sent to the remote device.
13. The method according to any one of claims 1 to 12, characterized in that: The design information of any first design pattern includes the type of the first design pattern and at least one design pattern role included in the first design pattern.
14. The method according to claim 13, characterized in that When the first design pattern includes multiple design pattern roles, the design information of the first design pattern further includes dependency relationships between the multiple design pattern roles.
15. A computing device, characterized in that: include: Acquisition unit and processing unit; The acquisition unit is used to acquire the code of the target software; The processing unit is used to perform design pattern analysis on the code to obtain design information of at least one first design pattern; wherein the at least one first design pattern is used to represent the design intent of the target software.
16. A computing device, characterized in that include: Processor and memory; The processor is coupled to the memory, and the processor is used to read the computer program stored in the memory to implement the method according to any one of claims 1 to 14.
17. A chip, characterized in that: include: processor; The processor is coupled to the memory, and the processor is used to call the computer program stored in the memory during operation to implement the method according to any one of claims 1 to 14.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 14.
19. A computer program product, characterized in that When the computer program product is executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 14.