CN110221821A - A kind of project function decoupling method and electronic equipment educated based on programming - Google Patents

A kind of project function decoupling method and electronic equipment educated based on programming Download PDF

Info

Publication number
CN110221821A
CN110221821A CN201910334356.1A CN201910334356A CN110221821A CN 110221821 A CN110221821 A CN 110221821A CN 201910334356 A CN201910334356 A CN 201910334356A CN 110221821 A CN110221821 A CN 110221821A
Authority
CN
China
Prior art keywords
function
project
public
private
file
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
CN201910334356.1A
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.)
Shenzhen Dianmao Technology Co Ltd
Original Assignee
Shenzhen Dianmao 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 Shenzhen Dianmao Technology Co Ltd filed Critical Shenzhen Dianmao Technology Co Ltd
Priority to CN201910334356.1A priority Critical patent/CN110221821A/en
Publication of CN110221821A publication Critical patent/CN110221821A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Abstract

The present invention discloses a kind of project function decoupling method and electronic equipment educated based on programming, and original function is split as public function and private function comprising steps of original function in extraction project by method;Public function therein is moved to outside project, will wherein private function be moved in project;The packing script that egret official provides is run, generates file into specified folder;When needing using public function, the public function is called by private library, completes decoupling.Original function is split as public function and private function by the present invention, and public function is moved to outside project, and private function is moved in project, to make project packing output file and only project operation dependence, realizes the purpose of decoupling.

Description

A kind of project function decoupling method and electronic equipment educated based on programming
Technical field
The present invention relates to field of computer technology, more particularly to a kind of project function decoupling method educated based on programming and Electronic equipment.
Background technique
In the project, some functions and variable are frequently necessary to multiplexing, such as Website server address, from taking from the background User login token or the address information of user etc., global variable and overall situation function need to set at this time.Equally, For game item, also there are many general public functions, and the exclusive private function of many projects at present.But the prior art It is not well positioned to meet the maintenance and update of function entirety, such as one public function of modification needs manual modification all items Correlation function, it is maintainable very poor.
Therefore, the existing technology needs to be improved and developed.
Summary of the invention
In view of above-mentioned deficiencies of the prior art, the purpose of the present invention is to provide the project functions that one kind is educated based on programming Decoupling method and electronic equipment, it is intended to solve the problems, such as that project function is maintainable poor in the prior art.
Technical scheme is as follows:
A kind of project function decoupling method educated based on programming, wherein comprising steps of
Original function in extraction project, and original function is split as public function and private function;
Public function therein is moved to outside project, will wherein private function be moved in project;
The packing script that egret official provides is run, generates file into specified folder;When needing using public function When, the public function is called by private library, completes decoupling.
The project function decoupling method educated based on programming, wherein the original function in the extraction project, and The step of original function is split as public function and private function specifically includes:
Original function in extraction project;
Remove the individual cultivation in original function;
Original function is split as public function and private function according to the individual cultivation.
The project function decoupling method educated based on programming, wherein described to be moved to public function therein Outside project, wherein private function is moved to the step in project further include:
File and its path after configuration production.
The project function decoupling method educated based on programming, wherein the file after production includes saying for public library Prescribed paper.
The project function decoupling method educated based on programming, wherein the file after production includes js file, and institute Js file is stated as encryption file.
The project function decoupling method educated based on programming, wherein the file path after configuration production is project Path.
The project function decoupling method educated based on programming, wherein it is described called by private library it is described public The step of function, specifically includes:
Public function is called by private library, carries out secondary package.
A kind of electronic equipment, wherein include:
Processor is adapted for carrying out each instruction, and
Equipment is stored, is suitable for storing a plurality of instruction, described instruction is suitable for being loaded and being executed by processor:
Original function in extraction project, and original function is split as public function and private function;
Public function therein is moved to outside project, will wherein private function be moved in project;
The packing script that egret official provides is run, generates file into specified folder;When needing using public function When, the public function is called by private library, completes decoupling.
A kind of non-volatile computer readable storage medium storing program for executing, wherein the non-volatile computer readable storage medium storing program for executing is deposited Computer executable instructions are contained, when which is executed by one or more processors, may make described one A or multiple processors execute the project function decoupling method educated based on programming.
A kind of computer program product, wherein non-volatile computer is readable to be deposited computer program product including being stored in Computer program on storage media, computer program include program instruction, when program instruction is executed by processor, make the place It manages device and executes the project function decoupling method educated based on programming.
The utility model has the advantages that original function is split as public function and private function by the present invention, and public function is moved to Outside project, private function is moved in project, to make project packing output file and only project operation dependence, realizes decoupling Purpose.
Detailed description of the invention
Fig. 1 is a kind of flow chart for the project function decoupling method preferred embodiment educated based on programming of the present invention.
Fig. 2 is the structural block diagram of a kind of electronic equipment preferred embodiment of the present invention.
Specific embodiment
The present invention provides a kind of project function decoupling method and electronic equipment educated based on programming, to make mesh of the invention , technical solution and effect it is clearer, clear, the present invention is described in more detail below.It should be appreciated that described herein Specific embodiment be only used to explain the present invention, be not intended to limit the present invention.
Referring to Fig. 1, Fig. 1 is a kind of stream for the project function decoupling method preferred embodiment educated based on programming of the present invention Cheng Tu, as shown, itself comprising steps of
Original function in S1, extraction project, and original function is split as public function and private function;
S2, public function therein is moved to outside project, will wherein private function be moved in project;
The packing script that S3, operation egret official provide, generates file into specified folder;When needing using public When function, the public function is called by private library, completes decoupling.
Original function in project is split as public function and private function by the present invention, and public function is moved to item Outside mesh, while private function being moved in project, needs to call using when public function by private library in this way, thus Realize the purpose of decoupling.
Specifically, in the step S1, the original function in extraction project, and original function is split as public function With private function, Public Function and private function can also be referred to as.It can distinguish in this way for public function and private function It is handled, public function can integrally be safeguarded, carry out maintenance processing without individually each.
Further, the original function in the extraction project, and original function is split as public function and private function The step of specifically include:
Original function in extraction project;
Remove the individual cultivation in original function;
Original function is split as public function and private function according to the individual cultivation.
Original function therein is, for example, to calculate random number functions.
After the individual cultivation removal in original function, original function can be divided into two, that is, be split as public Function and private function.
And public function can be set to unified NameSpace.Briefly, all related letters can be packaged Several and variable.Such as:
Aforesaid way is illustrated by taking person object as an example, by the above-mentioned means, person object is completely included To MYNAMESPACE, this NameSpace is suffered, and application method is as follows:
Var p=new MYNAMESPACE.person (" ifcode ");
p.getName();//ifcode
In this way, can state multiple person objects by NameSpace, using similar approach be can reach Distinguish the purpose of public function.
In the step S2, public function therein is moved to outside project, wherein will be moved to project by private function It is interior.
After splitting original function, public function can individually be managed, that is, be moved to outside project, while by private Function is placed in project, to accomplish that project is packaged output file and only project operation relies on.
Further, described that public function therein is moved to outside project, wherein private function is moved in project Step further include:
File and its path after configuration production.
Certainly it also needs to add game engine related dependant, for producing file available.
Further, the file after production includes the supporting paper of public library.Utils.d.ts file is also produced simultaneously.
After public function therein is moved to outside project, it will form new public library (i.e. public function class libraries) or add Enter original public library, i.e. public library includes some public functions, at string processing class, text file processing class, color Manage class, ini file processing class, picture class, graph transformation class, paintbrush Attribute class, paintbrush Attribute class, font attribute class, SVG processing The public functions such as class, XML processing class.And public library includes supporting paper, which refers to detailed operation instruction text Shelves, such as the detailed operation instruction document of chm format, can greatly improve program development efficiency, without the time is wasted in this way On simple duplicated code.
Utils.d.ts file is dynamic link library file important in system, encounters miscue " utils.d.ts text It is to lack utils.d.ts file in system when part loss " or " utils.d.ts file error ".Application method is as follows: 1, solving Depress the file carried.2, it replicates under file " utils.d.ts " to catalogue.3, start menu -- > operation -- > input is finally clicked regsvr32utils.d.ts.If lacking utils.d.ts file will lead to: 1, the application programs such as game are unable to operate normally, 2, Prompt lacks this document when opening application program.
Further, the file after production includes js file, and the js file is encryption file.
Further, the file path after configuration production is item Path.
In the step S3, the packing script that operation egret official provides generates file into specified folder;When When needing using public function, the public function is called by private library, completes decoupling.
Egret is the HTML5 development of games solution of complete set.It include multiple tools and project in Egret. Egret engine is the HTML5 game engine based on TypeScript language development.What operation egret official provided beats Bind foot originally is in order to which public function to be packaged, individually to manage.
In this way when needing using public function, the public function of public library need to be only called by private library.
Specific packing manner is packaged using Gulp, and Gulp.js is an automation the build tool, and developer can make Usual task is executed automatically in project development process with it.
Gulp is installed in the following way:
Installation gulp:$ cnpm install--global gulp global first
Then reinitialize file: cnpm init, and initialization files folder will appear a package.json file, A series of plug-in units installed later all inside can see;
Part installation again: cnpm install gulp--save-dev, -- save is will to save configuration information extremely Package.json ,-dev are saved into the devDependencies object of package.json.It will appear one after installation A node_modules file;
Finally create a gulpfile.js file, the position of gulpfile.js file is preferably and node_ Modules, package.json are placed on same level.
It is also different that compress mode is packaged for different files.
1, it is packaged html file: the dependence of installation packing html file: cnpm i gulp-htmlmin-D, then It is configured in gulpfile.js.
2, it is packaged sass file, then direct compilation sass and is packaged css.Installation relies on: cnpm igulp-sass- China-D, then configured in gulpfile.js.
3, it is packaged css file, is relied on needed for installation css: cnpm i gulp-clean-css-D, then in gulpfile.js Middle configuration, as follows:
4, it is packaged img picture, is relied on needed for installation css: cnpm i gulp-imagemin-D, then in gulpfile.js Middle configuration.
5, it is packaged js file, is relied on needed for installation js: cnpm i gulp-uglify-D, then match in gulpfile.js It sets.
6, escape es6 is relied on: cnpm i gulp-babel babel-core babel-preset-env-needed for installing D, then configured in gulpfile.js.
File after being packaged in the present invention is js file, for encryption file.
Encryption for js file can use BASE64 encryption method or md5 encryption method.
For BASE64 encryption method, required js can be imported, js foot required for then introducing in js file This.Here this js file of BASE64 is introduced, such as needs to call directly to the password encryption on login page Encode method can be encrypted directly, and decryption calls directly decode method.
For md5 encryption method, first downloading MD5 compressed package, and decompress;Required for the MD5 file that solution is pressed imports In the project of encryption, this file of MD5 is directly quoted in js, calls directly md5 encryption in needing the character string encrypted Encryption can be completed in method in this way.
Then the public function (i.e. the public function of public library) after being packaged individually is managed using git, git is an open source Distributed version control system, can handle effectively, at high speed from very little to very big Item version management.It simultaneously can also The private function being placed in project with using git individually to manage.
In the present invention, using git manage public library the step of it is as follows:
1, git is installed, " git " -> " Git Bash " after installing, is found in start menu, pops up a similar command Row window shows to install successfully.
2, git is registered, inputs order line in open Git Bash:
$git config--global user.name"Your Name"
$git config--global user.email"email@example.com"
3, version repository is created, an empty list (file) is created, git init order is run this catalogue and becomes Git The warehouse that can be managed.
4, version or file are submitted, operation order $ git add presents a paper.Operation order $ gitcommit-m " by name git”。
5, version is checked, operation order $ git status order can grasp the current state in warehouse constantly;Operation order $ git diff order can check the position of modification.
6, version rollback, operation order $ git log order is it can be seen that version history, operation order $ git Log--pretty=oneline can be omitted unnecessary information.
Current version is indicated with HEAD, and a upper version is exactly HEAD^, and a upper version is exactly HEAD^^, certainly past Upper 100 versions write 100 ^ inconveniences, so HEAD~100 can be write as.
Operation order $ git reset--hard HEAD^ returns to a version;
Operation order $ git reset--hard 3628164 can jump back to specific version.
7, workspace and postponement area, because Git has automatically created only one master branch when creation Git version repository, So git commit is exactly to submit change toward in master branch.The file modification for needing to submit is put into working area, so Afterwards, all modifications in working area are disposably submitted.
8, management correcting, first revision -> git add- > second revision -> git add- > gitcommit.
9, revocation modification, operation order git checkout--readme.txt, i.e., working readme.txt file The modification in area all cancels.And the modification in working area can be cancelled fall by running order $ git reset HEAD readme.txt (unstage), workspace is placed back in.
10, file is deleted, operation order $ rm test.txt deletes the file in version repository.Operation order $ git The file that checkout--test.txt revocation is deleted.
11, remote warehouse registers a github account.
12, remote library is added, local to associate with remote library, operation order $ git push-u originmaster handle The content push of local library, with git push order, is actually pushed to current branch master remotely to remotely.
13, it is cloned from remote library, operation order $ git clonegit@github.com:michaelliao/ Gitskills.git clones a version to local library from remote library.
Further, described the step of calling the public function by private library, specifically includes:
Public function is called by private library, carries out secondary package.Secondary package therein refers to secondary encapsulation.
The present invention also provides a kind of electronic equipment 10, as shown in Fig. 2, comprising:
Processor 110 is adapted for carrying out each instruction, and
Equipment 120 is stored, is suitable for storing a plurality of instruction, described instruction is suitable for being loaded and being executed by processor 110:
Original function in extraction project, and original function is split as public function and private function;
Public function therein is moved to outside project, will wherein private function be moved in project;
The packing script that egret official provides is run, generates file into specified folder;When needing using public function When, the public function is called by private library, completes decoupling.
The processor 110 can for general processor, digital signal processor (DSP), specific integrated circuit (ASIC), Field programmable gate array (FPGA), single-chip microcontroller, ARM (Acorn RISC Machine) or other programmable logic device are divided Any combination of vertical door or transistor logic, discrete hardware component or these components.In addition, processor can also be any Conventional processors, microprocessor or state machine.Processor also may be implemented as calculating the combination of equipment, for example, DSP and Wei Chu Manage combination, multi-microprocessor, one or more microprocessors combination DSP core, any other this configuration of device.
It stores equipment 120 and is used as a kind of non-volatile computer readable storage medium storing program for executing, can be used for storing non-volatile software Program, non-volatile computer executable program and module, such as the project letter educated based on programming in the embodiment of the present invention The corresponding program instruction of number decoupling method.Processor is stored in the non-volatile software program stored in equipment by operation, referred to It enables and unit, thereby executing the various function application and data processing of the project function decoupling method educated based on programming, Realize above method embodiment.
It has been described in detail in the method for particular technique details in front about above-mentioned electronic equipment 10, so it will not be repeated.
The present invention also provides a kind of non-volatile computer readable storage medium storing program for executing, the non-volatile computer readable storage Media storage has computer executable instructions, when which is executed by one or more processors, may make One or more of processors execute the project function decoupling method educated based on programming.
The present invention also provides a kind of computer program product, computer program product includes being stored in non-volatile computer Computer program on readable storage medium storing program for executing, computer program include program instruction, when program instruction is executed by processor, are made The processor executes the project function decoupling method educated based on programming.
It should be understood that the application of the present invention is not limited to the above for those of ordinary skills can With improvement or transformation based on the above description, all these modifications and variations all should belong to the guarantor of appended claims of the present invention Protect range.

Claims (10)

1. the project function decoupling method that one kind is educated based on programming, which is characterized in that comprising steps of
Original function in extraction project, and original function is split as public function and private function;
Public function therein is moved to outside project, will wherein private function be moved in project;
The packing script that egret official provides is run, generates file into specified folder;When needing using public function, The public function is called by private library, completes decoupling.
2. the project function decoupling method according to claim 1 educated based on programming, which is characterized in that the extraction item Original function in mesh, and the step of original function is split as public function and private function specifically includes:
Original function in extraction project;
Remove the individual cultivation in original function;
Original function is split as public function and private function according to the individual cultivation.
3. the project function decoupling method according to claim 1 educated based on programming, which is characterized in that it is described will wherein Public function be moved to outside project, wherein private function is moved to the step in project further include:
File and its path after configuration production.
4. the project function decoupling method according to claim 3 educated based on programming, which is characterized in that the text after production Part includes the supporting paper of public library.
5. the project function decoupling method according to claim 3 educated based on programming, which is characterized in that the text after production Part includes js file, and the js file is encryption file.
6. the project function decoupling method according to claim 3 educated based on programming, which is characterized in that after configuration production File path be item Path.
7. the project function decoupling method according to claim 1 educated based on programming, which is characterized in that described to pass through private The step of calling the public function with library specifically includes:
Public function is called by private library, carries out secondary package.
8. a kind of electronic equipment characterized by comprising
Processor is adapted for carrying out each instruction, and
Equipment is stored, is suitable for storing a plurality of instruction, described instruction is suitable for being loaded and being executed by processor:
Original function in extraction project, and original function is split as public function and private function;
Public function therein is moved to outside project, will wherein private function be moved in project;
The packing script that egret official provides is run, generates file into specified folder;When needing using public function, The public function is called by private library, completes decoupling.
9. a kind of non-volatile computer readable storage medium storing program for executing, which is characterized in that the non-volatile computer readable storage medium Matter is stored with computer executable instructions, when which is executed by one or more processors, may make institute It states one or more processors perform claim and requires the described in any item project function decoupling methods educated based on programming of 1-7.
10. a kind of computer program product, which is characterized in that computer program product can including being stored in non-volatile computer The computer program on storage medium is read, computer program includes program instruction, when program instruction is executed by processor, makes institute It states processor perform claim and requires the described in any item project function decoupling methods educated based on programming of 1-7.
CN201910334356.1A 2019-04-24 2019-04-24 A kind of project function decoupling method and electronic equipment educated based on programming Pending CN110221821A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910334356.1A CN110221821A (en) 2019-04-24 2019-04-24 A kind of project function decoupling method and electronic equipment educated based on programming

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910334356.1A CN110221821A (en) 2019-04-24 2019-04-24 A kind of project function decoupling method and electronic equipment educated based on programming

Publications (1)

Publication Number Publication Date
CN110221821A true CN110221821A (en) 2019-09-10

Family

ID=67820035

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910334356.1A Pending CN110221821A (en) 2019-04-24 2019-04-24 A kind of project function decoupling method and electronic equipment educated based on programming

Country Status (1)

Country Link
CN (1) CN110221821A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112130843A (en) * 2020-07-31 2020-12-25 北京编程猫科技有限公司 Method and device for importing programming works in graphical programming platform

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101826014A (en) * 2010-04-20 2010-09-08 北京邮电大学 Dividing method of source code in software engineering
US20170199858A1 (en) * 2016-01-07 2017-07-13 Chen-Chung YEH Form management system and method
CN107656738A (en) * 2017-10-16 2018-02-02 武汉斗鱼网络科技有限公司 Model structural design method and device in a kind of Android
CN109491806A (en) * 2018-11-01 2019-03-19 郑州云海信息技术有限公司 Adaptation method and device between a kind of kernel and third-party application
CN109614162A (en) * 2018-11-15 2019-04-12 福建天泉教育科技有限公司 Based on the loaded and optimized method in front end under component development paradigm, storage medium
CN109621424A (en) * 2018-12-18 2019-04-16 深圳源中瑞科技有限公司 Expandable game construction method, game running method and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101826014A (en) * 2010-04-20 2010-09-08 北京邮电大学 Dividing method of source code in software engineering
US20170199858A1 (en) * 2016-01-07 2017-07-13 Chen-Chung YEH Form management system and method
CN107656738A (en) * 2017-10-16 2018-02-02 武汉斗鱼网络科技有限公司 Model structural design method and device in a kind of Android
CN109491806A (en) * 2018-11-01 2019-03-19 郑州云海信息技术有限公司 Adaptation method and device between a kind of kernel and third-party application
CN109614162A (en) * 2018-11-15 2019-04-12 福建天泉教育科技有限公司 Based on the loaded and optimized method in front end under component development paradigm, storage medium
CN109621424A (en) * 2018-12-18 2019-04-16 深圳源中瑞科技有限公司 Expandable game construction method, game running method and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
肖秋红: ""Android动态加载框架EasyDynamicLoad的设计与实现"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112130843A (en) * 2020-07-31 2020-12-25 北京编程猫科技有限公司 Method and device for importing programming works in graphical programming platform

Similar Documents

Publication Publication Date Title
EP3605324B1 (en) Application development method and tool, and storage medium thereof
Bean Laravel 5 essentials
CN104793946B (en) Dispositions method and system are applied based on cloud computing platform
Smart Jenkins: The Definitive Guide: Continuous Integration for the Masses
MacDonald et al. Pro ASP. NET 4 in VB 2010
US9043750B2 (en) Automated generation of two-tier mobile applications
US10089108B1 (en) Archival format for incremental deployments and version control
Herron Node web development
Sciabarrà LEARNING APACHE OPENWHISK: developing open serverless solutions
Walrath et al. Dart: Up and Running: A New, Tool-Friendly Language for Structured Web Apps
Uluca Angular for Enterprise-Ready Web Applications: Build and deliver production-grade and cloud-scale evergreen web apps with Angular 9 and beyond
MacDonald Beginning ASP. NET 4.5 in C
US20180089337A1 (en) Creating an engineering project in an industrial automation environment
CN110221821A (en) A kind of project function decoupling method and electronic equipment educated based on programming
Van Hattem Mastering Python
Anderson Getting started with NativeScript
Goodwin Learning Akka
Marchioni Hands-on Cloud-native Applications with Java and Quarkus: Build High Performance, Kubernetes-native Java Serverless Applications
CN110659022A (en) Method for automatically calling Python script based on Java
CN109492057A (en) A kind of educational system is used for Hive offline computing method and electronic equipment
Binsztok et al. Opa: Up and Running: Rapid and Secure Web Development
CN114691139A (en) Compiling method, device, storage medium and electronic equipment
CN111880775A (en) Multi-module layered architecture implementation method and device, electronic equipment and storage medium
Anagnostopoulos Hands-On Software Engineering with Golang: Move beyond basic programming to design and build reliable software with clean code
US9870257B1 (en) Automation optimization in a command line interface

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

Application publication date: 20190910

RJ01 Rejection of invention patent application after publication