Smart objects for development of object oriented software6003037Abstract An improved object-oriented programming environment for facilitating creation of database management applications is disclosed. The programming environment provides a method and apparatus for establishing named connections between encapsulated, individually designed software components referred to as "smart objects," which communicate and act in a coordinated fashion as part of a finished software application. Connections between smart objects are referred to as "smart links." A basic set of smart links for coordinating a core group of smart objects is disclosed, and a substantial variety of database management applications can be created using the disclosed smart objects and smart containers. The core group of smart objects each include four common capabilities: the capability to initialize and destroy themselves, the capability to get and set attributes, the capability to add and remove smart links, and the capability to communicate using a standard communication interface. Individual smart objects have other capabilities in addition to the four common capabilities. Claims What is claimed: Description FIELD OF THE INVENTION
______________________________________
RUN add-link (THIS-PROCEDURE, `STATE`, other-procedure-
handle)
/* This will be sent across the STATE link to other-
procedure: */ RUN new-state (`buttons-initialized, STATE-
TARGET`)
______________________________________
As with event names, an extensible mapping of common state messages to the default links across which they should normally be sent allows the link type to be omitted in the writing of application logic, as: RUN new-state (`no-record-available`). Each of the smart objects in the core group includes as part of its definition a list 54 of the set of named link types which can connect it to other smart objects. New object types created by application designers have their own list of supported link types. New link types can also be defined as part of the design of new object types and the extension of smart object functionality. Each named link type carries with it an expectation of supported standard behavior on each end of the link. This allows the link to define the nature of the relationship between the objects, and to allow them to operate in a coordinated fashion. This behavior, in the form of event procedures, defines the relationship between the objects by representing specific procedural behavior invoked over the link. In addition, state messages can be sent between objects to inform objects of changes in the execution state of a particular object without assuming any particular behavior to be executed as a result of that state change. These named states can also be sent to objects over particular named links, or across a STATE link designed expressly for that purpose. All links are stored in a single data table in a support procedure called an "ADM Broker" which executes on behalf of an application client process. Each link record holds a handle to the SOURCE object, a handle of the TARGET object, the name of the link, and a flag indicating whether the link is currently active or inactive. Each link type has an attribute which indicates whether that link should remain active when the objects on either end of the link are not visible to the application user. If this attribute is set to TRUE, then the link will be deactivated whenever at least one of the objects on the end of the link is hidden, and activated when both objects are viewed. This default behavior can also be customized for a particular application. When a link is inactive, no events or state messages are able to traverse the link. This allows an application to set up multiple links of the same type from a single SOURCE object to multiple TARGET objects with only one of those links being active at any given time during application execution. All processing of links, in addition to notify and new-state methods which use the links, are coordinated by the Broker procedure using a unified link table. The "notify" method procedure allows developer-written application code to invoke event procedures in other objects connected by the named links without requiring developer knowledge of which objects, or even which type of objects, will be connected in a particular application situation. The developer simply specifies the type of link across which an event is to be dispatched, as: RUN notify `open-query, RECORD-SOURCE.` This specification dictates that the open-query event procedure is to be invoked in any object connected to the present object as its RECORD-SOURCE. A mapping of common event procedures to the link types across which such procedures are normally sent is built into the application execution mechanism. This mapping can be extended or modified for the purposes of any particular software application, and hence allows the developer to omit the link name when dispatching events in other objects, as: RUN notify `row-available.` This command dictates that the row-available event is to be invoked in any object connected to the present object by any of the links named in the event mapping. Referring now to FIGS. 1 and 2a-2g, the user interface builder 16 creates the application 14 from the smart objects 12 and smart links 10. More particularly, the information required to create the application is derived, at least in part, from associations between the smart objects and the smart links. Messages flow from "source" objects to "target" objects until the last target is reached in the hierarchy of objects in an interface or program. Message flow defines the typical direction of event and method invocation, however, events and methods can be invoked in either direction. The association of a target and a source with a link type, for example: Navigation-Source, describes a correspondence between the smart object and another object, including the ability of the smart object to receive and transmit the message. Hence, Navigation-Source implies a smart object such as Navigation Panel which incorporates procedures for transmitting navigation messages across navigation links. Any smart object may be a target, source or both target and source for any link, provided respective procedures for targeting, sourcing or targeting and sourcing the link are present within the object. For example, an object may have a plurality of sources of different link types simultaneously, provided the sources support the appropriate targeting procedures. However, an object may have only one source of any given link type. Exemplary groupings are shown in FIGS. 2a-2g. A Record link 38 can connect any record source object, e.g., Query, Browser, with any record target objects, e.g., Viewer. A Navigation link 40 can connect any navigation source object, e.g., Navigation, Panel, with any navigation target object, e.g., Viewer, Browser. A TableIO link 42 can connect any tableIO source, e.g., TableIO Panel, with any tableIO target, e.g., Viewer. A State link 44 can connect any smart object, e.g., Viewer with any smart object, e.g., Query. A Group-assign link 46 can connect any tableIO target, e.g., Viewer, with any group assign target, e.g., Viewer. A Container link 48 can connect any container object, e.g., Window or Frame, with any object it has created, with or without visual representation, e.g., Viewer. Finally, a Page link 50 can connect any paging object, e.g., Folder, with any smart Container, e.g., Smart Window. A grouping or other combination of smart objects can be treated as a single smart object entity. Any smart objects placed within a container object can transmit and receive messages through the container object transparently using a pass-through link. In such a case, smart objects can be grouped together visually, within a common container, while maintaining an absolute degree of independence relevant to object messaging. Referring again to FIG. 1, the user interface builder 16 performs several steps to provide the database management application 14 from the smart objects and smart links. The steps include creating 56 instances of objects, checking 58 each object to ensure that the object is valid, and querying 60 each object as to how that object should be linked to other objects. The user interface builder also facilitates determination of how each object's attributes should be initialized, and automatically creates an underlying structure to recreate the object and its operational behavior prior to compiling. FIG. 3 shows the methods employed by the user interface builder to create and query each object. In step 62 the name of the object's master file, <object-file>, is obtained and the object is run. The name is obtained from the developer if a new instance of the object is being created. The name is obtained from the system clipboard if a cutting and pasting operation is being used to create the object. Alternatively, the name is obtained from a disk if the developer is opening a file containing the object. A determination is then made in step 64 as to whether an error occurred during the run step. If an error did occur, a determination is made as to whether the error was attributable to the environment in step 66. Errors which are attributable to the environment may be corrected by the developer in step 68. After correcting such an error, flow returns to the run step 62. If the error is not attributable to the environment a report is made to the developer in step 72. If no error is detected in step 64, an additional determination is made that the object is valid in step 70. A series of checks are performed to assure that the object can be linked into the SmartObject environment. If the object is not correctly configured then a report is made to the developer in step 72. If the object is correctly configured, the interface builder sets an attribute in the object: "UIB-Mode=Design" in step 74. Step 74 allows the object to self-establish behavior and visualization within the interface builder when the object self-initializes. A list of settings and attributes which distinguish the instance from any other instance is then sent to the object in step 76. The list will generally be empty for new instances, but may contain some attribute/value pairs in other cases. A determination is then made as to whether the object has a visualization in step 78. The user interface builder is a visual development environment and, as such, requires that all objects have a visualization (for example, the SmartQuery object is pure logic and has no intrinsic visualization). If the object does not have a visualization, the interface builder creates a visual representation of the object in step 80. The object is then `auto-initialized` in step 82 by finishing its creation and visualizing itself, if appropriate. At this point the object generally responds to the `UIB-Mode=design` attribute set above. Finally, in step 84, the interface builder queries the object for instructions which indicate how the object is to be linked into the final application. This step involves probing the object for the links which the object supports and the database tables and foreign keys that the object needs or can supply. FIG. 4 illustrates object maintenance of a list of attributes and settings. Objects are created in step 86, as described above, and can be drawn, copied, or opened from a file. When an object is created, that object is queried in step 88 to determine whether the object supports a special event named "edit-attribute-list." If the object does not support "edit-attribute-list," flow ends. If the object does support "edit-attribute-list," then the user interface builder enables buttons and menu items that give the developer access to event in step 90. In this way, only objects that can support instance attributes show these capabilities to the developer using the object. The user interface builder then waits 92 for the developer to select a button or menu item. When the developer selects a button or menu item, the user interface builder dispatches the "edit-attribute-list" event to the object in step 94. The object then responds according to the object's internal configuration. Generally speaking, the object will bring up a dialog-box allowing the user to change attribute settings. Objects also have a self-reconfiguration function which based on how the settings are changed. The user interface builder does not directly store new attribute settings. When the user interface builder is ready to store the values to a disk file, it will query the object for this list. FIG. 5 shows the method for writing a file containing the structure of a smart object application. Each object in the interface is first queried 98 for the list of "instance attributes" that the object requires to recreate itself in a running application. This list can be as long or as short as necessary. As described above, the list is provided by the object itself. This list, as well as the name of the object master file, <object-file>, and the geometry of the object are written to the output file in step 100. Steps 98 and 100 are executed for each object in the interface by cycling 96 through each object. When each object has been queried, each link is written to the file in step 104 by cycling through the links in step 102. FIG. 6 shows the method for adding a new link. The developer begins the linking process by choosing 106 the link source or link target. The object is then queried 108 for the object's list of supported links, and the list of "supported-links" is retrieved 110 directly from the object. The retrieved list is merged with a predefined list of link types that are assumed to be supported. The developer can also select from the merged list or enter a new link name in step 112, following which both the link source and link target are queried 114 to make sure that the chosen link type is supported. If the chosen link type is supported, the link is successfully added. If the chosen link type is not supported, e.g., in the event of an unexpected link type, the user is asked 116 to confirm the choice. If the choice is confirmed then the link is added. If the choice is not confirmed, flow returns to step 112. Alternatively, if the developer is unsure of what to do, link related help is available in step 120. FIG. 7 shows the method followed by the user interface to validate a Record-Link. The Record-Source and Record-Target are queried in steps 122 and 124, respectively, for a list of the tables which are supplied and required. In step 126 the lists are compared. If all the tables required by the Record-Target can be supplied by the Record-Source, then a Record link is determined 134 to be `OK.` Otherwise, additional tests are made. In steps 128 and 130 the Record-Source and Record-Target are queried, respectively, for a list of foreign keys that can be supplied or accepted. In step 132 a comparison is made between the lists generated in steps 128 and 130. If there is at least one set of keys that are acceptable by the Record-Target that can also be supplied by the Record-Source, then a Record line is possible. Otherwise, the Record Link is determined 136 to be impossible. Referring again to FIG. 1, the user interface builder includes two advisors which facilitate application development. The first advisor is a "Link Advisor." The Link Advisor is activated when a new instance of a smart object is created, and functions to determine whether the new object includes Supported-Links which should be filled. The second advisor is a "Run Advisor." The Run Advisor is activated when the developer executes a test of the application under development. The method employed by the Link Advisor operation is illustrated in FIG. 8. In step 138 the new object is queried for the list of `supported-links.` The list of supported links is an attribute possessed by all smart objects. Each item in the list is tested. For example, if an object supports two links, `TableIO-Target, Record-Target,` then the algorithm first sets Test-Link to TableIO-Target, and then to Record-Target. In step 140 a variable I is set to 1 and a variable CNT is set to the number of supported links. In step 142, I and CNT are compared, and if I is less than or equal to CNT then Test-Link is set to Entry(I, Supported-Links) in step 146. Each of the other objects in the same application are similarly examined in step 148, and the list of Support-Links for those objects are queried 150. The list of Supported-Links for these other objects are then tested 152 against the Test-Link. The Supported-Links must contain the other end of the Test-Link. That is, if Test-Link is `Record-Target,` then Supported-Links must contain `Record-Source.` In the case of Record links, an additional test to confirm table matching is also performed. Finally, pre-existing links are checked. If the object already has a link of the test type and if the link is not a many-to-one link, then it is skipped over. If an object can match the Test-Link, then it is added 154 to a list of possible links. This list will be presented to the developer when all objects have been checked. Once all the objects have been checked, the list of possible links is tested 156 And presented 158 to the developer, provided at least one possible link has been found in the testing step. The developer can then choose 160 a link from the generated list of possible links. The developer may also elect not to make a link. If the developer chooses a new link from the list, the link is officially added 162. The method employed by the Run Advisor is illustrated in FIG. 9. The Run Advisor is executed when the developer tests a smart object containing application from within the user interface builder, i.e., whenever the user presses `Run` 164 from the user interface builder. Starting with step 166, the list of Supported-Links is then examined for any mandatory links which are not filled, and if any are found then the developer can cancel the test. That is, each object is queried 168 for the list of Supported-Links that the object should support. If any mandatory links are found 170 in this list, then the object is checked 172 to verify that the link actually exists. In particular, some other object must be linked to the object with this link type. If the link does not exist, a warning is reported 174 to the developer, and the developer is given the opportunity 176 to RUN 178 in spite of the determination. In one embodiment of the present invention the list of mandatory links is hard-coded into the development environment as: Navigation-Source, Record-Target, TableIO-Source, and Page-Source. In an alternative embodiment the list is included as an attribute of each object. That is, objects are queried for their list of `Mandatory-Links.` The development environment thus allows efficient connecting of objects by providing the ability to create design-time instances of predefined and custom objects, the ability to query objects to determine their supported links, and a dialog to help developers assign these links. Further this dialog allows the user to select links from a list, or create new ones. It should be understood that various changes and modifications may be made from the embodiment herein disclosed. Accordingly, the invention is not to be viewed as limited except by the scope and spirit of the appended claims.
|
Same subclass Same class Consider this |
||||||||||
