CN108255495A - A kind of modularization method and system based on Mediator - Google Patents

A kind of modularization method and system based on Mediator Download PDF

Info

Publication number
CN108255495A
CN108255495A CN201810094565.9A CN201810094565A CN108255495A CN 108255495 A CN108255495 A CN 108255495A CN 201810094565 A CN201810094565 A CN 201810094565A CN 108255495 A CN108255495 A CN 108255495A
Authority
CN
China
Prior art keywords
business
pod
modularization
engineerings
category
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
CN201810094565.9A
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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN201810094565.9A priority Critical patent/CN108255495A/en
Publication of CN108255495A publication Critical patent/CN108255495A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

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

Abstract

The present invention provides a kind of modularization methods based on Mediator, and the main works of modularization APP are treated including creating;The business that modularization is needed to come out is chosen from the main works;Create the Pod engineerings of the business and the Category Pod engineerings that the business is facilitated to be called;The Category Pod engineerings are introduced in the main works, and the main works compiling is allowed to pass through;Target action are added in the Pod engineerings of the business, and the Pod engineering compilings of the business is allowed to pass through;The Pod engineerings of the business and the Category Pod engineerings that the business is facilitated to be called are subjected to hair version.The present invention provide it is a set of based on Mediator scheduling, it is easy to accomplish modularization scheme.Modularization is realized by Mediator classes, clear and definite parameter type interface, Target, Action that interface internal passes through performTarget method call service side's components are externally provided in such.Component after fractionation can be with stand-alone development, operation, test.The invention also discloses a kind of componentized systems based on Mediator.

Description

A kind of modularization method and system based on Mediator
Technical field
The present invention relates to technical field of computer software development more particularly to a kind of modularization methods based on Mediator And system.
Background technology
With the continuous development of mobile Internet, many program code amounts and business are more and more, much all suffer from focusing on The problem of structure.In project development, if comparison of item is small, common either simplex journey+MVC frameworks can meet most of need It asks.But with the progress of iteration, function is more and more, and project is increasing, and original either simplex journey framework is just insufficient for Framework demand.There have been fairly perfect modularization implementation in rear end, front end by technological accumulation for many years, in movement This several years of exploitation, modularization just receives the attention of more and more people.
Two class schemes, URL/protocol registrations scheduling, runtime tune are substantially classified as to the realization of modularization scheme in the industry Degree.The modularization scheme in mushroom street is to register to dispatch based on URL/protocol, and App instantiates each assembly module when starting, Then these components register Url to ModuleManager, do not need to sometimes instantiate, be registered using class.As component A When needing invocation component B, URL is transmitted to ModuleManager, parameter tracking URL is transmitted in a manner of GET, similar openURL. Then it is responsible for dispatching component B by ModuleManager, finally completes task.
Because in the implementation process of modularization scheme, the complexity of problem to be treated and disassemble, dispatch business The complexity of process is bigger, can not be competent in a manner of openURL an App is allowed to go to implement component based architecture merely. If being based on the scheme of openURL during modularization scheme is implemented to App, it can cause unconventional object can not It participates in dispatching between local component.
Therefore how to design standard set modularization scheme existing huge engineering can easily be transformed, be at present urgently It solves the problems, such as.
Invention content
In view of this, the present invention provides a kind of modularization method and system based on Mediator, pass through Mediator Class realizes modularization, clear and definite parameter type interface is externally provided in such, interface internal passes through performTarget method calls Target, Action of service side's component.Component after fractionation can be with stand-alone development, operation, test.It can be with reference to continuous integrating Effective reduce is packaged the demands such as time, test, also can easily be packaged entire APP, solve caused module during assembling test Incompatibility problem.
The present invention provides a kind of modularization method based on Mediator, the method includes:
Create the main works for treating modularization APP;
The business that modularization is needed to come out is chosen from the main works;
Create the Pod engineerings of the business and the Category Pod engineerings that the business is facilitated to be called;
The Category Pod engineerings are introduced in the main works, and the main works compiling is allowed to pass through;
Target-action is added in the Pod engineerings of the business, and the Pod engineering compilings of the business is allowed to pass through;
The Pod engineerings of the business and the Category Pod engineerings that the business is facilitated to be called are subjected to hair version.
Preferably, the method further includes:
Before modularization is carried out to the business, Git warehouses are built.
Preferably, the method further includes:
Before modularization is carried out to the business, privately owned Pod sources warehouse is built.
Preferably, the method further includes:
Before modularization is carried out to the business, initialization is for the quick script configuration for submitting component.
A kind of system, including:
First creation module:For creating the main works for treating modularization APP;
Choose module:For choosing the business that modularization is needed to come out from the main works;
Second creation module:For the Category for creating the Pod engineerings of the business He the business being facilitated to be called Pod engineerings;
First processing module:For introducing the Category Pod engineerings in the main works, and allow the main work Journey compiling passes through;
Second processing module:For adding Target-action in the Pod engineerings of the business, and allow the business Pod engineering compilings pass through;
Send out version module:For by the Pod engineerings of the business and facilitating the Category Pod works that the business is called Cheng Jinhang sends out version.
Preferably, the system also includes:
First builds module:For before modularization is carried out to the business, building Git warehouses.
Preferably, the system also includes:
Second builds module:Before modularization is carried out to the business, privately owned Pod sources warehouse is built.
Preferably, the system also includes:
Initialization module:For before modularization is carried out to the business, initialization to be for the quick foot for submitting component This configuration.
It can be seen from the above technical proposal that the present invention provides a kind of modularization method based on Mediator, including Create the main works for treating modularization APP;The business that modularization is needed to come out is chosen from the main works;Create the business Pod engineerings and facilitate the Category Pod engineerings that the business is called;The Category is introduced in the main works Pod engineerings, and the main works compiling is allowed to pass through;Target-action is added in the Pod engineerings of the business, and allows institute The Pod engineering compilings for stating business pass through;By the Pod engineerings of the business and the Category Pod that the business is facilitated to be called Engineering carries out hair version.The present invention realizes modularization by Mediator classes, and clear and definite parameter type interface is externally provided in such, is connect Internal Target, the Action for passing through performTarget method call service side's components of mouth.Component after fractionation can be independent Exploitation, operation, test.It can effectively be reduced with reference to continuous integrating and be packaged the demands such as time, test, also can be easily packaged entire APP solves caused module incompatibility problem during assembling test.Present invention offer is a set of based on Mediator scheduling, easily In the modularization scheme of realization.
Description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, to embodiment or will show below There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention, for those of ordinary skill in the art, without creative efforts, can be with Other attached drawings are obtained according to these attached drawings.
Fig. 1 is a kind of method flow diagram of the modularization embodiment of the method 1 based on Mediator disclosed by the invention;
Fig. 2 is a kind of method flow diagram of the modularization embodiment of the method 2 based on Mediator disclosed by the invention;
Fig. 3 is a kind of structure diagram of the componentized system embodiment 1 based on Mediator disclosed by the invention;
Fig. 4 is a kind of structure diagram of the componentized system embodiment 2 based on Mediator disclosed by the invention.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other without making creative work Embodiment shall fall within the protection scope of the present invention.
As shown in Figure 1, for a kind of method flow of the modularization embodiment of the method 1 based on Mediator disclosed by the invention Figure, the method includes:
S101, establishment treat the main works of modularization APP;
To when the APP of modularization being needed to implement modularization scheme, it is necessary first to create the main works of the APP.
S102, the business that modularization is needed to come out is chosen from main works;
The purpose for implementing modularization seeks to the independent modularization of some business in APP to come out, therefore create and treat group After the main works of part APP, need the business that modularization comes out will to be needed to select from main works.
S103, the Pod engineerings for creating business and the Category Pod engineerings that business is facilitated to be called;
Business is released as component, needs to be two privately owned Pod thus:The Pod of the business and facilitate other people Call the Pod of the Mediator category of the business.
S104, Category Pod engineerings are introduced in main works, and main works compiling is allowed to pass through;
After the privately owned Pod for creating the business that modularization is needed to come out, Category Pod engineerings are introduced into main works In, then main works are compiled, and main works compiling passes through.
S105, Target-action is added in the Pod engineerings of business, and the Pod engineering compilings of business is allowed to pass through;
A Target object is created in the Pod engineerings of business, and establishment one is corresponding with Target objects Action methods, and the Pod engineering compilings of the business is allowed to pass through.
S106, the Pod engineerings of business and the Category Pod engineerings that business is facilitated to be called are subjected to hair version.
Create two privately owned Pod, i.e. after Pod the and Category Pod of business, need the Pod of business and Category Pod carry out hair version.
In conclusion in the above-described embodiments, the main works for treating modularization APP are created first;Being chosen from main works needs The business that modularization is wanted to come out;The Pod engineerings of establishment business and facilitate the Category Pod engineerings that business is called;Then, Category Pod engineerings are introduced in main works, and main works compiling is allowed to pass through;It is added in the Pod engineerings of business Target-action, and the Pod engineering compilings of business is allowed to pass through;Finally, the Pod engineerings of business and business will be facilitated to be called Category Pod engineerings carry out hair version.The present invention realizes modularization by Mediator classes, is externally provided in such clear and definite Parameter type interface, Target, Action that interface internal passes through performTarget method call service side's components.It splits Component afterwards can be with stand-alone development, operation, test.It can effectively be reduced with reference to continuous integrating and be packaged the demands such as time, test, Also entire APP can be easily packaged, solves caused module incompatibility problem during assembling test.The present invention provides a set of be based on Mediator scheduling, it is easy to accomplish modularization scheme.
Specifically, in the above-described embodiments, Automatic dispatching is carried out using Objective-C language runtime characteristics, The calling of Mediator classes is to actively discover service by runtime, thus service side to it is such be full decoupled.If The method that Mediator classes externally provide all be placed on it is such in, it will Mediator is caused greatly bear and size of code.Solution Certainly method is exactly the Category of a Mediator to be created to each service side's component, and will be to service side's PerformTarget calling is placed in corresponding Category, these Category belong to Mediator middlewares, so as to real The interface separation on sense organ is showed.
Specifically, in the above-described embodiments, based on Mediator patterns and Target-Action patterns, centre employs Runtime carrys out complete call.The modularization scheme calls remote application and locally applied calling is split, and is by this Ground application call provides service for remote application calling.Due to having accomplished the automatic discovery of service by runtime, expand and call The task of interface is just only that respective module, any new interface addition, and new business addition all need not go main works to do exercises Make, it is very transparent.
Specifically, in the above-described embodiments,
Locally applied calling process is:
Local component A is somewhere called, and passes through sentence [[Mediator sharedInstance] perform Target: targetNameaction:actionNameparams:@{ ... }] it is initiated to Mediator across component call, Mediator roots According to target the and action information of acquisition, target examples and correspondence are converted by the runtime of objective-C Action selection, it is then final that the logic provided to target service is provided, complete demand.
Remote application process is:
For remote application by way of openURL, being found by system according to the scheme configurations in info.plist can be with After the application of response URL receives URL by AppDelegate, the openUrl of Mediator is called:Method will receive URL information be passed to.After incoming URL, Mediator by parsing URL, route requests to corresponding target and Action then carries out above-mentioned locally applied calling process, is finally completed response.Whole process does not have the infiltration of naming domain.
Target-Action that all components are all carried by component is responded, that is to say, that between module and module Interface has been cured in this layer of Target-Action, avoids in the transformation process for implementing modularization, Business is invaded Enter, while also improve the maintainability of modularization interface.
As shown in Fig. 2, for a kind of method flow of the modularization embodiment of the method 2 based on Mediator disclosed by the invention Figure, the method includes:
S201, to business carry out modularization before, build Git warehouses.
It before to some service implementation modularization in a project, needs to do some preparations, including taking Build Git warehouses.
S202, before carrying out modularization to business, privately owned Pod sources warehouse is built.
It before to some service implementation modularization in a project, needs to do some preparations, including taking Build privately owned Pod sources warehouse.
S203, to business carry out modularization before, initialization for quickly submit component script configuration.
Before to some service implementation modularization in a project, need to do some preparations, including first Script of the beginningization for quickly submission component is configured.
S204, establishment treat the main works of modularization APP;
To when the APP of modularization being needed to implement modularization scheme, it is necessary first to create the main works of the APP.
S205, the business that modularization is needed to come out is chosen from main works;
The purpose for implementing modularization seeks to the independent modularization of some business in APP to come out, therefore create and treat group After the main works of part APP, need the business that modularization comes out will to be needed to select from main works.
S206, the Pod engineerings for creating business and the Category Pod engineerings that business is facilitated to be called;
Business is released as component, needs to be two privately owned Pod thus:The Pod of the business and facilitate other people Call the Pod of the Mediator category of the business.
S207, Category Pod engineerings are introduced in main works, and main works compiling is allowed to pass through;
After the privately owned Pod for creating the business that modularization is needed to come out, Category Pod engineerings are introduced into main works In, then main works are compiled, and main works compiling passes through.
S208, Target-action is added in the Pod engineerings of business, and the Pod engineering compilings of business is allowed to pass through;
A Target object is created in the Pod engineerings of business, and establishment one is corresponding with Target objects Action methods, and the Pod engineering compilings of the business is allowed to pass through.
S209, the Pod engineerings of business and the Category Pod engineerings that business is facilitated to be called are subjected to hair version.
Create two privately owned Pod, i.e. after Pod the and Category Pod of business, need the Pod of business and Category Pod carry out hair version.
In conclusion in the above-described embodiments, first before modularization is carried out to business, Git warehouses are built, build private There is Pod sources warehouse, script of the initialization for quickly submission component is configured;Then the main works for treating modularization APP are created;From master The business that modularization is needed to come out is chosen in engineering;The Pod engineerings of establishment business and facilitate the Category that business is called Pod engineerings;Category Pod engineerings are introduced in main works, and main works compiling is allowed to pass through;Add in the Pod engineerings of business Add Target-action, and the Pod engineering compilings of business is allowed to pass through;Finally, the Pod engineerings of business and business will be facilitated to be adjusted Category Pod engineerings carry out hair version.The present invention realizes modularization by Mediator classes, is externally provided in such bright True parameter type interface, Target, Action that interface internal passes through performTarget method call service side's components.It tears open Component after point can be with stand-alone development, operation, test.Can effectively reduce packing time, test etc. with reference to continuous integrating needs It asks, also can easily be packaged entire APP, solve caused module incompatibility problem during assembling test.The present invention provides a set of base In Mediator scheduling, it is easy to accomplish modularization scheme.
Specifically, in the above-described embodiments, it before a project implementation modularization scheme, needs to do a beam worker Make, establish oneself privately owned Pod sources and fast hand-held tool script configuration, concrete operations are as follows:
It is exactly privately owned Pod sources warehouse first to remove out a repo, this repo;
Pod repo add [privately owned Pod sources warehouse name] [the repo addresses in privately owned Pod sources];
Found a file, such as Project.Our main works file is put under Project:~/ Project/MainProject;
The script repo in the privately owned source of clone rapid configurations under~/Project:git clone git@github.com: casatwy/ConfigPrivatePod.git;
By source'https in Podfile under the template files of ConfigPrivatePod:// Github.com/ModulizationDemo/PrivatePods.git' makes the repo in privately owned Pod sources warehouse inside the first step into Address;
Make PrivatePods in upload.sh under the template files of ConfigPrivatePod into second steps The name in the privately owned Pod sources in the inside warehouse.
Specifically, in the above-described embodiments, Automatic dispatching is carried out using Objective-C language runtime characteristics, The calling of Mediator classes is to actively discover service by runtime, thus service side to it is such be full decoupled.If The method that Mediator classes externally provide all be placed on it is such in, it will Mediator is caused greatly bear and size of code.Solution Certainly method is exactly the Category of a Mediator to be created to each service side's component, and will be to service side's PerformTarget calling is placed in corresponding Category, these Category belong to Mediator middlewares, so as to real The interface separation on sense organ is showed.
Specifically, in the above-described embodiments, based on Mediator patterns and Target-Action patterns, centre employs Runtime carrys out complete call.The modularization scheme calls remote application and locally applied calling is split, and is by this Ground application call provides service for remote application calling.Due to having accomplished the automatic discovery of service by runtime, expand and call The task of interface is just only that respective module, any new interface addition, and new business addition all need not go main works to do exercises Make, it is very transparent.
Specifically, in the above-described embodiments,
Locally applied calling process is:
Local component A is somewhere called, and passes through sentence [[Mediator sharedInstance] perform Target: targetNameaction:actionNameparams:@{ ... }] it is initiated to Mediator across component call, Mediator roots According to target the and action information of acquisition, target examples and correspondence are converted by the runtime of objective-C Action selection, it is then final that the logic provided to target service is provided, complete demand.
Remote application process is:
For remote application by way of openURL, being found by system according to the scheme configurations in info.plist can be with After the application of response URL receives URL by AppDelegate, the openUrl of Mediator is called:Method will receive URL information be passed to.After incoming URL, Mediator by parsing URL, route requests to corresponding target and Action then carries out above-mentioned locally applied calling process, is finally completed response.Whole process does not have the infiltration of naming domain.
Target-Action that all components are all carried by component is responded, that is to say, that between module and module Interface has been cured in this layer of Target-Action, avoids in the transformation process for implementing modularization, Business is invaded Enter, while also improve the maintainability of modularization interface.
As shown in figure 3, for a kind of structural representation of the componentized system embodiment 1 based on Mediator disclosed by the invention Figure, the system comprises:
301st, the first creation module:For creating the main works for treating modularization APP;
To when the APP of modularization being needed to implement modularization scheme, it is necessary first to create the main works of the APP.
302nd, module is chosen:For choosing the business that modularization is needed to come out from main works;
The purpose for implementing modularization seeks to the independent modularization of some business in APP to come out, therefore create and treat group After the main works of part APP, need the business that modularization comes out will to be needed to select from main works.
303rd, the second creation module:For the Category Pod for creating the Pod engineerings of business He business being facilitated to be called Engineering;
Business is released as component, needs to be two privately owned Pod thus:The Pod of the business and facilitate other people Call the Pod of the Mediator category of the business.
304th, first processing module:Category Pod engineerings are introduced in main works, and main works compiling is allowed to pass through;
After the privately owned Pod for creating the business that modularization is needed to come out, Category Pod engineerings are introduced into main works In, then main works are compiled, and main works compiling passes through.
305th, Second processing module:For adding Target-action in the Pod engineerings of business, and allow the Pod of business Engineering compiling passes through;
A Target object is created in the Pod engineerings of business, and establishment one is corresponding with Target objects Action methods, and the Pod engineering compilings of the business is allowed to pass through.
306th, version module is sent out:For by the Pod engineerings of business and facilitate the Category Pod engineerings that business is called into Row hair version.
Create two privately owned Pod, i.e. after Pod the and Category Pod of business, need the Pod of business and Category Pod carry out hair version.
In conclusion in the above-described embodiments, the main works for treating modularization APP are created first;Being chosen from main works needs The business that modularization is wanted to come out;The Pod engineerings of establishment business and facilitate the Category Pod engineerings that business is called;Then, Category Pod engineerings are introduced in main works, and main works compiling is allowed to pass through;It is added in the Pod engineerings of business Target-action, and the Pod engineering compilings of business is allowed to pass through;Finally, the Pod engineerings of business and business will be facilitated to be called Category Pod engineerings carry out hair version.The present invention realizes modularization by Mediator classes, is externally provided in such clear and definite Parameter type interface, Target, Action that interface internal passes through performTarget method call service side's components.It splits Component afterwards can be with stand-alone development, operation, test.It can effectively be reduced with reference to continuous integrating and be packaged the demands such as time, test, Also entire APP can be easily packaged, solves caused module incompatibility problem during assembling test.The present invention provides a set of be based on Mediator scheduling, it is easy to accomplish modularization scheme.
Specifically, in the above-described embodiments, Automatic dispatching is carried out using Objective-C language runtime characteristics, The calling of Mediator classes is to actively discover service by runtime, thus service side to it is such be full decoupled.If The method that Mediator classes externally provide all be placed on it is such in, it will Mediator is caused greatly bear and size of code.Solution Certainly method is exactly the Category of a Mediator to be created to each service side's component, and will be to service side's PerformTarget calling is placed in corresponding Category, these Category belong to Mediator middlewares, so as to real The interface separation on sense organ is showed.
Specifically, in the above-described embodiments, based on Mediator patterns and Target-Action patterns, centre employs Runtime carrys out complete call.The modularization scheme calls remote application and locally applied calling is split, and is by this Ground application call provides service for remote application calling.Due to having accomplished the automatic discovery of service by runtime, expand and call The task of interface is just only that respective module, any new interface addition, and new business addition all need not go main works to do exercises Make, it is very transparent.
Specifically, in the above-described embodiments,
Locally applied calling process is:
Local component A is somewhere called, and passes through sentence [[Mediator sharedInstance] perform Target: targetNameaction:actionNameparams:@{ ... }] it is initiated to Mediator across component call, Mediator roots According to target the and action information of acquisition, target examples and correspondence are converted by the runtime of objective-C Action selection, it is then final that the logic provided to target service is provided, complete demand.
Remote application process is:
For remote application by way of openURL, being found by system according to the scheme configurations in info.plist can be with After the application of response URL receives URL by AppDelegate, the openUrl of Mediator is called:Method will receive URL information be passed to.After incoming URL, Mediator by parsing URL, route requests to corresponding target and Action then carries out above-mentioned locally applied calling process, is finally completed response.Whole process does not have the infiltration of naming domain.
Target-Action that all components are all carried by component is responded, that is to say, that between module and module Interface has been cured in this layer of Target-Action, avoids in the transformation process for implementing modularization, Business is invaded Enter, while also improve the maintainability of modularization interface.
As shown in figure 4, for a kind of structural representation of the componentized system embodiment 2 based on Mediator disclosed by the invention Figure, the system comprises:
401st, first module is built:For before modularization is carried out to business, building Git warehouses.
It before to some service implementation modularization in a project, needs to do some preparations, including taking Build Git warehouses.
402nd, second module is built:For before carrying out modularization to business, building privately owned Pod sources warehouse.
It before to some service implementation modularization in a project, needs to do some preparations, including taking Build privately owned Pod sources warehouse.
403rd, initialization module:For before modularization is carried out to business, initialization to be for the quick foot for submitting component This configuration.
Before to some service implementation modularization in a project, need to do some preparations, including first Script of the beginningization for quickly submission component is configured.
404th, the first creation module:For creating the main works for treating modularization APP;
To when the APP of modularization being needed to implement modularization scheme, it is necessary first to create the main works of the APP.
405th, module is chosen:For choosing the business that modularization is needed to come out from main works;
The purpose for implementing modularization seeks to the independent modularization of some business in APP to come out, therefore create and treat group After the main works of part APP, need the business that modularization comes out will to be needed to select from main works.
406th, the second creation module:The Pod engineerings of establishment business and facilitate the Category Pod engineerings that business is called;
Business is released as component, needs to be two privately owned Pod thus:The Pod of the business and facilitate other people Call the Pod of the Mediator category of the business.
407th, first processing module:For introducing Category Pod engineerings in main works, and make main works compiling logical It crosses;
After the privately owned Pod for creating the business that modularization is needed to come out, Category Pod engineerings are introduced into main works In, then main works are compiled, and main works compiling passes through.
408th, Second processing module:For adding Target-action in the Pod engineerings of business, and allow the Pod of business Engineering compiling passes through;
A Target object is created in the Pod engineerings of business, and establishment one is corresponding with Target objects Action methods, and the Pod engineering compilings of the business is allowed to pass through.
409th, version module is sent out:For by the Pod engineerings of business and facilitate the Category Pod engineerings that business is called into Row hair version.
Create two privately owned Pod, i.e. after Pod the and Category Pod of business, need the Pod of business and Category Pod carry out hair version.
In conclusion in the above-described embodiments, first before modularization is carried out to business, Git warehouses are built, build private There is Pod sources warehouse, script of the initialization for quickly submission component is configured;Then the main works for treating modularization APP are created;From master The business that modularization is needed to come out is chosen in engineering;The Pod engineerings of establishment business and facilitate the Category that business is called Pod engineerings;Category Pod engineerings are introduced in main works, and main works compiling is allowed to pass through;Add in the Pod engineerings of business Add Target-action, and the Pod engineering compilings of business is allowed to pass through;Finally, the Pod engineerings of business and business will be facilitated to be adjusted Category Pod engineerings carry out hair version.The present invention realizes modularization by Mediator classes, is externally provided in such bright True parameter type interface, Target, Action that interface internal passes through performTarget method call service side's components.It tears open Component after point can be with stand-alone development, operation, test.Can effectively reduce packing time, test etc. with reference to continuous integrating needs It asks, also can easily be packaged entire APP, solve caused module incompatibility problem during assembling test.The present invention provides a set of base In Mediator scheduling, it is easy to accomplish modularization scheme.
Specifically, in the above-described embodiments, it before a project implementation modularization scheme, needs to do a beam worker Make, establish oneself privately owned Pod sources and fast hand-held tool script configuration, concrete operations are as follows:
It is exactly privately owned Pod sources warehouse first to remove out a repo, this repo;
Pod repo add [privately owned Pod sources warehouse name] [the repo addresses in privately owned Pod sources];
Found a file, such as Project.Our main works file is put under Project:~/ Project/MainProject;
The script repo in the privately owned source of clone rapid configurations under~/Project:git clone git@github.com: casatwy/ConfigPrivatePod.git;
By source'https in Podfile under the template files of ConfigPrivatePod:// Github.com/ModulizationDemo/PrivatePods.git' makes the repo in privately owned Pod sources warehouse inside the first step into Address;
Make PrivatePods in upload.sh under the template files of ConfigPrivatePod into second steps The name in the privately owned Pod sources in the inside warehouse.
Specifically, in the above-described embodiments, Automatic dispatching is carried out using Objective-C language runtime characteristics, The calling of Mediator classes is to actively discover service by runtime, thus service side to it is such be full decoupled.If The method that Mediator classes externally provide all be placed on it is such in, it will Mediator is caused greatly bear and size of code.Solution Certainly method is exactly the Category of a Mediator to be created to each service side's component, and will be to service side's PerformTarget calling is placed in corresponding Category, these Category belong to Mediator middlewares, so as to real The interface separation on sense organ is showed.
Specifically, in the above-described embodiments, based on Mediator patterns and Target-Action patterns, centre employs Runtime carrys out complete call.The modularization scheme calls remote application and locally applied calling is split, and is by this Ground application call provides service for remote application calling.Due to having accomplished the automatic discovery of service by runtime, expand and call The task of interface is just only that respective module, any new interface addition, and new business addition all need not go main works to do exercises Make, it is very transparent.
Specifically, in the above-described embodiments,
Locally applied calling process is:
Local component A is somewhere called, and passes through sentence [[Mediator sharedInstance] perform Target: targetNameaction:actionNameparams:@{ ... }] it is initiated to Mediator across component call, Mediator roots According to target the and action information of acquisition, target examples and correspondence are converted by the runtime of objective-C Action selection, it is then final that the logic provided to target service is provided, complete demand.
Remote application process is:
For remote application by way of openURL, being found by system according to the scheme configurations in info.plist can be with After the application of response URL receives URL by AppDelegate, the openUrl of Mediator is called:Method will receive URL information be passed to.After incoming URL, Mediator by parsing URL, route requests to corresponding target and Action then carries out above-mentioned locally applied calling process, is finally completed response.Whole process does not have the infiltration of naming domain.
Target-Action that all components are all carried by component is responded, that is to say, that between module and module Interface has been cured in this layer of Target-Action, avoids in the transformation process for implementing modularization, Business is invaded Enter, while also improve the maintainability of modularization interface.
Each embodiment is described by the way of progressive in this specification, the highlights of each of the examples are with other The difference of embodiment, just to refer each other for identical similar portion between each embodiment.For device disclosed in embodiment For, since it is corresponded to the methods disclosed in the examples, so description is fairly simple, related part is said referring to method part It is bright.
Professional further appreciates that, with reference to each exemplary unit of the embodiments described herein description And algorithm steps, can be realized with the combination of electronic hardware, computer software or the two, in order to clearly demonstrate hardware and The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These Function is performed actually with hardware or software mode, specific application and design constraint depending on technical solution.Profession Technical staff can realize described function to each specific application using distinct methods, but this realization should not Think beyond the scope of this invention.
It can directly be held with reference to the step of method or algorithm that the embodiments described herein describes with hardware, processor The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology In any other form of storage medium well known in field.
The foregoing description of the disclosed embodiments enables professional and technical personnel in the field to realize or use the present invention. A variety of modifications of these embodiments will be apparent for those skilled in the art, it is as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention The embodiments shown herein is not intended to be limited to, and is to fit to and the principles and novel features disclosed herein phase one The most wide range caused.

Claims (8)

  1. A kind of 1. modularization method based on Mediator, which is characterized in that including:
    Create the main works for treating modularization APP;
    The business that modularization is needed to come out is chosen from the main works;
    Create the Pod engineerings of the business and the Category Pod engineerings that the business is facilitated to be called;
    The Category Pod engineerings are introduced in the main works, and the main works compiling is allowed to pass through;
    Target-action is added in the Pod engineerings of the business, and the Pod engineering compilings of the business is allowed to pass through;
    The Pod engineerings of the business and the Category Pod engineerings that the business is facilitated to be called are subjected to hair version.
  2. 2. it according to the method described in claim 1, it is characterized in that, further includes:
    Before modularization is carried out to the business, Git warehouses are built.
  3. 3. it according to the method described in claim 1, it is characterized in that, further includes:
    Before modularization is carried out to the business, privately owned Pod sources warehouse is built.
  4. 4. it according to the method described in claim 1, it is characterized in that, further includes:
    Before modularization is carried out to the business, initialization is for the quick script configuration for submitting component.
  5. 5. a kind of componentized system based on Mediator, which is characterized in that including:
    First creation module:For creating the main works for treating modularization APP;
    Choose module:For choosing the business that modularization is needed to come out from the main works;
    Second creation module:For the Category Pod for creating the Pod engineerings of the business He the business being facilitated to be called Engineering;
    First processing module:For introducing the Category Pod engineerings in the main works, and the main works is allowed to compile It translates and passes through;
    Second processing module:For adding Target-action in the Pod engineerings of the business, and allow the Pod of the business Engineering compiling passes through;
    Send out version module:For by the Pod engineerings of the business and facilitate the Category Pod engineerings that the business is called into Row hair version.
  6. 6. system according to claim 5, which is characterized in that further include:
    First builds module:For before modularization is carried out to the business, building Git warehouses.
  7. 7. system according to claim 5, which is characterized in that further include:
    Second builds module:Before modularization is carried out to the business, privately owned Pod sources warehouse is built.
  8. 8. system according to claim 5, which is characterized in that further include:
    Initialization module:For before modularization is carried out to the business, script of the initialization for quickly submission component to be matched It puts.
CN201810094565.9A 2018-01-31 2018-01-31 A kind of modularization method and system based on Mediator Pending CN108255495A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810094565.9A CN108255495A (en) 2018-01-31 2018-01-31 A kind of modularization method and system based on Mediator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810094565.9A CN108255495A (en) 2018-01-31 2018-01-31 A kind of modularization method and system based on Mediator

Publications (1)

Publication Number Publication Date
CN108255495A true CN108255495A (en) 2018-07-06

Family

ID=62742349

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810094565.9A Pending CN108255495A (en) 2018-01-31 2018-01-31 A kind of modularization method and system based on Mediator

Country Status (1)

Country Link
CN (1) CN108255495A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111142895A (en) * 2019-11-26 2020-05-12 叮当快药科技集团有限公司 Method and system for synchronously updating components in project based on SVN (singular value decomposition) module
CN111611024A (en) * 2020-05-09 2020-09-01 上海万间信息技术有限公司 iOS component optimization method, system and terminal
CN112860232A (en) * 2019-11-28 2021-05-28 杭州萤石软件有限公司 Component implementation method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009061146A2 (en) * 2007-11-07 2009-05-14 An-Mo Jeong A method for software development and operation based on component reuse and dependency injection
CN107577483A (en) * 2017-08-31 2018-01-12 武汉斗鱼网络科技有限公司 Component engineering calls method, storage medium, equipment and the system of main works code

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009061146A2 (en) * 2007-11-07 2009-05-14 An-Mo Jeong A method for software development and operation based on component reuse and dependency injection
CN107577483A (en) * 2017-08-31 2018-01-12 武汉斗鱼网络科技有限公司 Component engineering calls method, storage medium, equipment and the system of main works code

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
IOSBLOG: "《在现有工程中实施基于CTMediator的组件化方案》", 20 March 2017 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111142895A (en) * 2019-11-26 2020-05-12 叮当快药科技集团有限公司 Method and system for synchronously updating components in project based on SVN (singular value decomposition) module
CN112860232A (en) * 2019-11-28 2021-05-28 杭州萤石软件有限公司 Component implementation method and device
CN111611024A (en) * 2020-05-09 2020-09-01 上海万间信息技术有限公司 iOS component optimization method, system and terminal
CN111611024B (en) * 2020-05-09 2022-10-11 上海万间信息技术有限公司 iOS component optimization method, system and terminal

Similar Documents

Publication Publication Date Title
US10956130B2 (en) Method and system for implementing a cloud infrastructure visualizer and generator
CN105912342A (en) APK (Android Package) development method and system based on overlay mechanism
CN108255495A (en) A kind of modularization method and system based on Mediator
CN103713902B (en) A kind of BOA Compilation Methods and system based on android system
Barnett et al. Bootstrapping mobile app development
EP2542964A1 (en) A computationally efficient system for developing configurable, extensible gui for database centric enterprise business applications
CN102810184A (en) Method and device for dynamically executing workflow and enterprise system
CN109871241A (en) A kind of configuration method of Cross-environment application server
Hebig et al. On the complex nature of mde evolution
Bartusevics et al. Models for implementation of software configuration management
CN115878112A (en) Multi-party complex business agreement intelligent contract generating system and generating method thereof
CN102812437B (en) Height and low value application state
CA2353026A1 (en) Adaptive data architecture
Lieberherr et al. Experience with a graph-based propagation programming tool
US20120240097A1 (en) Method of providing software development services
CN107817972A (en) Cache code process method, apparatus, storage medium and electronic equipment
KR102046622B1 (en) Software service system based on workflow and computer program that performs each step of the system
US20070226712A1 (en) Method of providing software development services
KR960024908A (en) How to create base station software package for mobile communication system
CN114168110B (en) Application development transaction management system and method for lightweight class Hongmon operating system
Kijas et al. Evolution Process for SOA Systems as a Part of the MAD4SOA Methodology
CN108289250A (en) Set top box operations method for managing system and system
US20210373876A1 (en) System and method for implementing a monitoring tool switch
Furusawa Attempting to increase longevity of applications based on new SaaS/cloud technology
Singh et al. Blockchain Application Development

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: 20180706