CN113703736A - Web project code optimization method - Google Patents

Web project code optimization method Download PDF

Info

Publication number
CN113703736A
CN113703736A CN202111013700.0A CN202111013700A CN113703736A CN 113703736 A CN113703736 A CN 113703736A CN 202111013700 A CN202111013700 A CN 202111013700A CN 113703736 A CN113703736 A CN 113703736A
Authority
CN
China
Prior art keywords
code
project
codes
web project
optimizing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111013700.0A
Other languages
Chinese (zh)
Inventor
王益
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Cric Technology Co ltd
Original Assignee
Sichuan Cric Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Cric Technology Co ltd filed Critical Sichuan Cric Technology Co ltd
Priority to CN202111013700.0A priority Critical patent/CN113703736A/en
Publication of CN113703736A publication Critical patent/CN113703736A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a web project code optimization method, which comprises the following steps: scanning the whole web project, and deleting the unreferenced methods; counting codes in the project, and recording the path of a related code file; scanning related codes one by one according to the recorded path, and deleting packages and objects which are not referred and used; optimizing a code structure; compiling the web project to ensure the normal operation of the project after optimizing the codes; and generating an optimized file, and recording the code path and the comparison before and after modification. The invention analyzes the project structure by scanning the web project, deletes redundant codes, adjusts the uniform style of code typesetting and records the optimization result. Compared with the prior art, the project manager does not need to check whether the codes submitted by the research and development personnel are standard or not, and all people can check whether the codes meet the standard or not by checking the optimization records, so that the development capability of the people is improved.

Description

Web project code optimization method
Technical Field
The invention relates to the technical field of software, in particular to a web project code optimization method.
Background
At present, a web project needs a plurality of research and development personnel to research, develop and maintain together, and because the research and development personnel have different working years, once have different working environments and different development code styles. The finally completed web project has various code styles, and the same functional logic has various development logics, so that the research and development personnel have difficulty in mutually maintaining the code modules of other people.
Disclosure of Invention
The invention provides a web project code optimization method, which aims to solve the problems that in the prior art, large-scale web project codes are not standard and the code styles are not uniform, and the problem is that a plurality of people develop web projects and can only ensure that codes do not have BUG and can normally run, but the finally submitted code functions have a plurality of non-standard codes and a plurality of code styles.
The technical scheme adopted by the invention is as follows: a method for web project code optimization, comprising the steps of:
scanning the whole web project, and deleting the unreferenced methods;
counting codes in the project, and recording the path of a related code file;
scanning related codes one by one according to the recorded path, and deleting packages and objects which are not referred and used; optimizing a code structure;
and compiling the web project to ensure the normal operation of the project after optimizing the codes.
As a preferred mode of the web project code optimization method, compiling the web project to ensure that the project runs normally after code optimization further includes:
and generating an optimized file, and recording the code path and the comparison before and after modification.
As a preferred mode of the web project code optimization method, the optimization code structure includes:
and naming, format, annotation, set processing, statement control, code indentation adjustment and uniform code style wrapping are optimized.
As a preferred mode of the web project code optimization method, the method for naming, formatting, annotating, collecting and processing and controlling the statement in the optimization comprises the following steps:
changing the constant naming of lower case into upper case, taking different naming when a plurality of constants, and changing the method name, parameter name, member variable and local variable into hump structure; performing line feed processing on single-line codes of more than 80 characters, inserting a blank line between an execution statement group, a variable definition statement group, different business logics or different semantics in a method body, and adding a blank space on the left side and the right side of a two-eye operator and a three-eye operator; change the// xxx notation to// content/format; the size is specified when the set is initialized; parenthesis are added to if/else/for/while/do statements.
The invention has the beneficial effects that: the invention analyzes the project structure by scanning the web project, deletes redundant codes, adjusts the uniform style of code typesetting and records the optimization result. Compared with the prior art, the project manager does not need to check whether the codes submitted by the research and development personnel are standard or not, and all people can check whether the codes meet the standard or not by checking the optimization records, so that the development capability of the people is improved.
Drawings
Fig. 1 is a schematic flow chart of a web project code optimization method disclosed in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail below with reference to the accompanying drawings, but embodiments of the present invention are not limited thereto.
The invention adopts the scanning project structure, deletes redundant codes, optimizes the code structure, adjusts the code style, generates a simple and standard web project, records the optimization result and is convenient to check at any time. In order to achieve the above object, the present invention provides a web project code optimization method, referring to fig. 1, which includes the following steps:
s1: scanning the entire web item deletes the methods that are not referenced.
Illustratively, in this embodiment, a w item includes content.
Scanning the whole w item folder, counting all defined classes and methods to obtain content.
S2: and counting codes in the project, and recording the path of the related code file.
Specifically, when the w item is scanned, content.
S3: scanning related codes one by one according to the recorded path, and deleting packages and objects which are not referred and used; and optimizing the code structure.
Specifically, the content of content.java and business.java is read one by one according to the recorded path, the package and the defined object introduced in the code are counted, whether the introduced package and the defined object are used in the content.java and business.java is checked, and the package and the object which are not used are deleted.
Optimizing naming, format, annotation, set processing, control statements in the code: changing the constant naming of lower case into upper case, taking different naming when a plurality of constants, changing the method name, parameter name, member variable and local variable into hump structure, etc. The method comprises the steps of performing line feed processing on a single line code with more than 80 characters, inserting a blank line between an execution statement group, a variable definition statement group and different business logics or between different semantemes in a method body, and adding a blank space on the left side and the right side of a two-eye operator and a three-eye operator. The// xxx notation is changed to/' content/format. The size is specified when initializing the set. In the if/else/for/while/do statement, a brace is added.
S4: and compiling the web project to ensure the normal operation of the project after optimizing the codes.
S5: and generating an optimized file, and recording the code path and the comparison before and after modification.
Specifically, the operation of optimizing codes is recorded, and paths, file line numbers, codes before modification and codes after modification in content. Checking the code records can accurately position the code comparison before and after optimization.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (4)

1. A method for optimizing web project code, comprising the steps of:
scanning the whole web project, and deleting the unreferenced methods;
counting codes in the project, and recording the path of a related code file;
scanning related codes one by one according to the recorded path, and deleting packages and objects which are not referred and used; optimizing a code structure;
and compiling the web project to ensure the normal operation of the project after optimizing the codes.
2. The method for optimizing web project code according to claim 1, wherein compiling the web project to ensure that the project runs normally after optimizing the code further comprises:
and generating an optimized file, and recording the code path and the comparison before and after modification.
3. The web project code optimization method of claim 1, wherein the optimization code structure comprises:
and naming, format, annotation, set processing, statement control, code indentation adjustment and uniform code style wrapping are optimized.
4. The web project code optimization method of claim 3, wherein the method for naming, formatting, annotating, collecting, and controlling statements in the optimization comprises:
changing the constant naming of lower case into upper case, taking different naming when a plurality of constants, and changing the method name, parameter name, member variable and local variable into hump structure; performing line feed processing on single-line codes of more than 80 characters, inserting a blank line between an execution statement group, a variable definition statement group, different business logics or different semantics in a method body, and adding a blank space on the left side and the right side of a two-eye operator and a three-eye operator; change the// xxx notation to// content/format; the size is specified when the set is initialized; parenthesis are added to if/else/for/while/do statements.
CN202111013700.0A 2021-08-31 2021-08-31 Web project code optimization method Pending CN113703736A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111013700.0A CN113703736A (en) 2021-08-31 2021-08-31 Web project code optimization method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111013700.0A CN113703736A (en) 2021-08-31 2021-08-31 Web project code optimization method

Publications (1)

Publication Number Publication Date
CN113703736A true CN113703736A (en) 2021-11-26

Family

ID=78658065

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111013700.0A Pending CN113703736A (en) 2021-08-31 2021-08-31 Web project code optimization method

Country Status (1)

Country Link
CN (1) CN113703736A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7185330B1 (en) * 2001-01-05 2007-02-27 Xilinx, Inc. Code optimization method and system
CN105915623A (en) * 2016-05-20 2016-08-31 努比亚技术有限公司 Device and method of processing application installation package
CN107357733A (en) * 2017-07-17 2017-11-17 万帮充电设备有限公司 Improve the method and device of code quality
CN109522020A (en) * 2018-09-29 2019-03-26 中国平安人寿保险股份有限公司 Android system installation kit method for reducing body weight, device, terminal and storage medium
CN109683881A (en) * 2018-12-27 2019-04-26 潍柴动力股份有限公司 A kind of code format method of adjustment and device
CN111061488A (en) * 2019-12-18 2020-04-24 深圳前海环融联易信息科技服务有限公司 Method and device for detecting quality of front-end code, computer equipment and storage medium
CN112947985A (en) * 2021-01-29 2021-06-11 北京航空航天大学 Method and system for intelligently detecting and repairing codes
WO2022172025A1 (en) * 2021-02-12 2022-08-18 Taravu Ltd Optimising computer program code

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7185330B1 (en) * 2001-01-05 2007-02-27 Xilinx, Inc. Code optimization method and system
CN105915623A (en) * 2016-05-20 2016-08-31 努比亚技术有限公司 Device and method of processing application installation package
CN107357733A (en) * 2017-07-17 2017-11-17 万帮充电设备有限公司 Improve the method and device of code quality
CN109522020A (en) * 2018-09-29 2019-03-26 中国平安人寿保险股份有限公司 Android system installation kit method for reducing body weight, device, terminal and storage medium
CN109683881A (en) * 2018-12-27 2019-04-26 潍柴动力股份有限公司 A kind of code format method of adjustment and device
CN111061488A (en) * 2019-12-18 2020-04-24 深圳前海环融联易信息科技服务有限公司 Method and device for detecting quality of front-end code, computer equipment and storage medium
CN112947985A (en) * 2021-01-29 2021-06-11 北京航空航天大学 Method and system for intelligently detecting and repairing codes
WO2022172025A1 (en) * 2021-02-12 2022-08-18 Taravu Ltd Optimising computer program code

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
付金莹;蒋云;王金伦;申宗杰;: "基于静态分析的应用代码质量管理体系研究及应用", 中国新通信 *

Similar Documents

Publication Publication Date Title
US20050204340A1 (en) Attribute-based automated business rule identifier and methods of implementing same
CN109448100B (en) Three-dimensional model format conversion method, system, computer device and storage medium
KR20080095861A (en) Strategies for processing annotations
CN110727703B (en) Method and device for automatically identifying comments in JSON codes
US20050091249A1 (en) Single file serialization for physical and logical meta-model information
CN109299074B (en) Data verification method and system based on templated database view
CN111666072A (en) Software code and document robot method
CN114281342A (en) Automatic code generation method
US9582291B2 (en) Selecting a mapping that minimizes conversion costs
US20080033968A1 (en) Methods and apparatus for input specialization
CN116561146A (en) Database log recording method, device, computer equipment and computer readable storage medium
CN113419969B (en) Interface automatic formation power guarantee method based on browser plug-in
CN113703736A (en) Web project code optimization method
CN111124380A (en) Front-end code generation method
CN114047970A (en) Configuration method and system of AUTOSAR (automotive open system architecture) architecture software
Vo et al. Incl: A Tool to Analyze Include Files.
CN115756430A (en) Low-code rapid research and development configuration platform
CN111309319B (en) Inheritable office data dynamic page configuration method and device
CN114328144A (en) User operation data acquisition method, processing method and device
CN111399900A (en) API document automatic generation method and system based on python and regular expression
US20080285064A1 (en) Document Processing Device, Document Processing Method, and Electronic Mail Processing Device
CN111782212A (en) View assembly creating method and device and storage medium
CN115081411A (en) Method and system for universal importing of excel
Omori et al. Lightweight Operation History Graph for Traceability on Program Elements
CN114253630B (en) Method for realizing log storage based on Java section modification Form change information

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20211126