Computer systems are currently in wide use. Some such systems are customized (some significantly) before they are deployed at an end user's site. By way of example, some such computer systems include business systems, such as customer relations management (CRM) systems, enterprise resource planning (ERP) systems, line-of-business (LOB) systems, etc. In these types of systems, a general business system is first purchased by a user or customer, and the user or customer often makes customizations, extensions or other modifications to that general business system, in order to obtain their own customized deployment.
Typically, such customizations have been provided either through direct modification of the source code or by having the original software author insert a number of hook-points in the software source code.
Direct modification to source code provides the most flexibility for customization. With such modifications, any change can be made to the software. The limitation of this approach becomes apparent when the original software needs to be modified, such as when an update or patch is required. In such instances, the modifications to the original source code may no longer interoperate with various customization. Thus, the developer must return to the modifications and carefully port or modify each of the previously-generated customizations to the updated/patched source code. In most cases, this manual and tedious process tends to require significant developer time and thus be very expensive.
Providing a number of hook-points in the original source code is another way in which customizations can be implemented. The author(s) of the original application can insert a number of hook-points where callouts are made. This is known as eventing. In eventing, the original author(s) will insert one or more callouts at defined positions in the source code. Each such callout will call out to a specified event passing certain pre-defined parameters. Additionally, at run-time, the callout will check to see if there are any subscribers to the event. If there are subscribers to the event, then the subscriber's code is loaded and executed. One limitation of standard eventing is that the original author(s) of the software may not have provided a hook-point at the precise position in the code that the developer, who needs to apply a customization, requires. Further, the original author(s) will define the contract or parameters of the callout. In some instances, if the contract or parameters of the callout are changed by the original author(s) via an upgrade or patch, customizations reliant upon the callout may fail.
A computer-implemented method of modifying execution behavior of a programmatic unit of source code is provided. The method includes loading the programmatic unit of source code and determining whether at least one customization is defined for the programmatic unit. The at least one customization is selectively executed based on whether a prerequisite of the customization is satisfied.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter. The claimed subject matter is not limited to implementations that solve any or all disadvantages noted in the background.
Embodiments of the present invention generally allow an arbitrary customization to be applied to virtually any executable unit of code, including methods, functions, modules, and even one or more individual lines of source code, without modifying the original source code. In accordance with embodiments described herein, the platform executing the original source code will provide “dynamic hooks” that allow a developer generating customizations relative to the original source code to subscribe to one or more events that the developer defines. As long as the prerequisite for the defined event is still valid, changes to the original source code from software manufacturer, such as updates and/or patches, can be provided without affecting operation of the customization(s).
As described above, many software products are intended to be customized before being deployed by an end user. One example of such as software product is an enterprise resource planning system. However, embodiments of the present invention are applicable whenever it is desirable to change the behavior of a software product without changing the source code of the software product. In the example shown in
Execution platform 20 executes original source code 12 along with customizations 18 to provide customized software operation to one or more clients 22 interacting with execution platform 20. Clients 22, in one example, are computers operably coupled to execution platform 20 via communication links 28 in order to allow clients 22 to interact with the software product being executed by execution platform 20. Links 28 can include any suitable communication links including wired or wireless communication through a LAN or WAN.
In the following example, Table 1 provides some pseudo-code that calculates a discount for a given order as part of a process posting an order:
In the example set forth in Table 1, a developer tasked with providing a change to the 10% discount calculation may wish to provide a customization. For example, the developer may need to add an additional 5% discount if the total amount is greater than 2000. In order to provide a 15% discount to amounts above 2000, or 150% of the original discount if the amount is greater than 2000, the developer can define a customization as set forth in Table 2. This customization allows the behavior of the original code, set forth in Table 1, to be modified without changing the original code whatsoever.
The pseudo-code in Table 2 is associated with the original CalculateDiscount method provided in Table 1 by the HookMethod definition with the name of the original method. This HookMethod definition is defined in metadata. In the illustrated example, the definition is using an attribute in C# style syntax. However, this is only an example and any other suitable styles can be used. The association of the original method with the pseudo-code of Table 2, notifies the execution platform that the code of Table 2 is associated with original method set forth in Table 1. Additionally, by setting “Run=AfterOriginal”, the execution platform will execute the code of Table 2 after the code of Table 1 is executed. The declaration of the MyOwnCalculateDiscount now lists a parameter, lines, that is required to be present from the original method. Additionally, MyOwnCalculateDiscount sets the scope “OriginalScope _org” such that the customization will have access to parameters and variables from the original method. All usages of _org will be tracked by the execution platform and after compilation, the compiler will, in metadata, store an indication that MyOwnCalculateDiscount will be called in sequence with CalculateDiscount and that MyOwnCalculateDiscount will access lines (a parameter), amount (as a local variable) and ReturnValue (original returnvalue).
At runtime, execution platform 20 will now call MyOwnCalculateDiscount before returning from the original CalculateDiscount allowing MyOwnCalculateDiscount to provide virtually any desired customized function. The _org scope variable will actually refer the original variables.
Embodiments of the present invention are particularly useful where the original code is updated, patched, or simply changed by the original software publisher. For example, in Table 3, below, the original method CalculateDiscount has been revised to include customer and date information.
By virtue of the metadata stored relative to MyOwnCalculateDiscount, it is apparent that the prerequisites for MyOwnCalculateDiscount are still fulfilled in the changed source code. Specifically, the method CalculateDiscount still exists and it still has, among its parameters, a “Lines [ ] lines” parameter as well as a local variable named amount. The changes to the source code will thus not affect the “contract” defined by the developer for the customization. MyOwnCalculateDiscount will not be aware of, nor use the new parameters Customer or Date. However, MyOwnCalculateDiscount does not list such parameters as part of its contract. Thus, MyOwnCalculateDiscount will continue to function properly operating on amount and the return value. If, however, any of the items specified by the developer in the contract (such as the name of the method, the lines parameter or the amount variable) were changed or deleted in the updated source code, the contract would break and result in an error when applying the customization.
Of particular note in MyOwnCalculateDiscount, is the fact that the method is defined with the “Lines[ ] lines” parameter, but that the parameter is not used by MyOwnCalculateDiscount. However, by the developer still requiring “Lines[ ] lines” it has become part of the contract for the customization and accordingly needs to be part of the original signature. This is particularly advantageous where a developer, by doing this, can take dependencies on variables even though the customization does not require it. In other words, if the CalculateDiscount method is changed such that the lines are no longer required in the original method, the customization should break (i.e. be notified with an apply customization error) so that the developer can check the customization to see if the code is still valid. This allows the developer to define a contract as detailed (close to) the original code as desired. The more detail required in the contract, the greater the chance of a break when the original code is changed. The reverse is also true. Specifically, if a developer of the update to the original source code wishes to ensure that all customizations operating on Lines are required to revisit their customization, the developer could change the name of the variable, which would break the contract.
Table 4 (below) shows an example of some pseudo-code that is executed when CalculateDiscount is called:
As can be seen, execution platform 20 will inject code to check if the method being called has been hooked and if so will pass all relevant information to the mechanism filtering the information and eventually calling the customization that is hooked to the method. The example shown in Table 4 is provided for purposes of illustration only, in an actual implementation, additional optimization may be employed and a “ReplaceOriginal” mechanism would also be provided.
All of the pseudo-code provided in the examples above is intended for illustration purposes only. Embodiments of the present invention can apply to any programming language that employs source code. Embodiments of the present invention, in some examples, provide a metadata-driven hook-in mechanism where the subscriber defines the contract vs. an author of the original source code. As long as the contract can be honored, upgrades and other changes can be made to the underlying source code without breaking the customization(s). Additionally, it is possible to determine whether such contracts can be honored simply by reviewing the metadata and the source code. Thus, the code does not need to be run before a break or other exception can be determined.
As set forth above, there are a number of ways in which the customization can be hooked to the original source code. The Run=AfterOriginal indication tells execution platform 20 that the original source code should run first followed by the customization. An alternative is Run=BeforeOriginal which will allow the customization to change any parameters and possible class variables before passing control to the original method. Still another is Run=ReplaceOriginal, which would cancel calls to the original source code and only call the customization. The latter could be used if the developer wishes to override the entire method. Indicating Run=ReplaceOriginal requires execution framework 20 to track changes made to the original code as breaking since the customization is now removing “unknown” code after a source code upgrade or change. Additionally, when using ReplaceOriginal, the _org variable should contain a CallOriginal method so that a call can be made to the original method if needed, after which the customization again will gain control and complete its work.
The code used in the customizations described herein is special in that all the constructs used by the code are “indirected” to underlying real variables where needed. Some of this can occur at compile-time and some of can occur at run-time. E.g. the code of the customization might access an Item table without having information about all the fields of such table. However, as long as the Item table has the field(s) used by the customization, the customization will function properly.
As can be appreciated, embodiments of the present invention are applicable to a wide variety of computing environments. The following are some examples of computing environments where embodiments of the present invention may be particularly advantageous.
Customer business system 101 illustratively includes processor 102, data store 104, user interface component 105, update installer component 106, conflict resolution component 119 and business process component 121. Data store 104 illustratively includes data 108, applications 110, information that describes business processes 112, information that describes workflows 114, and other items 107. In one embodiment, applications 110 include the business logic used to run business processes 112 and workflows 114 in business system 101. Applications 110 illustratively operate on data 108, which can include entities that represent items in the business system 101. Thus, applications 110 can include a general ledger application, inventory application, applications that allow a user to track business opportunities, track sales or production in a business system, or a wide variety of other business applications. The entities, for instance, include customer entities that represent customers, opportunity entities that represent business opportunities, inventory entities that represent inventory items, quote and proposal entities that represent quotes and proposals, etc. The data 108 can include a wide variety of other entities and data, and those mentioned above are mentioned for the sake of example only. The user can illustratively access customer business system 101 in order to perform activities, tasks, workflows, et cetera that are done in carrying out the business of the organization that employs business system 101.
The present discussion has mentioned processors and servers. In one embodiment, the processors and servers include computer processors with associated memory and timing circuitry, not separately shown. They are functional parts of the systems or devices to which they belong and are activated by, and facilitate the functionality of the other components or items in those systems.
A number of data stores have also been discussed. It will be noted they can each be broken into multiple data stores. All can be local to the systems accessing them, all can be remote, or some can be local while others are remote. All of these configurations are contemplated herein.
Also, the figures show a number of blocks with functionality ascribed to each block. It will be noted that fewer blocks can be used so the functionality is performed by fewer components. Also, more blocks can be used with the functionality distributed among more components.
The description is intended to include both public cloud computing and private cloud computing. Cloud computing (both public and private) provides substantially seamless pooling of resources, as well as a reduced need to manage and configure underlying hardware infrastructure.
A public cloud is managed by a vendor and typically supports multiple consumers using the same infrastructure. Also, a public cloud, as opposed to a private cloud, can free up the end users from managing the hardware. A private cloud may be managed by the organization itself and the infrastructure is typically not shared with other organizations. The organization still maintains the hardware to some extent, such as installations and repairs, etc.
In the embodiment shown in
It will also be noted that architecture 100, or portions of it, can be employed on a wide variety of different devices. Some of those devices include servers, desktop computers, laptop computers, tablet computers, or other mobile devices, such as palm top computers, cell phones, smart phones, multimedia players, personal digital assistants, etc.
According to other embodiments, applications or systems are received on a removable Secure Digital (SD) card that is connected to a SD card interface 215. SD card interface 215 and communication links 213 communicate with a processor 217 along a bus 219 that is also connected to memory 221 and input/output (I/O) components 223, as well as clock 225 and location system 227.
I/O components 223, in one embodiment, are provided to facilitate input and output operations. I/O components 223 for various embodiments of the device 216 can include input components such as buttons, touch sensors, multi-touch sensors, optical or video sensors, voice sensors, touch screens, proximity sensors, microphones, tilt sensors, and gravity switches and output components such as a display device, a speaker, and or a printer port. Other I/O components 223 can be used as well.
Clock 225 illustratively comprises a real time clock component that outputs a time and date. It can also, illustratively, provide timing functions for processor 217.
Location system 227 illustratively includes a component that outputs a current geographical location of device 216. This can include, for instance, a global positioning system (GPS) receiver, a LORAN system, a dead reckoning system, a cellular triangulation system, or other positioning system. It can also include, for example, mapping software or navigation software that generates desired maps, navigation routes and other geographic functions.
Memory 221 stores operating system 229, network settings 231, applications 233, application configuration settings 235, data store 237, communication drivers 239, and communication configuration settings 241. Memory 221 can include all types of tangible volatile and non-volatile computer-readable memory devices. It can also include computer storage media (described below). Memory 221 stores computer readable instructions that, when executed by processor 217, cause the processor to perform computer-implemented steps or functions according to the instructions. Processor 217 can be activated by other components to facilitate their functionality as well.
Examples of the network settings 231 include things such as proxy information, Internet connection information, and mappings. Application configuration settings 235 include settings that tailor the application for a specific enterprise or user. Communication configuration settings 241 provide parameters for communicating with other computers and include items such as GPRS parameters, SMS parameters, connection user names and passwords.
Applications 233 can be applications that have previously been stored on the device 216 or applications that are installed during use, although these can be part of operating system 229, or hosted external to device 216, as well.
The mobile device of
Computer 810 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 810 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media is different from, and does not include, a modulated data signal or carrier wave. It includes hardware storage media including both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by computer 810. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of any of the above should also be included within the scope of computer readable media.
The system memory 830 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 831 and random access memory (RAM) 832. A basic input/output system 833 (BIOS), containing the basic routines that help to transfer information between elements within computer 810, such as during start-up, is typically stored in ROM 831. RAM 832 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 820. By way of example, and not limitation,
The computer 810 may also include other removable/non-removable volatile/nonvolatile computer storage media. By way of example only,
Alternatively, or in addition, the functionality described herein can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Program-specific Integrated Circuits (ASICs), Program-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.
The drives and their associated computer storage media discussed above and illustrated in
A user may enter commands and information into the computer 810 through input devices such as a keyboard 862, a microphone 863, and a pointing device 861, such as a mouse, trackball or touch pad. Other input devices (not shown) may include a joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit 820 through a user input interface 860 that is coupled to the system bus, but may be connected by other interface and bus structures, such as a parallel port, game port or a universal serial bus (USB). A visual display 891 or other type of display device is also connected to the system bus 821 via an interface, such as a video interface 890. In addition to the monitor, computers may also include other peripheral output devices such as speakers 897 and printer 896, which may be connected through an output peripheral interface 895.
The computer 810 is operated in a networked environment using logical connections to one or more remote computers, such as a remote computer 880. The remote computer 880 may be a personal computer, a hand-held device, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 810. The logical connections depicted in
When used in a LAN networking environment, the computer 810 is connected to the LAN 871 through a network interface or adapter 870. When used in a WAN networking environment, the computer 810 typically includes a modem 872 or other means for establishing communications over the WAN 873, such as the Internet. The modem 872, which may be internal or external, may be connected to the system bus 821 via the user input interface 860, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 810, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation,
It should also be noted that the different embodiments described herein can be combined in different ways. That is, parts of one or more embodiments can be combined with parts of one or more other embodiments. All of this is contemplated herein.
Example 1 is a computer-implemented method modifying execution behavior of a programmatic unit of source code. The method includes loading the programmatic unit of source code and determining whether at least one customization is defined for the programmatic unit. The at least one customization is selectively executed based on whether a prerequisite of the customization is satisfied.
Example 2 is a computer-implemented method of any or all of the previous examples, wherein the programmatic unit of source code is a single line of source code.
Example 3 is a computer-implemented method of any or all of the previous examples, wherein the programmatic unit of source code includes a plurality of lines of source code.
Example 4 is a computer-implemented method of any or all of the previous examples, wherein the programmatic unit of source code is a method.
Example 5 is a computer-implemented method of any or all of the previous examples, wherein the at least one customization selectively executes in place of the programmatic unit of source code.
Example 6 is a computer-implemented method of any or all of the previous examples, wherein the at least one customization selectively executes before the programmatic unit of source code.
Example 7 is a computer-implemented method of any or all of the previous examples, wherein the at least one customization selectively executes after the programmatic unit of source code.
Example 8 is a computer-implemented method of any or all of the previous examples, wherein selective execution of the at least one customization includes providing the at least one customization with access to variables of the programmatic unit of source code during execution.
Example 9 is a computer-implemented method of any or all of the previous examples, wherein the access is determined by a scope definition in the at least one customization.
Example 10 is a computer-implemented method of any or all of the previous examples, wherein the prerequisite includes the presence of a variable in the programmatic unit of source code.
Example 11 is a computer-implemented method of any or all of the previous examples, wherein the variable is not operated upon in the at least one customization.
Example 12 is a computer-implemented method of defining a customization relative to a programmatic unit of source code. The method includes identifying a programmatic unit of source code and specifying customization execution relative to the identified programmatic unit of source code. A scope of the customization execution is defined. The identification of the programmatic unit of source code, the specified customization execution information and scope information is stored and provided to an execution platform.
Example 13 is a computer-implemented method of any or all of the previous examples, and further defining at least one prerequisite that must be present in the programmatic unit of source code before the customization will be executed by the execution platform.
Example 14 is a computer-implemented method of any or all of the previous examples, wherein the prerequisite includes a parameter that must be present in the programmatic unit of source code before the customization will be executed by the execution platform.
Example 15 is a computer-implemented method of any or all of the previous examples, wherein the parameter is not used in the customization.
Example 16 is a computer-implemented method of any or all of the previous examples, wherein specifying customization execution relative to the identified programmatic unit of source code includes an indication that the customization will execute in place of the identified programmatic unit of source code.
Example 17 is a computer-implemented method of any or all of the previous examples, wherein the scope of the customization execution is defined so that the customization will have access to variable of the programmatic unit of source code that it is replacing.
Example 18 is a computer-implemented method of any or all of the previous examples, wherein specifying customization execution relative to the identified programmatic unit of source code includes an indication that the customization will execute absolutely first before the identified programmatic unit of source code.
Example 19 is a computer-implemented method of any or all of the previous examples, wherein specifying customization execution relative to the identified programmatic unit of source code includes an indication that the customization will execute absolutely last after the identified programmatic unit of source code.
Example 20 is a computer system configured to execute programmatic units of source code. The computer system includes a processor configured to execute the programmatic units of source code and a storage component adapted to store the programmatic units of source code and at least one customization defined relative to a selected programmatic unit of source code. The processor is configured to load a programmatic unit of source code and determine whether a customization is defined relative to the loaded programmatic unit of source code and selectively execute the customization based on a definition of the customization.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.
The present application is based on and claims the benefit of U.S. Provisional Patent Application Ser. No. 62/015,075, filed Jun. 20, 2014, the content of which is hereby incorporated in its entirety.
Number | Date | Country | |
---|---|---|---|
62015075 | Jun 2014 | US |