Integrated development environments (IDEs) provide a common platform and design tools for modern software development. While software is often the most time-consuming and highest risk aspect of electronic product development, it also holds the greatest potential to enhance a design for multiple target applications. Such design tools allow designers to efficiently develop code where graphical user interfaces (GUI) automates and simplifies the configuration of complex programming projects. These tools also enable designers to create source code by enhancing code readability and simplifying code writing. For instance, source code editor features may include syntax coloring, auto-indenting, and shortcut menus that link stored procedure calls to their definitions, declarations, and usages even when these references reside in separate files. Other aspects of the tools include simulation resources to allow designers to develop and debug applications when hardware resources are scarce or unavailable.
One area of software development that is performed on IDEs includes mapping class objects to relational objects, referred to as O/R mapping, and is the latest advancement in modern day programming technologies. It improves the productivity of programmers by many degrees while providing flexibility to adapt to changing business needs. While O/R technology itself provides many benefits to programmers, enabling O/R classes to be created and set up correctly is not an easy task for normal development nor is it well-supported in current programming tools. Without providing adequate tools support, programmers trying to adopt the technology may be forced to write their respective code manually.
A specific example where current tools do not adequately support automated software development relates to stored procedure development, employment, and manipulation. Stored procedures are widely used as default methods to access and modify data for several reasons such as encapsulation of business logic, reusability, security, and maintainability. A stored procedure can be considered a subroutine available to applications accessing a relational database system. Stored procedures (sometimes referred to as sproc or SP) are physically stored in the database.
Typical uses for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures are used to consolidate and centralize logic that was originally implemented in applications. Large or complex processing that may require the execution of several SQL statements, for example, can be moved into stored procedures whereby applications then call the procedures from that point forward. Stored procedures are similar to user-defined functions (UDFs), where the major difference is that UDFs can be utilized like any other expression within SQL statements, whereas stored procedures are invoked using a CALL statement. Stored procedures can return result sets such as the results of a SELECT statement. Such result sets can be processed by other stored procedures by associating a result set locator, or by applications.
The precise implementation of stored procedures generally varies from one database system to another, where most major database vendors support them in some form. Depending on the database system, stored procedures can be implemented in a variety of programming languages, for example SQL, Java, C, and C++, for example. Stored procedures written in non-SQL programming languages may or may not execute SQL statements, where the increased adoption of stored procedures led to the introduction of procedural elements to the SQL language. That adoption made SQL an imperative programming language. Most database systems offer proprietary and vendor-specific extensions. One trend that is emerging now is the ability to easily interact with the stored procedures while in a visual programming environment offered by the IDE. This may require software developers to perform manual operations when operating upon and manipulating the stored procedures.
The following presents a simplified summary in order to provide a basic understanding of some aspects described herein. This summary is not an extensive overview nor is intended to identify key/critical elements or to delineate the scope of the various aspects described herein. Its sole purpose is to present some concepts in a simplified form as a prelude to the more detailed description that is presented later.
A development environment and visual workspace is provided where stored procedures can be visually manipulated in accordance with object class components to facilitate automated software development. In an aspect, graphical tools are provided that allow dragging (or other computer control) a stored procedure (or any database function) onto a class component that is visually represented in a designer workspace, whereby the tools automatically creates a method (or methods) on the respective class. This includes automatically wrapping the stored procedure for the respective class and mapping to the underlying stored procedure. Generally, stored procedures have a scalar or subset return set which are associated with one or more class properties. For example, a visual drag operation may include a “Top10Employees” stored procedure component that is manipulated onto an Employee class for inclusion in an Employee Adapter class set of methods.
The graphical tools and workspace allow visually and programmatically creating object/relational (O/R) methods that are based on stored procedures. This includes visually and programmatically associating stored procedures with an O/R class, for example. Also, the tools allow for differentiating which stored procedure to associate with an O/R class based on return values among other aspects. By providing visual controls and associations between O/R classes and stored procedures, small to medium businesses and less skilled developers can more easily create Object-to-Relationally based applications since manual mapping between components is mitigated via automated graphical methods.
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings. These aspects are indicative of various ways which can be practiced, all of which are intended to be covered herein. Other advantages and novel features may become apparent from the following detailed description when considered in conjunction with the drawings.
A graphical design environment is provided that enables automated mappings to be generated between object/relational classes and database procedures. In one aspect, a development system is provided. The system includes a workspace component to visually display one or more stored procedures and one or more class components. A manipulation component locates the stored procedures onto the class components in order to automatically create methods for the class components.
As used in this application, the terms “component,” “tool,” “class,” “procedure,” “wrapper,” and the like are intended to refer to a computer-related entity, either hardware, a combination of hardware and software, software, or software in execution. For example, a component may be, but is not limited to being, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or a computer. By way of illustration, both an application running on a server and the server can be a component. One or more components may reside within a process and/or thread of execution and a component may be localized on one computer and/or distributed between two or more computers. Also, these components can execute from various computer readable media having various data structures stored thereon. The components may communicate via local and/or remote processes such as in accordance with a signal having one or more data packets (e.g., data from one component interacting with another component in a local system, distributed system, and/or across a network such as the Internet with other systems via the signal).
Referring initially to
In general, the stored procedures 130 are employed as default methods to access and modify data for several reasons such as encapsulation of logic, reusability, security, and maintainability, for example. In one example, the workspace 110 functions as an object/relational (O/R) designer for stored procedure support making it easy for programmers to take advantage of O/R technology and still being able to utilize existing stored procedures. This includes the ability to visually and programmatically create O/R methods at 150 based on the stored procedures 130. Similarly, this includes visually and programmatically associating the stored procedures 130 with an O/R class at 140, for example although other types of classes can be supported. Also, the workspace 110 and associated components allow differentiating which stored procedure 130 to associate with an O/R class based on a return value or other parameter, for example.
The concept of mapping class objects to relational objects, referred to as O/R mapping, is the latest advancement in modern programming technologies. It improves the productivity of programmers by while providing flexibility to adapt to changing needs. While the technology itself provides benefits to programmers, having O/R classes created and set up correctly is not a straight-forward task for developers. The workspace 110, manipulation components 120, automated method generation at 150, and automated mappings at 160, mitigate programmers having to develop code manually. The system 100 solves this by providing the workspace 110 and automated controls to visually create the classes 140 via drag and drop or other type of manipulation components 120.
The workspace 110 provides a designer platform to determine what actions to take by analyzing the stored procedure 130 located onto the workspace (e.g., computer display screen). An O/R method is created at 150 based on the stored procedure 130 definition. Based on a visual drop target for example and the shape of return value of the stored procedure 130, a different action can be taken by the designer platform. If a component drop target is an existing O/R class 140 and the stored procedure 130 returns scalar values or a result set that has the same shape or shape that is a superset or subset of the target O/R class properties, then a relationship is created between the method that wraps the stored procedure at 150 and the target class 140.
If a drop target is a Methods Pane (described below), a special region in the designer or workspace 110 that has been reserved for O/R methods, or the background surface of the designer/workspace, a method that wraps the stored procedure can be added to an O/R methods list under a desired data context. This functionality adds value to a business by enabling programmers to visually create O/R based applications using O/R technologies (e.g., LINQ to SQL). In another aspect, the system 100 can be employed to create object/relational mappings. The system includes means for creating (workspace 110) one or more class components and means for selecting one or more stored procedures (manipulation components 120). This can also include means for creating a mapping (wrapper 150) between the class components and the stored procedure when the stored procedures are visually associated with the class components.
In addition to various hardware and/or software components, various interfaces can be provided to manipulate components in the workspace 110. This can include a Graphical User Interface (GUI) to interact with the user or other components such as any type of application that sends, retrieves, processes, and/or manipulates data, receives, displays, formats, and/or communicates data, and/or facilitates operation of the system 100. For example, such interfaces can also be associated with an engine, server, client, editor tool or web browser although other type applications can be utilized.
The GUI can include a display having one or more display objects (not shown) for manipulating the stored procedures 130 and classes 140 including such aspects as configurable icons, buttons, sliders, input boxes, selection options, menus, tabs and so forth having multiple configurable dimensions, shapes, colors, text, data and sounds to facilitate operations with the workspace 110. In addition, the GUI can also include a plurality of other inputs or controls for adjusting, manipulating, and configuring one or more aspects. This can include receiving user commands from a mouse, keyboard, speech input, web site, remote web service and/or other device such as a camera or video input to affect or modify operations of the GUI. For example, in addition to providing drag and drop operations of the stored procedures 130 onto the class components 140, speech or facial recognition technologies can be employed to select/locate/move the stored procedure in vicinity of the class component to trigger automated method creation and subsequent mappings.
Proceeding to 210, one or more class components are defined or developed within the context of a graphical/visual workspace. As noted above, this can include an integrated development environment that provides a visual space or development area where visual objects can be selected from memory and moved onto the space. At 220, stored procedure components are selected. This can include selecting procedures from a list associated with the workspace, menus, tabs, or from visual objects that appear on or near the workspace when stored procedures are available in an associated memory. At 230, the stored procedure selected at 220 is moved within vicinity of a class component created at 210. This could include an operation such as drag and drop or other controls such as eye-monitoring controls or voice activated controls.
At 240, when the stored procedure is moved in vicinity (within a predefined threshold area) or touching the class component defined at 210, one or more methods are automatically created for the respective class component. At 250, the stored procedure is wrapped (code automatically created to interface class with stored procedure) and mappings are created from the respective class back to the underlying stored procedure. As can be appreciated, other class to stored procedure mappings can be created by moving a stored procedure at or near another class component appearing on the workspace.
Referring now to
At 330, stored procedures are provided for the workspace. A stored procedure can be dragged onto a diagram or work surface and is added to the data context. A wrapper method for the stored procedure is added to the data context, where a method argument signature matches the stored procedure argument signature. Generally, the method name closely matches the name of the stored procedure. The name may not be an exact match due to system naming restrictions or conflicts. Method name conflicts can be resolved by adding numeric index at the end of the method name to make it unique (MySproc, MySproc1, MySproc2, and so forth). Along with the name, a new method can be added to a Method View which is described in more detail below.
If a stored procedure is dragged onto an existing class shape, and if it is a table returning stored procedure and the shape of result set is similar or superset of the class properties, a method can be added to the data context and return value is set to the class targeted. Otherwise, an error can be thrown. If multiple stored procedures are dragged over onto the designer background—generally—, they are added to the data context and Method View associated with the workspace. If multiple stored procedures are dragged onto an existing class shape and if stored procedures return result sets with matching shape, methods are added to the data context and return value is set to the class targeted. If at least one stored procedure that does not return matching result set is found, those stored procedures are skipped and an error message can be thrown. At 340, table-valued functions can be processed are processed similar to table-returning stored procedures.
Turning to
Referring to
The object 500 can include base level functionality, including selection, mouse-over highlights, mouse and keyboard moves, cut, paste, undo, redo, individual element selection, collapse and expand of sections, and so forth. A user can create an O/R class by dragging an O/R class shape 510 from a toolbox or by dragging over an appropriate database object from the database selections. When a class is created on the diagram or workspace, a corresponding class definition is created in the code file.
Turning to
At 610, a Tool Box with O/R Designer objects can be provided. A Sever Explorer component can be provided at 620 showing object locations and an O/R Designer surface is provided at 630. A Solution Explorer 640 can be provided along with a Property window 650. An end-to-end scenario enabled by the O/R Designer is the ability to create Object Class to Relational code file with a designer. Without this feature, a developer must hand-code the entire set of files necessary for Object to Relational Code. Before proceeding it is noted that one or more of the following definitions can apply:
O/R—Object to Relational. This term refers to mapping technologies such as Linq to SQL for example that provide a programmatic run-time map between relational databases objects (such as tables and columns) and program objects (such as classes and properties).
LINQ to SQL—LINQ for databases. This is an example Object to Relational technology.
MProp—Member Property. Classes (e.g., ‘Person’), as they exist in code, can have member properties (e.g., ‘FirstName’). Classes, as they exist on a designer, can also have a different type of property that governs, for instance, how the class is generated into code (e.g., ‘Access Modifier’).
Referring to
The entities pane 710 shows class shapes representing entities in the model. The background of the entities pane 710 is the graphic object that represents the Data Context. The data context is the class that operates with the database. The data context understands about the connection, the specific database, and so forth. It is the data context that has the ability to retrieve objects, insert, update, and/or delete them as needed. In this example, a contact class 730 is shown connected to an example employee class. Generally, an O/R designer instance communicates to one database but other connections are possible. This reflects how the underlying data context works. In order to map objects against other databases, users can add additional designers to the project. As previously noted, the entities pane 710 generally cannot be hidden. When the designer is empty of all classes, it displays a message on the designer background to help prompt the user to drag classes from the Server Explorer shown above in
1. Base level runtime functionality including selection, mouse-over highlights, mouse and keyboard moves, cut, paste, undo, redo, individual element selection, collapse and expand of sections, and so forth can be provided by the a runtime engine. Additive functionality can be specified with appropriate call-outs to the contextual runtime behavior where appropriate.
2. Creation. A user can create an O/R association by first selecting a class on the diagram. Then, the user opens the Tool box and selects the Association shape. This will change the mouse cursor to an association icon. The user then draws the association from the parent class to the target class. Alternatively, the user can bring up the context menu on the class and choose “Insert Association”. This will bring up the New Association Dialog. The user can select a child class, choose OK, and an association will be created between the two classes.
3. Deletion. A user can delete an O/R Association by selecting it and selecting the DELETE key or choosing a CUT operation (from the main or context menu).
4. Editing. The user can edit the O/R association by using the property grid or by double clicking on the association arrow to bring up the Association Editor.
5. Tool tip. The tool tip shows the relationship textually. The form for the first line can be:
Second line is:
In order to provide a context for the various aspects of the disclosed subject matter,
With reference to
The system bus 918 can be any of several types of bus structure(s) including the memory bus or memory controller, a peripheral bus or external bus, and/or a local bus using any variety of available bus architectures including, but not limited to, 11-bit bus, Industrial Standard Architecture (ISA), Micro-Channel Architecture (MSA), Extended ISA (EISA), Intelligent Drive Electronics (IDE), VESA Local Bus (VLB), Peripheral Component Interconnect (PCI), Universal Serial Bus (USB), Advanced Graphics Port (AGP), Personal Computer Memory Card International Association bus (PCMCIA), and Small Computer Systems Interface (SCSI).
The system memory 916 includes volatile memory 920 and nonvolatile memory 922. The basic input/output system (BIOS), containing the basic routines to transfer information between elements within the computer 912, such as during start-up, is stored in nonvolatile memory 922. By way of illustration, and not limitation, nonvolatile memory 922 can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory 920 includes random access memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in many forms such as synchronous RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM).
Computer 912 also includes removable/non-removable, volatile/non-volatile computer storage media.
It is to be appreciated that
A user enters commands or information into the computer 912 through input device(s) 936. Input devices 936 include, but are not limited to, a pointing device such as a mouse, trackball, stylus, touch pad, keyboard, microphone, joystick, game pad, satellite dish, scanner, TV tuner card, digital camera, digital video camera, web camera, and the like. These and other input devices connect to the processing unit 914 through the system bus 918 via interface port(s) 938. Interface port(s) 938 include, for example, a serial port, a parallel port, a game port, and a universal serial bus (USB). Output device(s) 940 use some of the same type of ports as input device(s) 936. Thus, for example, a USB port may be used to provide input to computer 912 and to output information from computer 912 to an output device 940. Output adapter 942 is provided to illustrate that there are some output devices 940 like monitors, speakers, and printers, among other output devices 940 that require special adapters. The output adapters 942 include, by way of illustration and not limitation, video and sound cards that provide a means of connection between the output device 940 and the system bus 918. It should be noted that other devices and/or systems of devices provide both input and output capabilities such as remote computer(s) 944.
Computer 912 can operate in a networked environment using logical connections to one or more remote computers, such as remote computer(s) 944. The remote computer(s) 944 can be a personal computer, a server, a router, a network PC, a workstation, a microprocessor based appliance, a peer device or other common network node and the like, and typically includes many or all of the elements described relative to computer 912. For purposes of brevity, only a memory storage device 946 is illustrated with remote computer(s) 944. Remote computer(s) 944 is logically connected to computer 912 through a network interface 948 and then physically connected via communication connection 950. Network interface 948 encompasses communication networks such as local-area networks (LAN) and wide-area networks (WAN). LAN technologies include Fiber Distributed Data Interface (FDDI), Copper Distributed Data Interface (CDDI), Ethernet/IEEE 802.3, Token Ring/IEEE 802.5 and the like. WAN technologies include, but are not limited to, point-to-point links, circuit switching networks like Integrated Services Digital Networks (ISDN) and variations thereon, packet switching networks, and Digital Subscriber Lines (DSL).
Communication connection(s) 950 refers to the hardware/software employed to connect the network interface 948 to the bus 918. While communication connection 950 is shown for illustrative clarity inside computer 912, it can also be external to computer 912. The hardware/software necessary for connection to the network interface 948 includes, for exemplary purposes only, internal and external technologies such as, modems including regular telephone grade modems, cable modems and DSL modems, ISDN adapters, and Ethernet cards.
What has been described above includes various exemplary aspects. It is, of course, not possible to describe every conceivable combination of components or methodologies for purposes of describing these aspects, but one of ordinary skill in the art may recognize that many further combinations and permutations are possible. Accordingly, the aspects described herein are intended to embrace all such alterations, modifications and variations that fall within the spirit and scope of the appended claims. Furthermore, to the extent that the term “includes” is used in either the detailed description or the claims, such term is intended to be inclusive in a manner similar to the term “comprising” as “comprising” is interpreted when employed as a transitional word in a claim.