The present invention relates to developing software code.
Software development and debugging is typically performed using an integrated development environment (IDE). An IDE typically comprises a source code editor, a compiler and/or interpreter, build automation tools, and a debugger. Code development tools, such as IDEs, often perform code generation based on user input. For example, if a user wants to consume a web service from a Java servlet class, a typical development tool will prompt a user for input via a wizard-like user interface (UI). The user is prompted to provide configuration details that will enable the tool to generate the desired code. The tool with then generate the necessary Java code into the servlet, as well as Java classes to support the web service proxy call (stub types, etc.).
While this type of development tool is useful, there are problems with this approach. One such problem is the potential loss of “round-trip support.” Round-trip support refers to the ability of the software development tool to recognize and handle changes made to the generated code by a user (this ability to go backward from the generated code to the wizard is termed reverse-engineering) such that the user-changed code can still be supported and further configured by the tool. For example, consider an IDE that has a JDBC (Java DataBase Connectivity) data access wizard which allows users to specify a target database table and generates Java code to access the data thru an SDO (Service Data Object)-based mediator runtime. The wizard solicits the following input from the user (for illustration purposes, this is a simplified list): connection name; SDO data object name; target database table; and query parameter names and values (or expressions). Using this user input, the IDE will generate Java code to access the desired data.
In a typical IDE, the generated code will be available to the user before the code is deployed, such that the user will be able to make changes to the generated code. If the user makes particular changes to the generated code (such as by changing certain statements inside a method body), then the next time the wizard is launched in order to do further configuration it becomes impossible to reverse-engineer the original configuration model based on the generated code. Therefore, round-trip support is broken. Whether round-trip support breaks because of user changes to the generated code typically depends on the type of changes made by the user. Typically, syntax changes do not break round-trip support, but semantics changes do break round-trip support.
Another problem with this type of development tool is that the generated code is technology-specific (i.e., conforms to a particular software standard, protocol, or language). This can be seen in the example above, in which the wizard was specific to the SDO mediator-based data access technology. If the user later on decides to use, for example, EJB (Enterprise JavaBean)-based access, the user will have to delete the generated code and start over with an EJB creation wizard. This would require the user to re-enter much or all of the same configuration information.
The present invention provides the ability to use annotations to represent current user configuration, which allows for round-trip support as well as choosing the specific implementation technology at a later point. The present invention provides a preview capability which allows users to dynamically expand the annotation to preview what will be generated based on the current configuration information. The present invention generates software code based on the user configuration input and packages the generated software code for deployment without allowing a user to edit the generated software code.
In one embodiment of the invention, a method of developing software code comprises soliciting and receiving user input regarding one or more software configuration properties, storing the user input, generating software code based on the user input, and packaging the generated software code for deployment without allowing a user to edit the generated software code. The user input may be stored as one or more annotations.
The method may further comprise, prior to generating the software code, creating and displaying a preview of the software code to be generated. Additionally, the method may further comprise soliciting and receiving user selection of a software technology. In such an embodiment, the generated software code is compliant with the selected software technology.
In addition to the method of developing software code, as described above, other aspects of the present invention are directed to corresponding systems and computer program products for developing software code.
Having thus described the invention in general terms, reference will now be made to the accompanying drawings, which are not necessarily drawn to scale, and wherein:
The present invention provides a method, system and computer program product for developing software code in which configuration information is received from a user, saved, and used to generate software code. The configuration information defines particular aspects of the desired software code. For example, the configuration information may define a connection name (i.e., the name of a connection to an external data source), a data object name (i.e., the name of an object in memory that contains data that is desired to be accessed), a target database table (i.e., which database table contains data that is desired to be accessed), query parameter names and values (i.e., the criteria for selecting the rows in the database table that are desired to be accessed), relationship to other database tables (i.e., additional selection criteria and/or additional information stored in other database tables), database schema (i.e., which particular set of tables to access), etc. The present invention provides a preview capability which allows users to dynamically expand the annotation to preview what will be generated based on the current configuration information. The present invention generates software code based on the user configuration input and packages the generated software code for deployment without allowing a user to edit the generated software code.
Embodiments of the invention may be implemented in an IDE. Referring now to
The annotation mechanism will allow parameters to capture the user input choices, as well as allowing further updates. Because all the information is captured in a well-defined, much condensed format, it is very easy to re-construct the current model from the code (i.e., reverse-engineer). The “annotation with parameters” format also makes it very easy to provide code assistance. For instance, when the “connection_name” is at focus, the code assistance can inspect the workspace and provide the list of defined connections to choose from.
After initially inputting configuration information, the user may be given the opportunity to reconfigure the input by changing some information and/or adding information (block 16). The user may be given the choice of viewing a preview of the code to be generated (block 18). When “preview” is requested, the user will typically be prompted for a “technology” (i.e. software standard, protocol, or language) choice (block 20). The user will typically be presented with a list of technologies appropriate for implementing the intended solution. For example, in the above example in which a database access application is being developed, the user may be presented with the following technology options: SDO-mediator, EJB, and JPA (Java Persistence API (Application Program Interface)). After a selection is received from the user (block 22), the invention will proceed with an “internal” generation operation in order to generate and display a preview (block 24). However, no actual resources or code will be generated for this preview operation. After viewing the preview, the user can decide whether to deploy the previewed code (block 26). If the user selects not to deploy the code, the user can choose either to reconfigure the code (block 28) or to simply close and discard the preview (block 30).
If the user selects to deploy the code after viewing the preview, the invention will generate the desired software code based on the user input captured in the annotations, and package the generated code for deployment (block 40). Packaging the generated code for deployment typically comprises putting the code and associated resources into a well understood format that is appropriate to the technology selected by the user. If necessary, packaging may also comprise compiling source code into machine or binary code. After packaging, the software code is deployed to a specified target environment (the deploy process will not be described in detail as the deploy process (after packaging of the code) is known). The code is packaged for deployment without allowing a user to edit the generated software code. This prevents the user from directly editing the generated code, which in turn ensures that the IDE will be able to reverse-engineer the code.
If the user does not choose to preview in block 18, the user can decide whether to deploy the code (block 32). If the user selects not to deploy the code, the user can choose to reconfigure the code (block 34). If the user selects to deploy the code, the user will typically be prompted for a “technology” (i.e. software standard, protocol, or language) choice (block 36). As above, the user will typically be presented with a list of technologies appropriate for implementing the intended solution. After a selection is received from the user (block 38), the invention will generate the desired software code based on the user input captured in the annotations and package the generated code for deployment (block 40). As above, the software code is deployed after packaging to a desired target environment, and is packaged without allowing a user to edit the generated software code.
In one example, a user may desire to generate software code that retrieves records from a database named “SAMPLE.” An IDE that encompasses embodiments of the invention would prompt the user to input configuration information needed to generate the code, such as database connection name, target database table, selected columns, row selection criteria. In this simplified example, the user input is captured and saved as the below two annotations:
Using just the above two annotations, all the essential application settings for this particular problem domain has been captured. There would be one annotation processor and code generator per technology choice per problem domain, so in this example the annotation processor and code generator corresponding to the “JDBC Mediator” technology will be able to generate and package (or create a preview of) the following Java runtime code:
After deployment, the annotations will be saved in files (in this example, in Java source code files (.java files)) which are managed by the IDE for continued use and further configurations/modifications.
In order for IDE vendors to make the code generation and packaging mechanism of the present invention available to different problem domains in addition to data access applications, IDE vendors may use a known extensibility mechanism in which vendors can apply the code generation and packaging mechanism of the present invention to different problem domains. For instance, through this extensibility mechanism, one vendor can contribute a set of annotations for capturing the necessary information to invoke a web service. As part of the contribution, the vendor may also contribute an annotation processor which will extract user input from the annotations to use in generating the code, for which they will also need to contribute a code generator.
As will be appreciated by one skilled in the art, the present invention may be embodied as a system, method or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, the present invention may take the form of a computer program product embodied in any tangible medium of expression having computer-usable program code embodied in the medium.
Any combination of one or more computer usable or computer readable medium(s) may be utilized. The computer-usable or computer-readable medium may be, for example but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, device, or propagation medium. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: 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 transmission media such as those supporting the Internet or an intranet, or a magnetic storage device. Note that the computer-usable or computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted, or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory. In the context of this document, a computer-usable or computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The computer-usable medium may include a propagated data signal with the computer-usable program code embodied therewith, either in baseband or as part of a carrier wave. The computer usable program code may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider).
The present invention is described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable medium that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable medium produce an article of manufacture including instruction means which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
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 and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
“Computer” or “computing device” broadly refers to any kind of device which receives input data, processes that data through computer instructions in a program, and generates output data. Such computer can be a hand-held device, laptop or notebook computer, desktop computer, minicomputer, mainframe, server, cell phone, personal digital assistant, other device, or any combination thereof.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The corresponding structures, materials, acts, and equivalents of all means or step plus function elements in the claims below are intended to include any structure, material, or act for performing the function in combination with other claimed elements as specifically claimed. The description of the present invention has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the invention. The embodiment was chosen and described in order to best explain the principles of the invention and the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.