The accompanying drawings, which are incorporated in and constitute part of this specification, illustrate embodiments of the invention and together with the description, serve to explain the principles of the invention. The embodiments illustrated herein are presently preferred, it being understood, however, that the invention is not limited to the precise arrangements and instrumentalities shown, wherein:
Embodiments of the present invention provide a method, system and computer program product for adapting archived source code for structured data mining for source code reuse. In accordance with an embodiment of the present invention, source code can be parsed and statements within the source code can be classified. The parsed and classified source code can be transformed into markup conforming to a common source code schema and archived as markup. The archived markup can be searched to locate reusable code portions and selected reusable code portions can be retrieved for code reuse. Upon retrieval, the selected reusable code portions can be restored from markup form to source code form. In this way, reusable code portions can be more readily located and reused irrespective of the heterogeneous nature of source code across different projects.
In further illustration of an embodiment of the present invention,
The code reuse repository 160 can include a source code archive 130 coupled to the software development tool 120 via source code adapter 200. The source code adapter 200 can include program code enabled to process source code 140 into markup language formatted code portions according to the markup language schema 150. Specifically, the source code adapter 200 can parse the source code 140 to identify different code constructs within the source code 140.
The different code constructs can be denoted by markup language tags provided by the schema 150 and stored into the source code archive 130. In this way, the constructs can be located subsequently within the source code archive 130 through searching markup language denoted code portions. Once located, the markup language denoted code portions can be returned to source code form for code reuse.
In further illustration of the operation of the source code adapter,
In block 210, a first code structure can be selected and in block 215, the code structure can be matched to a schema element within a markup language schema for the source code. In block 220, a markup language tag can be applied to the code structure and the process can repeat through decision block 225 for additional selected code structures in the source code. When the source code has been fully processed, in block 230 the markup language tagged code structures can be stored for subsequent indexing, searching and retrieval.
Turning now to
Embodiments of the invention can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment containing both hardware and software elements. In a preferred embodiment, the invention is implemented in software, which includes but is not limited to firmware, resident software, microcode, and the like. Furthermore, the invention can take the form of a computer program product accessible from a computer-usable or computer-readable medium providing program code for use by or in connection with a computer or any instruction execution system.
For the purposes of this description, a computer-usable or computer readable medium can be any apparatus 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 medium can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) or a propagation medium. Examples of a computer-readable medium include a semiconductor or solid state memory, magnetic tape, a removable computer diskette, a random access memory (RAM), a read-only memory (ROM), a rigid magnetic disk and an optical disk. Current examples of optical disks include compact disk—read only memory (CD-ROM), compact disk—read/write (CD-R/W) and DVD.
A data processing system suitable for storing and/or executing program code will include at least one processor coupled directly or indirectly to memory elements through a system bus. The memory elements can include local memory employed during actual execution of the program code, bulk storage, and cache memories which provide temporary storage of at least some program code in order to reduce the number of times code must be retrieved from bulk storage during execution. Input/output or I/O devices (including but not limited to keyboards, displays, pointing devices, etc.) can be coupled to the system either directly or through intervening I/O controllers. Network adapters may also be coupled to the system to enable the data processing system to become coupled to other data processing systems or remote printers or storage devices through intervening private or public networks. Modems, cable modem and Ethernet cards are just a few of the currently available types of network adapters.