CN113741862A - Communication system and method for mobile terminal expansion development - Google Patents

Communication system and method for mobile terminal expansion development Download PDF

Info

Publication number
CN113741862A
CN113741862A CN202010897263.2A CN202010897263A CN113741862A CN 113741862 A CN113741862 A CN 113741862A CN 202010897263 A CN202010897263 A CN 202010897263A CN 113741862 A CN113741862 A CN 113741862A
Authority
CN
China
Prior art keywords
extension
controller
class
bridge
bridging
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
CN202010897263.2A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010897263.2A priority Critical patent/CN113741862A/en
Publication of CN113741862A publication Critical patent/CN113741862A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented

Landscapes

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

Abstract

The invention discloses a communication system and a method for mobile terminal expansion development, and relates to the technical field of computers. One embodiment of the communication system developed by the mobile terminal extension includes: the extension interface is used for establishing communication between an extension class corresponding to the mobile terminal target page and the bridging object; a bridge object, which is a communication channel between a controller and the extension class; and the bridge object is used for calling the corresponding controller, and the bridge object and the controllers are in one-to-one correspondence. The mobile terminal expands the developed communication system, so that the expansion class is communicated with the controller through the bridging object, and the controller is not exposed to the outside; and the bridging objects correspond to the controllers one to one, so that the extension class can accurately communicate with the page controller where the extension class is located, the safety and convenience of communication are improved, and the communication is more efficient.

Description

Communication system and method for mobile terminal expansion development
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a communication system and method for mobile-side extension development.
Background
The mobile terminal modularization is a topic which is popular at present, and the modularization is realized by splitting each original software module which is coupled together and upgrading and transforming the modularization so as to achieve the purposes that each module can break through the limitation of the original environment and flexibly apply and serve different scenes. In order to cope with the ever-changing personalized scenes, the components need to have the expansion capability, so that the problem of solving the expansion developed by an access party and the communication problem of the components is very important.
As shown in fig. 1, the mobile client development generally adopts an MVC architecture (Model ViewController), which mainly includes three parts, M: data model (model), V: view (view), C: a controller (controller). The development of the mobile terminal is mainly the MVC architecture, namely, a controller coordinates and controls data transmission and view states. The current expanded technical solution is that the access party can directly communicate with the controller, the access party invokes various methods provided by the controller, and the controller loads views and modules developed by the access party. The problems that exist mainly include: (1) the controller is a scheduling center of the whole page, if an access party is allowed to directly communicate with the controller, the controller can be exposed, and the access party cannot distinguish whether a method for exposing the controller is in the module or is an interface opened for a calling party; (2) the development languages of the mobile terminal technology are dynamic languages, and if an access party directly accesses the controller, the safety and stability of the components are influenced; (3) direct exposure of the controller violates the principle of exposing the interior as little as possible.
Disclosure of Invention
In view of this, embodiments of the present invention provide a communication system for mobile-end extension development, so that an extension class communicates with a controller through a bridge object, and further does not expose the controller to the outside, thereby improving security of operation and information.
To achieve the above object, according to an aspect of the embodiments of the present invention, a communication system developed by extending a mobile terminal is provided.
The communication system of the mobile terminal extension development of the embodiment of the invention comprises: the extension interface is used for establishing communication between an extension class corresponding to the mobile terminal target page and the bridging object; a bridge object, which is a communication channel between a controller and the extension class; and the bridge object is used for calling the corresponding controller, and the bridge object and the controllers are in one-to-one correspondence.
Optionally, the extension class includes an identification attribute, and a value of the identification attribute is the bridge object.
Optionally, the controller is further configured to assign the bridge object to an identification attribute of the extension class in a case where the instance of the extension class is created.
Optionally, the bridging object includes a forwarding extension for forwarding method calls to the bridging object to the controller.
Optionally, the right to forward the extension is hidden, and the right to bridge the object is exposed.
Optionally, the controller is further configured to create a bridge object corresponding to the controller, and/or bind the bridge object corresponding to the controller with the instance of the extension class.
To achieve the above object, according to another aspect of the embodiments of the present invention, a communication method for mobile terminal extension development is provided.
The communication method for mobile terminal expansion development of the embodiment of the invention comprises the following steps: establishing communication between an extension class corresponding to a mobile terminal target page and a bridging object; and calling the corresponding controller based on the bridging object, wherein the bridging object and the controller are in one-to-one correspondence.
Optionally, the step of establishing communication between the extension class corresponding to the mobile end target page and the bridge object includes: in the case of creating an instance of an extension class, a bridge object is assigned to an identification attribute of the extension class to establish communication between the extension class and the bridge object.
Optionally, the step of invoking the corresponding controller based on the bridge object includes: determining a forwarding extension for the bridging object; forwarding, based on the forwarding extension, a method call to a bridging object to the controller.
Optionally, the right to forward the extension is hidden, and the right to bridge the object is exposed.
Optionally, before assigning the bridge object to the identification attribute of the extension class, the method further includes: creating a bridging object corresponding to the controller; and/or binding a bridging object corresponding to the controller with the instance of the extension class.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided an electronic apparatus.
The electronic device of the embodiment of the invention comprises: one or more processors; and a storage device, configured to store one or more programs, and when the one or more programs are executed by the one or more processors, enable the one or more processors to implement the communication method developed by the mobile terminal extension of any one of the above.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable medium having a computer program stored thereon, wherein the computer program is configured to implement a communication method developed by a mobile terminal extension of any one of the above when executed by a processor.
One embodiment of the above invention has the following advantages or benefits:
(1) the extension class is communicated with the controller through the bridging object, so that the controller is not exposed to the outside, and the safety of operation and information is improved;
(2) a controller corresponds to a bridging object and is used as a pipeline for communicating with the outside, all things are scheduled by the controller, the controller is the same as the concept of a page, aiming at one-to-many and many-to-one design scenes, for example, when an app runs, pages with a plurality of commodity details can be opened, when an extension class and the page communicate, the current page can be accurately obtained and called, and in view of the one-to-one correspondence between the bridging object and the controller, the extension class can accurately communicate with the page controller where the extension class is located; the problem that communication between a page and an instance of an extension class is easily disordered in one app is solved;
(3) and adding attribute extension for the extension class, and assigning the bridge object to the attribute of the extension class. Moreover, because the added attribute of the bridging object is ubiquitous through the extension of the base class, the bridging object can be obtained in the extension class without introducing any additional file, and the high-efficiency obtaining of the bridging object is realized;
(4) the extension class directly communicates with the bridging object, the bridging object forwards the method to the controller, the controller is still hidden and invisible to the outside, and the cost is almost zero due to the fact that the method is only forwarded, so that the method exposed to the outside can be freely controlled through the bridging object, and the method is very flexible;
(5) the creation of the bridging object, the forwarding of the message, the loading of the extension class, the binding of the extension class and the bridging object are all completed in the SDK and are invisible to the outside. The external world can only contact the bridge object, and the acquisition of the bridge object and the calling of the method are realized in the SDK. The external access party only needs to do the fact that own extension is developed, when the external access party needs to communicate with the page controller, the attribute of the own bridging object is obtained, and the method of the attribute is called. Furthermore, the communication mode is safe, convenient and efficient.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of an MVC architecture;
fig. 2 is a schematic diagram of a main part of a communication system developed by a mobile terminal extension according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a communication system developed by a mobile terminal extension according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a main flow of a communication method developed by a mobile terminal extension according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a communication method developed by a mobile terminal extension according to an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Some technical terms contained in the embodiments of the present invention are explained as follows:
class (c): objects with the same kind of properties, called classes, are collections of properties and methods that encapsulate data and operations on that data together. For example: car, human, dog, god;
object: an object is an instance of a class, a variable having a class type. For example: a bulldozer is an instantiation of a car; zhang three is an instantiation of a person; a small white (dog name) is an instantiation of a dog; classes and objects are the most basic concepts in object-oriented programming techniques;
the attributes are as follows: it is the attributes that are used to describe the characteristics of a particular object that are static. Such as: three-piece body is 1.6 m higher; small white hair is brown; the head of the Erlang Shen has eyes; and, the attribute value can be any data type, also can be an object;
the method comprises the following steps: each object has its own behavior or methods of using them, such as a dog running a meeting, etc., which are called methods, are dynamic and can be used to manipulate an object;
SDK software development kit: some files that simply provide an application program interface for a certain programming language, but may also include complex hardware that can communicate with a certain embedded system. Typical tools include utility tools for debugging and other purposes. SDKs also often include example code, supporting technical notes, or other supporting documentation to clarify suspicions for basic reference material;
MVC: a Model View Controller is an abbreviation of a Model View Controller, a software design paradigm, organizes codes by a method of separating business logic, data and interface display, and gathers the business logic into one component, so that the business logic does not need to be rewritten while improving and personalizing a customized interface and user interaction.
Fig. 2 is a schematic diagram of a communication system developed by a mobile terminal extension according to an embodiment of the present invention, and as shown in fig. 2, a communication system 200 developed by a mobile terminal extension according to an embodiment of the present invention mainly includes a bridge object 201, a controller 202, and an extension interface 204.
The bridge object 201 is a communication channel between the controller 202 and the extension class 203. The extension class 203 communicates with the bridge object 201, and the bridge object 201 calls the controller 202, so that the bridge object serves as a communication channel between the controller 202 and the extension class 203.
The controller 202 and the bridge object 201 are used for calling the corresponding controller 202. And, there is a one-to-one correspondence between bridging objects 201 and controllers 202.
And the extension interface 204 is used for establishing communication between the extension class 203 corresponding to the mobile terminal target page and the bridge object 201.
Traditional mobile terminal research and development, mainly the MVC architecture, is coordinated by a controller to control data transmission and view state. The technical scheme of the prior art extension is that an access party can directly communicate with a controller, the access party calls various methods provided by the controller, and the controller loads a view and a module developed by the access party. If the access party calls the controller directly, many properties of the controller can be tampered, shortcuts are abused, and therefore component safety and stability are affected, and the problem of app crash is solved. Based on the embodiment of the invention, the extension class is communicated with the controller through the bridging object, so that the controller is not exposed to the outside. And the bridging objects correspond to the controllers one to one, so that the extension class can accurately communicate with the mechanical energy of the page controller where the extension class is located. When the mobile terminal SDK provides external services and provides personalized development capability of an access party, it is very important to construct a safe and simple communication model. The communication system of the embodiment of the invention solves the problems in the prior art, and ensures that the communication becomes safe, convenient and efficient.
In the embodiment of the invention, the extension class comprises an identification attribute, and the value of the identification attribute is a bridging object. And the controller is also used for assigning the bridging object to the identification attribute of the extension class in the case of creating the instance of the extension class. In the object-oriented language development, there is an inherited concept, that is, the capability of a base class can be inherited by a sub-class, taking iOS development as an example, under the iOS development language environment, all classes are rooted in the base class inherited from the NSObject, and an attribute bridge object (i.e., a mark attribute) is added to the base class of the NSObject, and the mark attribute is a type of the created bridge object class. The technology for adding attributes to the base class is a technology of class extension, and is a characteristic supported by the language, and the technology is not described in detail in the embodiment of the invention. In summary, after adding a property bridge to the base class of a NSObject, any class can call the bridge object property anywhere. And because the attribute of the bridging object is ubiquitous through the extension of the base class, the extension class can acquire the bridging object in the class without introducing any additional file. After the identification attribute is added to the extension class and the bridge object is created, the controller assigns the bridge object to the identification attribute of the extension class, so that the problem of assignment of the bridge object is solved, and the bridge object can be normally acquired when the external extension class calls the self attribute.
In an embodiment of the invention, the bridging object includes a forwarding extension for forwarding method calls to the bridging object to the controller. Optionally, the right to forward the extension is hidden, and the right to bridge the object is exposed. The permission is hidden, that is, the permission cannot be obtained by the outside, and the permission is exposed, that is, the permission can be obtained by the outside.
Since the controller and the bridge object are in a one-to-one relationship and can directly communicate with each other themselves, in the embodiment of the present invention, the bridge object can directly call the method of the controller. Since the method of the bridge object directly calling the controller also refers to the controller, it is exposed. Therefore, in another embodiment of the present invention, the method for adding the extension to the NSObject base class is similar, and does not directly make the bridge object refer to the controller, but adds the extension (i.e. forwarding extension) to the bridge object, and adds the reference to the page controller in the extension, but this extension needs to be hidden in the SDK and cannot be exposed to the outside, which has the advantage that the external caller cannot see the bridge object referring to the controller at all, as mentioned above, the technology of the extension is the characteristic supported by the language itself, and the embodiment of the present invention does not describe this technology in detail. The external world directly communicates with the bridging object, and the method call to the bridging object is forwarded to the controller, and the controller is still hidden and invisible to the external world. In addition, the method of freely controlling the exposure to the outside by bridging the objects is very flexible because only forwarding is carried out and almost no cost is needed.
In an embodiment of the present invention, the controller is further configured to create its corresponding bridge object. And binding the bridging object corresponding to the controller with the instance of the extension class. For one-to-many, many-to-one relationship design, just as one app may open multiple business details pages, the extension class needs to communicate exactly with the page instance where it is located. Aiming at the embodiment of the invention, the controller creates the bridging object which has a one-to-one relationship with the controller, simultaneously creates the instances of the extension class, and binds the bridging object and the instances of the extension class one by one, so that the extension class is always the page where the extension class is located when the extension class communicates with the page controller through the bridging object. Thus, in an app, no matter how many instances of pages and extension classes there are, no confusion occurs in communication.
Based on the embodiment of the invention, the creation of the bridging object of the page, the forwarding of the message, the loading of the extension class, and the binding of the extension class and the bridging object are all completed in the SDK and are invisible to the outside. The external world can only contact the bridge object, and the acquisition of the bridge object and the calling of the method are realized in the SDK. The external access party only needs to do the fact that own extension is developed, when the external access party needs to communicate with the page controller, the attribute of the own bridging object is obtained, and the method of the attribute is called. Therefore, the communication mode of the embodiment of the invention is safe, convenient and efficient.
The mobile terminal modularization is a topic which is popular at present, and the modularization is realized by splitting each original software module which is coupled together and upgrading and transforming the modularization as the name suggests so as to achieve the purposes that each module can break through the limitation of the original environment and flexible application services different scenes. Many large enterprises are in the practice of componentization, and there are many cases, such as a takeout component for the takeout of the beauty group serving a beauty group app and a beauty group takeout app; the Jingdong e-commerce transaction flow, serving the Jingdong app, the Jingxi app, the Jingdong health app, etc. (just examples). The service apps mentioned in the example of the embodiment of the present invention are only for fully explaining the embodiment of the present invention, and have no directional meaning, and do not relate to disclosure of information of each app. On one hand, the modularization avoids repeated development, the enterprise cost is greatly reduced, meanwhile, the software delivery cycle is shortened due to the reuse of the components, the quick response capability of a company to the market is improved, and finally, the components are reused, and unified and consistent user experience can be provided on each platform.
However, the componentization technology has many challenges, and since it is a business service, a vast variety of business and market needs, it is impossible to need a component with completely consistent functions, for example, a company develops a set of transaction flow components, in which the commodity detail module is reused in each app, when a popular grouping e-commerce app is used, it may be desirable to add a grouping flow to the commodity detail module, and when an app of the medical health class is used, it is desirable to add a related flow of a medicine class. Thus, the following challenges are encountered with componentization: the reusability of the components is maintained, and the method can also cope with diversified personalized scenes. Componentization is also an idealized goal, difficult to quantify, without an ultimately perfect morphology, a classic problem often encountered in software development and design, and even in computer science, seeking solutions in trade-offs and tradeoffs.
In order to cope with diversified personalized scenes, the component needs to have expansion capability, and for mobile-end apps, the access-side apps can develop and customize own processes to serve as the expansion of the component; as in the above example, the cluster app and the healthcare app are based on the same component, and develop their service extensions according to a unified interface opened by the component, and the component loads the extensions implemented by the access party, so as to achieve the purpose of displaying different services. There is another problem of how the extensions developed by the access parties communicate with the components.
Mobile client development, whether iOS or android, generally employs the MVC architecture. Both data and views are scheduled by the controller, which is responsible for specific presentation, interactive scheduling, e.g., obtaining data, passing data associated with a view onto the view for presentation. In the MVC architecture of the mobile client, the controller C represents a specific page, for example, a shopping cart page has a shopping cart controller, and a product detail page has a product detail controller. The data model M represents data, and the view V is responsible for presentation, content, documentations or pictures, etc. Aiming at the mobile terminal component, if an access party needs to add a view into a page or call a page method, because the page is uniformly scheduled by a controller, the access party needs to communicate with the controller and receive the uniform scheduling of the controller.
Fig. 3 is a schematic diagram of a communication system developed by a mobile terminal extension according to an embodiment of the present invention; as shown in fig. 3, the bridge object is used as a transfer station, a bridge, and a pipe to connect 2 components for communication. The component is taken to the access side for use, and the access side develops its own things, which are developed into extension examples. And if the commodity page can be opened when the e-commerce app is used, a recommendation position is generally arranged below the commodity, and the recommended commodity can be clicked to enter a new commodity page, so that the process is repeated, and at this time, the app contains a plurality of commodity pages, and each page is an example. And each time a page instance is created, a bridging object and an expanded instance are created in response, wherein 1 to 1 communication does not interfere with each other, the expansion of the commodity A is prevented from running to a commodity B page, the commodity A is prevented from clicking to join a shopping cart, and the commodity B is prevented from being added into the shopping cart.
The communication system based on the embodiment of the invention can hide the key controller and the complex logic inside the SDK and expose a simple interface to the outside when the mobile terminal SDK is in communication with the external extension. Aiming at the concept of the SDK, for example, a component is a commodity detail module, which is provided for others to develop extension for the second time, and the others want to add a button to the page, and click the button to add a shopping cart. The method for adding the shopping cart is provided by the commodity detail module and is exposed to the outside, and the concept of the SDK is realized.
And the embodiment of the invention also constructs a communication pipeline with the external extension class, so that the external extension class can communicate with the SDK controller through the pipeline in a very low-cost mode. The communication pipeline of the embodiment of the invention can freely control the external exposure capability and method of the SDK, and is also a low-cost mode. Based on the application prospect of modularization in the industry, the cost of an enterprise is greatly reduced, and the support of the embodiment of the invention on expansion also improves the customization capability of the module to different scenes during multiplexing, and has good practical value.
In the embodiment of the present invention, the first step is to create a bridge object for replacing the controller to communicate with the outside. Therefore, methods to be exposed to the outside need to be integrated into a protocol, the protocol has different names, some called interfaces, some called protocols and the like in different programming languages and environments, and the protocol represents a specification, is a virtual method declaration and is not a specific method implementation; once a class declares itself to comply with a certain protocol, it needs a specific method of implementing the protocol.
The bridging object is created and is made to comply with the protocol, and the externally exposed interface is no longer a controller but a bridging object, thus the access party is made to make method calls through the bridging object.
The second step is the process of realizing the extension class of the access party and acquiring the bridging object, namely establishing the communication between the extension class corresponding to the target page of the mobile terminal and the bridging object through the extension interface. In the object-oriented language development, there is an inherited concept, that is, the capability of the base class can be inherited by the subclass, taking the iOS development as an example, under the iOS development language environment, all classes are mostly the base class inherited from the NSObject, an attribute bridge object is added to the base class of the NSObject, and the attribute is the type of the bridge object class created in the first step. Specifically, all object-oriented objects are classes and objects, a class is an abstract concept, a whole, for example, a car is an abstract concept, namely a whole, namely a class, each car that is seen is a real car object, and an object is an entity. Attributes are also the basic concept of object-oriented language development, such as the class of cars, of which a door is understood and of which a tire is also an attribute. And, the tire can also be a class (is an abstract concept), the corresponding concrete actual view tire is an object (is an entity) and the class provides the attribute to the outside and also provides the method, such as the door opening method and the starting method.
For example, when the air conditioner is just invented, the air conditioner is used for radiating heat of a certain machine in a large factory building, the air conditioner does not have a switch control panel, but all circuit control logics are coupled with a circuit switch of the large machine, and the air conditioner can be understood as a radiating component of the large machine. The air conditioner can be taken out of the large machine and provided for other types of machines for use later, but the circuit, the switch and the control structure of the air conditioner are too complex, and in order to be simply connected to other machines, the complex circuit and the control logic can be hidden inside the machine and only exposed to the outside by a plurality of simple methods, such as opening, closing and temperature setting. Therefore, it is possible to integrate the simple methods provided to the outside into a single switch control panel, which can be understood as a bridging object, and the switch control panel can be understood as an attribute of the air conditioner. When each air conditioner for providing heat dissipation for other machines is used, a switch control panel is correspondingly produced and installed on the air conditioner (attribute assignment is performed), and the other machines take the switch control panel to perform interaction according to a protocol. For example, the first button is the on method, the second button is the off method, and the protocol can be understood as like the product usage instructions.
The specific technique adopted for adding attributes to the base class is a technique called class extension, which is a characteristic supported by the language itself. After adding an attribute bridge object ct to the base class of the NSObject, any class can call the bridge object attribute anywhere, so the problem of acquiring the bridge object is solved by adding the attribute to the base class. In addition, the extension class can acquire the bridge object in the class without introducing any additional file, because the property of the bridge object is ubiquitous through the extension of the base class. But the attribute needs to be assigned to be used, otherwise, the obtained object is a null object and has no meaning; this step only solves the way of obtaining the bridging object, and the following solves the problems of creating and assigning the bridging object.
Through the steps, a basic simple communication mode is already established, the extension class can acquire the bridging object in a self attribute calling mode through basic extension, and then specific method calling is carried out through the bridging object and the complied related protocol so as to realize the communication with the page.
The third step uses message forwarding to solve the problem of how the bridging object embodies the method of the followed protocol. In the embodiment of the invention, a page can create a bridge object as a pipeline for communicating with the outside, and all things are scheduled by a controller, the controller is equivalent to the concept of the page, and the bridge object is exposed to the outside. The bridging object does not need to rewrite the method logic implemented in the controller once, but can call the method implementation of the page controller when implementing the specific method of the protocol. The calling method is simple, the page and the bridging object are in one-to-one relation and can directly communicate with each other, and the bridging object can directly call the method of the controller. But then the bridge object will also reference the controller, which can cause the controller to be exposed. Therefore, in the embodiment of the present invention, similar to the method of adding the extension to the NSObject base class, the bridge object does not directly refer to the controller, but adds the extension to the bridge object, and adds the reference to the page controller in the extension, and the extension is hidden in the SDK and cannot be exposed to the outside. Therefore, the external caller can not see that the controller is quoted by the bridging object, the external caller directly communicates with the bridging object, the bridging object realizes the method and forwards the method to the controller, and the controller is still hidden and invisible to the external caller. And, because only forwarding is carried out, almost no cost exists, so that the method of freely controlling the external exposure through the bridging object is very flexible, and the process is called message forwarding.
And fourthly, solving the problem that in the second step, although the extension of the bridging object is added to the base class, the attribute needs to be assigned in advance to be used. When a page loads an external extension class, an instance of the external extension class, also called an object, is created, which is a concept underlying object-oriented language development. After the page loads and creates an instance of the external extension class, the property of the external extension class is assigned to the bridge object in a one-to-one relationship with itself. The basis of the assignment is the contents of the second step and the third step, specifically, attribute extension is added to the extension class firstly; secondly, a bridging object is created; the page then assigns the bridge object to the attribute of the extension class. Therefore, the problem of assignment of the bridging object is solved, and the external extension class can normally acquire the bridging object when calling the attribute of the external extension class. This also solves the one-to-many, many-to-one relationship design mentioned above, as in the above example, an app may open multiple merchant pages, and the extension class needs to communicate with the page instance where it is located. The technical scheme of the invention ensures that the page is responsible for creating the bridging object which is in one-to-one relation with the page, simultaneously creating the instances of the extension class, and binding the bridging object and the instances of the extension class one by one, so that the extension class is always the page where the page is located when communicating with the page controller through the bridging object. Thus, in an app, no matter how many instances of pages and extension classes there are, no confusion occurs in communication.
According to the embodiment of the invention, the creation of the bridging object of the page, the forwarding of the message, the loading of the extension class, and the binding of the extension class and the bridging object are all completed in the SDK and are invisible to the outside. The external world can only contact the bridge object, and the acquisition of the bridge object and the calling of the method are realized in the SDK. The external access party only needs to do the fact that own extension is developed, when the external access party needs to communicate with the page controller, the attribute of the own bridging object is obtained, and the method of the attribute is called. This provides a complete solution to the several problems mentioned above, and such a communication mode is safe, convenient and efficient.
Fig. 4 is a schematic diagram of a communication method for mobile-side extended development according to an embodiment of the present invention, and as shown in fig. 4, the communication method for mobile-side extended development according to the embodiment of the present invention mainly includes:
step S401: and establishing communication between the extension class corresponding to the mobile terminal target page and the bridging object.
Step S402: and calling the corresponding controller based on the bridging object, wherein the bridging object and the controller are in one-to-one correspondence.
Fig. 5 is a schematic diagram of a communication method developed by a mobile terminal extension according to an embodiment of the present invention; as shown in fig. 5, in the embodiment of the present invention, in the process of establishing communication between the extension class corresponding to the mobile end target page and the bridge object, in the case of creating an instance of the extension class, the bridge object is assigned to the identifier attribute of the extension class, so as to establish communication between the extension class corresponding to the mobile end target page and the bridge object. And determining the forwarding extension of the bridging object in the process of calling the corresponding controller based on the bridging object. Based on the forwarding extension, a method call to the bridging object is forwarded to the controller. Optionally, the right to forward the extension is hidden, and the right to bridge the object is exposed. And before the bridge object is assigned to the identification attribute of the extension class, creating the bridge object corresponding to the controller. And/or binding the bridging object corresponding to the controller with the instance of the extension class.
According to the embodiment of the invention, the following advantages or beneficial effects are achieved:
(1) the extension class is communicated with the controller through the bridging object, so that the controller is not exposed to the outside, and the safety of operation and information is improved;
(2) a controller corresponds to a bridging object and is used as a pipeline for communicating with the outside, all things are scheduled by the controller, the controller is the same as the concept of a page, aiming at one-to-many and many-to-one design scenes, for example, when an app runs, pages with a plurality of commodity details can be opened, when an extension class and the page communicate, the current page can be accurately obtained and called, and in view of the one-to-one correspondence between the bridging object and the controller, the extension class can accurately communicate with the page controller where the extension class is located; the problem that communication between a page and an instance of an extension class is easily disordered in one app is solved;
(3) and adding attribute extension for the extension class, and assigning the bridge object to the attribute of the extension class. Moreover, because the added attribute of the bridging object is ubiquitous through the extension of the base class, the bridging object can be obtained in the extension class without introducing any additional file, and the high-efficiency obtaining of the bridging object is realized;
(4) the extension class directly communicates with the bridging object, the bridging object forwards the method to the controller, the controller is still hidden and invisible to the outside, and the cost is almost zero due to the fact that the method is only forwarded, so that the method exposed to the outside can be freely controlled through the bridging object, and the method is very flexible;
(5) the creation of the bridging object, the forwarding of the message, the loading of the extension class, the binding of the extension class and the bridging object are all completed in the SDK and are invisible to the outside. The external world can only contact the bridge object, and the acquisition of the bridge object and the calling of the method are realized in the SDK. The external access party only needs to do the fact that own extension is developed, when the external access party needs to communicate with the page controller, the attribute of the own bridging object is obtained, and the method of the attribute is called. Furthermore, the communication mode is safe, convenient and efficient.
Fig. 6 shows an exemplary system architecture 600 to which the communication method developed by the mobile terminal extension or the communication system developed by the mobile terminal extension of the embodiment of the present invention can be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The background management server can analyze and process the received data such as the product information inquiry request and feed back the processing result to the terminal equipment.
It should be noted that the communication method developed by the mobile terminal extension according to the embodiment of the present invention is generally executed by the server 605, and accordingly, the communication system developed by the mobile terminal extension is generally provided in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes an acquisition controller and a bridging object. Where the names of these modules do not in some cases constitute a limitation on the modules themselves, for example, a controller may also be described as "for invoking its corresponding controller".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: establishing communication between an extension class corresponding to a mobile terminal target page and a bridging object; and calling the corresponding controller based on the bridging object, wherein the bridging object and the controller are in one-to-one correspondence.
According to the embodiment of the invention, the extension class is communicated with the controller through the bridging object, so that the controller is not exposed to the outside, and the safety of operation and information is improved. And the bridging objects correspond to the controllers one to one, so that the extension class can accurately communicate with the page controller where the extension class is located.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (13)

1. A communication system developed by a mobile terminal extension, comprising:
the extension interface is used for establishing communication between an extension class corresponding to the mobile terminal target page and the bridging object;
a bridge object, which is a communication channel between a controller and the extension class;
and the bridge object is used for calling the corresponding controller, and the bridge object and the controllers are in one-to-one correspondence.
2. The communication system according to claim 1, wherein the extension class comprises an identification attribute, and wherein a value of the identification attribute is the bridge object.
3. The communication system according to claim 2, wherein the controller is further configured to assign the bridge object to an identification attribute of the extension class in the event that the instance of the extension class is created.
4. The communication system of claim 1, wherein the bridging object includes a forwarding extension for forwarding method calls to the bridging object to the controller.
5. The communication system according to claim 4, wherein the right to forward the extension is hidden and the right to bridge the object is exposed.
6. The communication system according to any of claims 1-5, wherein the controller is further configured to create its corresponding bridge object and/or bind the bridge object corresponding to the controller with the instance of the extension class.
7. A communication method for mobile terminal expansion development is characterized by comprising the following steps:
establishing communication between an extension class corresponding to a mobile terminal target page and a bridging object;
and calling the corresponding controller based on the bridging object, wherein the bridging object and the controller are in one-to-one correspondence.
8. The communication method according to claim 7, wherein the step of establishing communication between the extension class corresponding to the mobile destination page and the bridge object comprises: in the case of creating an instance of an extension class, a bridge object is assigned to an identification attribute of the extension class to establish communication between the extension class and the bridge object.
9. The communication method according to claim 7, wherein the step of invoking its corresponding controller based on the bridge object comprises:
determining a forwarding extension for the bridging object;
forwarding, based on the forwarding extension, a method call to a bridging object to the controller.
10. The communication method according to claim 9, wherein the right to forward the extension is hidden and the right to bridge the object is exposed.
11. The communication method according to any of claims 7 to 10, further comprising, before assigning the bridge object to the identification attribute of the extension class:
creating a bridging object corresponding to the controller; and/or binding a bridging object corresponding to the controller with the instance of the extension class.
12. An electronic device, comprising:
one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out a communication method according to any one of claims 7 to 11.
13. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the communication method according to any one of claims 7 to 11.
CN202010897263.2A 2020-08-31 2020-08-31 Communication system and method for mobile terminal expansion development Pending CN113741862A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010897263.2A CN113741862A (en) 2020-08-31 2020-08-31 Communication system and method for mobile terminal expansion development

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010897263.2A CN113741862A (en) 2020-08-31 2020-08-31 Communication system and method for mobile terminal expansion development

Publications (1)

Publication Number Publication Date
CN113741862A true CN113741862A (en) 2021-12-03

Family

ID=78727993

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010897263.2A Pending CN113741862A (en) 2020-08-31 2020-08-31 Communication system and method for mobile terminal expansion development

Country Status (1)

Country Link
CN (1) CN113741862A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114464269A (en) * 2022-04-07 2022-05-10 国家超级计算天津中心 Virtual medicine generation method and device and computer equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120044863A1 (en) * 2010-08-20 2012-02-23 Napuda Technology Co., Ltd. Plug-and-play wireless network extension system and method of automatic connection for the same
CN105163322A (en) * 2015-08-05 2015-12-16 福建星网锐捷网络有限公司 Method and system for automatic expansion of wireless network
CN107315541A (en) * 2017-06-16 2017-11-03 郑州云海信息技术有限公司 A kind of method of dual controller storage extension cabinet cascade

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120044863A1 (en) * 2010-08-20 2012-02-23 Napuda Technology Co., Ltd. Plug-and-play wireless network extension system and method of automatic connection for the same
CN105163322A (en) * 2015-08-05 2015-12-16 福建星网锐捷网络有限公司 Method and system for automatic expansion of wireless network
CN107315541A (en) * 2017-06-16 2017-11-03 郑州云海信息技术有限公司 A kind of method of dual controller storage extension cabinet cascade

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
_PPB: ""从SpringMVC来看适配器模式"", 《CSDN》, 23 December 2016 (2016-12-23), pages 1 - 2 *
罗光春;卢显良;韩宏;卢军;: "应用MVC设计模式构建Web应用系统框架及其扩展", 计算机科学, no. 04, 31 December 2003 (2003-12-31), pages 129 - 130 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114464269A (en) * 2022-04-07 2022-05-10 国家超级计算天津中心 Virtual medicine generation method and device and computer equipment

Similar Documents

Publication Publication Date Title
KR101921144B1 (en) Messaging application interacting with one or more extension applications
EP3651482B1 (en) Message extension app store
US7756905B2 (en) System and method for building mixed mode execution environment for component applications
CN111580820B (en) Applet generation method and device
US11132114B2 (en) Method and apparatus for generating customized visualization component
CN108605049A (en) The message sharing method based on application state and card for user equipment
KR101622871B1 (en) Method, system and recording medium for managing conversation contents in messenger
CN114356341B (en) Data processing method, device, equipment, storage medium and product
CN109800083A (en) A kind of method, apparatus, system and storage medium that micro services collaboration is called
WO2019029451A1 (en) Method for publishing mobile applications and electronic apparatus
CN113965829A (en) Internet of things equipment control method, device, equipment and medium based on 5G message
CN113076163A (en) Card rendering method and device
JP2021068415A (en) Code execution method, device, rendering device, storage medium, and program
CN110070394A (en) Data processing method, system, medium and calculating equipment
CN113254825A (en) Page generation method and device, electronic equipment and storage medium
CN111970192B (en) Information editing method and device based on session group
CN113741862A (en) Communication system and method for mobile terminal expansion development
CN109710280A (en) It is a kind of for installing the method and apparatus of application on a user device
CN108763881A (en) Method and apparatus for controlling user right
WO2023083071A1 (en) View interaction method and apparatus, electronic device, and computer readable medium
CN110275701A (en) Data processing method, device, medium and calculating equipment
CN109298956A (en) Document transmission method, device and terminal device
TWI641984B (en) Method for interaction between terminal device and web site, method for providng web service for terminal device, and computer program product for interaction between terminal device and web site
CN108804088A (en) protocol processing method and device
CN116149639A (en) Method and device for developing components, electronic equipment and storage medium

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