CN111158698B - Modularized communication device and method under Android platform - Google Patents

Modularized communication device and method under Android platform Download PDF

Info

Publication number
CN111158698B
CN111158698B CN201911401989.6A CN201911401989A CN111158698B CN 111158698 B CN111158698 B CN 111158698B CN 201911401989 A CN201911401989 A CN 201911401989A CN 111158698 B CN111158698 B CN 111158698B
Authority
CN
China
Prior art keywords
module
communication
codes
modules
dependent
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.)
Active
Application number
CN201911401989.6A
Other languages
Chinese (zh)
Other versions
CN111158698A (en
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.)
Beijing Baige Feichi Technology Co ltd
Original Assignee
Beijing Baige Feichi 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 Beijing Baige Feichi Technology Co ltd filed Critical Beijing Baige Feichi Technology Co ltd
Priority to CN201911401989.6A priority Critical patent/CN111158698B/en
Publication of CN111158698A publication Critical patent/CN111158698A/en
Application granted granted Critical
Publication of CN111158698B publication Critical patent/CN111158698B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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 invention provides a modularized communication device and method under an Android platform. The device comprises at least two modules with communication requirements, a compiler and an intermediate code integrator, wherein the intermediate code integrator is used for integrating the intermediate codes of the two parties with the communication requirements to generate intermediate codes capable of being linked through compiling; the module with communication requirement is provided with a module communication interface and a module dependent interface besides the module function code, the module function code defines the operation steps for completing the module function, and the module communication interface is matched with the module dependent interface of the other module in communication to transfer the dependent relationship to the module. The invention meets the requirements of communication after corresponding communication interfaces and module dependent interfaces are respectively established according to the communication relation when a plurality of modules with the dependent relation need to carry out two-by-two communication.

Description

Modularized communication device and method under Android platform
Technical Field
The invention relates to the field of Android platform communication, in particular to a device and a method for two-by-two communication of software modules under an Android platform.
Background
In the software development process, development is often performed using a modular method. The modular development is a method of modern software development for decomposing complex systems into better manageable subsystems, each decomposed subsystem being referred to as a module, each module being independently developable. When the modules are required to be combined to form a complex system, the modules communicate and transfer information through communication.
Existing modular communication systems typically do the following:
1. all modules rely on a basic module, and communication before the module transmits data via the relevant protocol defined by the basic module.
2. The communication between the modules adopts a certain serialization mechanism (including but not limited to Json, seriability, parcelability and pb) to serialize the data transmission module which needs to be communicated, and the corresponding module needs to deserialize after receiving the corresponding data
3. Communication data is transmitted to the corresponding modules in a global communication mode through a global communication mechanism (including but not limited to global broadcasting, local broadcasting, eventbus) and the like
In the first method, all modules depend on a common module, so that the common module has the problems of high expansion speed, poor system maintainability, low development efficiency and the like.
The second method may result in reduced communication efficiency due to the use of a serialized communication mechanism.
The third method adopts a global communication mechanism, which results in the problems of poor system maintainability, low development efficiency and the like.
Thus, there is an urgent need for a comprehensive communication device to overcome the above-mentioned drawbacks.
Disclosure of Invention
In view of the above, the present invention aims to provide a modular communication device and method under an Android platform.
In order to achieve the above purpose, the present invention adopts the following technical scheme: the modularized communication device under the Android platform comprises at least two modules with communication requirements, a compiler and an intermediate code integrator, wherein the intermediate code integrator is used for integrating the respective intermediate codes of the two parties with the communication requirements to generate intermediate codes capable of being linked through compiling;
the module with communication requirement is provided with a module communication interface and a module dependent interface besides the module function code, the module function code defines the operation steps for completing the module function, and the module communication interface is matched with the module dependent interface of the other module in communication to transfer the dependent relationship to the module.
Further, the generation mode of the module dependent interface is as follows: and copying the communication related codes of the relied modules to a communication directory automatically generated by the device at the compiling period in the development stage.
Further, a plurality of module dependent interfaces can be provided for transferring the dependent relationship of the opposite module in different communications to the present module.
Further, the module dependency interface provides dependency transfer only for a particular one of the modules.
Further, the intermediate code integrator integrates the intermediate codes by searching and deleting the intermediate codes repeatedly relied on in the two modules of the two communication parties, so as to generate the intermediate codes capable of being connected through compiling.
Further, the communication device also comprises a custom compiler, wherein the custom compiler is used for directly deleting the repeated dependent codes in the process of generating the intermediate codes.
The invention also provides a modularized communication method under the Android platform, which comprises the following steps:
s1: splitting the dependent module into two parts, namely function realization and module communication;
s2: generating an intermediate code according to codes of two modules and a relied module of two communication parties;
s3: checking the intermediate codes generated by the two modules of the two communication parties and the dependent module, analyzing repeated dependent codes, deleting the repeated dependent codes, and generating integrated intermediate codes;
s4: and executing further compiling links on the integrated codes to generate a final library file or an executable file.
Further, the step S3 includes the following steps:
s31: whether the compiling environment masks the class file of the sourceFile is resolved, if not, the step S32 is executed, otherwise, the step S35 is skipped;
s32: reading attributes corresponding to the sourceFile to find the source file name corresponding to the class file;
s33: summarizing the repeatedly defined class files in all the modules which can be communicated pairwise;
s34: deleting the redefined class file and ending integration after storing the integrated intermediate code;
s35: scanning all class files;
s36: finding out class files matched with and retaining the api full path names;
s37: and deleting the class file matched with the full path name of the reserved api and ending integration after the integrated intermediate code is stored.
The method and the device solve the problem of conflict of codes generated during compiling among a plurality of modules with communication requirements. In theory, the number of the module communication is not limited, and the requirement of two-by-two bidirectional communication between any number of modules can be met. According to the modularized communication device, the module communication interface and the module dependence interface are arranged in the module, so that the problem that when two modules for communication depend on a certain third party module together, conflict can occur in the compiling process is solved, and the dependence relationship in module development is basically transparent to upper layer developers, so that the device has the advantages of high development efficiency and good maintainability compared with other communication schemes.
Drawings
FIG. 1 is a diagram of a compilation conflict occurring in the prior art;
FIG. 2 is a diagram of a prior art method for resolving compilation conflicts;
FIG. 3 is a schematic diagram of a connection relationship according to an embodiment of the present invention;
fig. 4 is a flow chart of a method according to an embodiment of the invention.
Detailed Description
As shown in fig. 1, in the prior art, if a module a needs to communicate with a module C, and the module a and the module C need to rely on a module B respectively during compiling, a phenomenon of using the module B simultaneously occurs during the stage of compiling an executable file by a compiler, which generates a conflict.
In order to avoid the occurrence of the above-mentioned collision, the dependency relationship is usually set and manually transferred. As shown in fig. 2, the module a is made dependent on the module C, while the module C is made dependent on the module B. In this way, the dependency relationship is transferred to the module A by the module C, and the conflict that the module B is used simultaneously in the compiling process is avoided. However, this scheme results in that when the module a is compiled each time, the module B and the module C are compiled again at the same time, which wastes compiling resources and reduces the communication efficiency between the modules.
In order to avoid serializing related data during communication between modules and improve communication efficiency, the invention provides a modularized communication device. The technical scheme of the invention is further described in detail below with reference to the accompanying drawings.
Example 1:
a modular communication device and method under an Android platform comprises at least two modules with communication requirements, a compiler and an intermediate code integrator. The modules may be divided into three parts, module function code, module communication interface and module dependent interface, respectively. The module function code is the main body of the module and is composed of main body source codes for realizing the module function; the module communication interface is regarded as an interface for the communication between the module and a specific other module and is used for information exchange and transmission; the module dependency interface is matched with a certain specific other module through the transfer dependency relationship, and the dependency relationship is transferred to the module dependency interface. When a plurality of modules with a dependency relationship need to perform two-by-two communication, corresponding communication interfaces and module dependency interfaces need to be respectively established according to the communication relationship.
As shown in fig. 3, it is assumed that modules a and C depend on module B, respectively. When the module A and the module C communicate, the module B needs to be split into two parts, namely a function implementation part and a module communication part. And simultaneously, copying the module communication related codes of the module B to a modular communication directory defined by the device. Since the device automatically generates the relevant directory in the compiling period, the problem of no path recognition is avoided.
Since the development is performed under the Android platform, the source codes in A, B, C modules are compiled by using a Java compiler to generate intermediate codes, namely class files.
And sending the generated 3 parts of intermediate codes into an intermediate code integrator, and judging whether the class file of the sourceFile is subjected to shielding setting by the intermediate code integrator. If no shielding setting is available, reading attributes corresponding to the sourceFiles to find out source file names corresponding to class files, and summarizing and deleting the class files repeatedly defined in the three modules. And if the shielding setting is carried out, scanning all class files, finding out the class files which are matched with and reserved with the api full-path name, and deleting.
In this embodiment, a typical structure of class is as follows:
the core source code of the intermediate code integrator operation is as follows:
after the integrated intermediate codes are obtained, further compiling and linking are carried out on the integrated intermediate codes, and a final library file or an executable file is generated.
Example 2:
a modular communication device and method under an Android platform comprises at least two modules with communication requirements, a compiler and an intermediate code integrator. The modules may be divided into three parts, module function code, module communication interface and module dependent interface, respectively. The module function code is the main body of the module and is composed of main body source codes for realizing the module function; the module communication interface is regarded as an interface for the communication between the module and a specific other module and is used for information exchange and transmission; the module dependency interface is matched with a certain specific other module through the transfer dependency relationship, and the dependency relationship is transferred to the module dependency interface. When a plurality of modules with a dependency relationship need to perform two-by-two communication, corresponding communication interfaces and module dependency interfaces need to be respectively established according to the communication relationship.
When the device developer has the capability of developing a custom compiler, the custom compiler can also be developed, when three modules of the dependency relationship shown in fig. 3 are compiled, an intermediate file without repeated dependent codes is directly generated, the setting of the intermediate code integrator is omitted in the device, the structure of the device is simplified, and the device has stronger flexibility.
The above describes the modularized communication device and method under the Android platform provided by the invention in detail, and specific examples are applied to describe the principle and implementation of the invention, and the description of the above examples is only used for helping to understand the method and core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope according to the ideas of the present invention, the present disclosure should not be construed as limiting the technical solution of the present invention.

Claims (8)

1. The modularized communication device under the Android platform is characterized by comprising at least two modules with communication requirements, a compiler and an intermediate code integrator, wherein the intermediate code integrator is used for integrating the respective intermediate codes of the two parties with the communication requirements to generate intermediate codes capable of being linked through compiling;
the module with the communication requirement is provided with a module communication interface and a module dependent interface besides a module function code, wherein the module function code defines operation steps for completing the function of the module, and the module communication interface is matched with a module dependent interface of a counterpart module in communication to transfer the dependent relationship to the module;
determining two modules with communication requirements, copying a communication api to a directory defined by a system, and generating an intermediate code, namely a class file;
sending the generated intermediate code class file into an intermediate code integrator, and judging whether the class file of the sourceFile is subjected to shielding setting by the intermediate code integrator;
if no shielding setting is available, reading attributes corresponding to the sourceFile to find out the source file name corresponding to the class file, and summarizing and deleting the class file repeatedly defined in the module needing communication;
if the shielding setting is carried out, all class files are scanned, class files which are matched with and reserved with the api full-path names are found out and deleted;
after the integrated intermediate codes are obtained, further compiling and linking are carried out on the integrated intermediate codes, and a final library file or an executable file is generated.
2. The modular communication device under an Android platform according to claim 1, wherein the generation mode of the module dependent interface is: and copying the communication related codes of the relied modules to a communication directory automatically generated by the device at the compiling period in the development stage.
3. The modular communication device under the Android platform according to claim 2, wherein a plurality of module dependent interfaces can be provided for transferring the dependency relationship of the other modules in different communications to the present module.
4. A modular communication device under an Android platform as claimed in claim 3, wherein the module dependency interface provides dependency transfer only for a particular one of the modules.
5. The modular communication device under the Android platform according to claim 1, wherein the intermediate code integrator integrates intermediate codes by searching and deleting intermediate codes repeatedly relied on in two modules of both communication parties to generate intermediate codes capable of being connected through compiling.
6. The modular communication device under the Android platform of claim 1, further comprising a custom compiler for directly deleting the de-dependent code during the generation of the intermediate code.
7. The modularized communication method under an Android platform, which is applied to the modularized communication device under the Android platform as claimed in claim 1, comprises the following steps:
s1: splitting the dependent module into two parts, namely function realization and module communication;
s2: generating an intermediate code according to codes of two modules and a relied module of two communication parties;
s3: checking the intermediate codes generated by the two modules of the two communication parties and the dependent module, analyzing repeated dependent codes, deleting the repeated dependent codes, and generating integrated intermediate codes;
s4: and executing further compiling links on the integrated codes to generate a final library file or an executable file.
8. The method for modular communication under an Android platform as claimed in claim 7, wherein step S3 comprises the steps of:
s31: whether the compiling environment masks the class file of the sourceFile is resolved, if not, the step S32 is executed, otherwise, the step S35 is skipped;
s32: reading attributes corresponding to the sourceFile to find the source file name corresponding to the class file;
s33: summarizing the repeatedly defined class files in all the modules which can be communicated pairwise;
s34: deleting the redefined class file and ending integration after storing the integrated intermediate code;
s35: scanning all class files;
s36: finding out class files matched with and retaining the api full path names;
s37: and deleting the class file matched with the full path name of the reserved api and ending integration after the integrated intermediate code is stored.
CN201911401989.6A 2019-12-30 2019-12-30 Modularized communication device and method under Android platform Active CN111158698B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911401989.6A CN111158698B (en) 2019-12-30 2019-12-30 Modularized communication device and method under Android platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911401989.6A CN111158698B (en) 2019-12-30 2019-12-30 Modularized communication device and method under Android platform

Publications (2)

Publication Number Publication Date
CN111158698A CN111158698A (en) 2020-05-15
CN111158698B true CN111158698B (en) 2024-03-26

Family

ID=70559350

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911401989.6A Active CN111158698B (en) 2019-12-30 2019-12-30 Modularized communication device and method under Android platform

Country Status (1)

Country Link
CN (1) CN111158698B (en)

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
CN107454954A (en) * 2015-05-27 2017-12-08 谷歌公司 Data bind correlation analysis

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7448030B2 (en) * 2004-03-18 2008-11-04 Intel Corporation Optimized ordering of firmware modules in pre-boot environment

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
CN107454954A (en) * 2015-05-27 2017-12-08 谷歌公司 Data bind correlation analysis

Also Published As

Publication number Publication date
CN111158698A (en) 2020-05-15

Similar Documents

Publication Publication Date Title
CN100442234C (en) Software package constructing method and system for embedded system
US7810082B2 (en) System and method for transforming generic software code into operator specific code
CN110457045B (en) Component combining and compiling method, device, equipment and storage medium
CN110737631A (en) data analysis method and device based on Flink engine
CN114153463B (en) Management system service function creating method and system based on script compiler
CN114968192A (en) Project creation method and device, computer equipment and storage medium
CN116400895A (en) Dynamic link library reflection method and system based on C language preprocessor
CN111158698B (en) Modularized communication device and method under Android platform
CN102662772A (en) Method for realizing data communication between different languages in multi-language development system
CN116737174B (en) Automatic subsystem generating tool and method based on open source hong Meng system
CN114625379B (en) H5 project source code generation method and H5 project source code development system
CN101952805B (en) Efficiently correlating nominally incompatible types
CN116466915A (en) MVP architecture-based iOS development framework construction method and device
CN115480780A (en) Micro-service application efficient deployment method based on Windows system
CN115456628A (en) Intelligent contract viewing method and device based on block chain, storage medium and equipment
CN115022312A (en) Method and device for realizing multiple intelligent contract engines, electronic equipment and storage medium
Dalibor et al. Tagging Model Properties for Flexible Communication.
CN113792093A (en) Signal system interface service creating and executing method, device and electronic equipment
CN112732828A (en) Cross-platform data sharing method based on data warehouse tool
CN113467769A (en) Three-layer hybrid development system based on HTML5 and development method thereof
Baker et al. Testing UML2. 0 models using TTCN-3 and the UML2. 0 testing profile
CN111782194A (en) Automatic generation method of portable unit code based on aviation embedded open system architecture
CN113467860B (en) Service logic execution method and device of program source code
CN117472553B (en) Workflow processing method, device, processing equipment and readable storage medium
CN117667996A (en) Multi-source heterogeneous database access and system based on plug-in adapter

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
TA01 Transfer of patent application right

Effective date of registration: 20230619

Address after: 6001, 6th Floor, No.1 Kaifeng Road, Shangdi Information Industry Base, Haidian District, Beijing, 100085

Applicant after: Beijing Baige Feichi Technology Co.,Ltd.

Address before: 100085 4th floor, Huiyuan development building, 1 Kaifa Road, Haidian District, Beijing

Applicant before: XIAOCHUANCHUHAI EDUCATION TECHNOLOGY (BEIJING) CO.,LTD.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant