This invention relates to computing, and more particularly to the use of document templates for speedy creation of files with a plurality of desired properties, and more particularly to the facilitated generation of customized templates.
The use of file templates has become commonplace for computer users in variety of applications in which users create and save data in a file. File templates allow a user to create a new file with a readymade set of initial properties, instead of starting work on a new file from scratch. One common template is a letter template in a word processing program, such as MICROSOFT WORD®. A user of such a template may first select the appropriate template, which operates to create a new file with desirable file properties. The user may then be prompted to enter data into several fields. For example, the user may fill in an address field, a date field, a salutation field, and so on. After inserting data into the fields, the user may go on to add additional content to the letter, and save it to a desired location. There are presently many kinds of templates available. Letters, resumes, memos, and so forth are commonly created from word processing application templates, while web pages of various styles are created from templates in webpage editing software, and various files created for software applications are generated from templates in Integrated Development Environments (IDEs).
More particularly, with reference to IDE's, note that most modern software is typically created with a great deal of computer automated assistance. Such assistance is commercially available through any of a number of IDEs. For example, MICROSOFT'S VISUAL STUDIO®, BORLAND'S C++ BUILDER®, METROWERK'S CODE WARRIOR®, and IBM'S WEBSPHERE STUDIO® are all products presently available to assist in software creation. Such products provide a range of useful functions, such as templates for creating new files, that may be subsequently adapted to the particular needs of an undertaking. Other IDE functions include coordinating communications between multiple developers working together on large applications, assisting in the actual writing of source code, assisting in specifying how a source code file will be compiled, and providing compilers and other processes that convert source code files and the like into executable files.
While many IDE users are familiar with and commonly use templates, fewer IDE users create their own templates for later use. This is at least in part because the creation of templates in modern IDEs is time-consuming, difficult, and error prone. It involves the creation of at least two, if not more, separate files to instruct a template building engine in the details of desired template properties. A first file may point to a template wizard dialog process which allows user insertion of file properties. A second file provides the code for placing and formatting the user-entered data into the document created from the template. Because the second file is javascript code and not written in an easily debuggable language such as compiled code, such authored templates are difficult to debug and therefore difficult to author.
The difficulty of creating custom templates in modern IDEs is particularly troublesome in light of the working needs of modern software developers. Developers are a group of computer users who uniquely benefit from the use of templates. Developers understand the details of their own work better than the properties of a factory-provided template. Developers may often work on related software projects, or improvements and optimizations of past projects, that lend themselves to re-use of previously developed code. Redundant coding is highly inefficient and can be frustrating for developers as they reconsider problems that may have already been thought through.
Perhaps more importantly, leveraging past work without a template can be error-prone. When a previously developed file is re-used, the properties of the file must be uniformly updated, or the resulting software may not operate properly. Thus, developers are a group of computer users that derive particular advantage from the use of templates, so the ability to efficiently create new, custom templates is a feature of great advantage in IDE software.
Two of the most important features in templates which are used inside any program are the ability to easily exchange and easily author templates. For some applications, objects naturally lend themselves to being a single file. MICROSOFT WORD® is an example of such an application. Template creation and exchange is simplified. All the data and metadata for the template is stored in a single file, (e.g., the ______.dot file for MICROSOFT WORD®). However, developer templates are by nature hard to author and exchange. For developers, template authoring and exchange is equally if not more important than for other application types. Leveraging existing code and the work of others is a common productivity practice in the development industry. Developers frequently leverage each others' code to build iteratively more complex and fully functional applications. Templates are a key part of this process. They serve a variety of functions: (1) starting points for essential building blocks such as UI-based applications or libraries; (2) fully functional applications which can be taken by others and customized to meet particular customer needs (ex: website samples); (3) building block libraries or functions which are written by one architect inside a development team and then leveraged for a variety of applications; (4) outlines of key best practices for writing code blocks which are written by senior devs and leverage by junior devs in a team development environment. Templates may contain (as a list of examples and not a complete rendering): (1) code blocks; (2) build settings; (3) re-usable components or libraries. These templates then appear in the New Project and/or Add New Item and or/New File dialogs in VISUAL STUDIO®, for example, for the user to create new projects/add files to his/her project. Code Projects are in format inherently complex on disk. They usually contain some form of metadata build settings file, code files, and may additionally contain documentation, graphical or string resources, etc. Template creation is also necessarily a user-customizable process; authors may wish to see certain files opened/closed in the IDE on create, customize whether the user is prompted to enter a name, use the user-entered name to name certain items (files, classes, etc.) in the created project, show custom UI to gather information and customize the build configuration, etc.
Therefore, there is a need in the art to support the ability of developers to be able to both easily author templates and to be able to easily exchange them in a single file format.
Various embodiments of the present invention are directed to systems and methods for creating and providing templates in a single file. More specifically, various embodiments of the present invention are directed to providing templates that are created based upon current saved projects or files and provide for easy modification and transfer of the templates from one user to another.
For several embodiments of the present invention a method for generating a template for creating data is provided comprising first providing data upon which the template will be based and then creating a metadata file associated with the template and the data, wherein the file is coded at least in part in a declarative programming language. The data and the associated metadata file are packaged into a single transferable file.
Various embodiments of the present invention may also be characterized as method for using templates having associated metadata files, the method comprises parsing all the metadata files, building an index of all the templates, displaying the index, selecting a template from the index, reading a metadata file associated with the selected template, creating new data based on information read in the metadata file, and making said new data available for use in a software application.
The foregoing summary, as well as the following detailed description of preferred embodiments, is better understood when read in conjunction with the appended drawings. For the purpose of illustrating the invention, there is shown in the drawings exemplary constructions of the invention; however, the invention is not limited to the specific methods and instrumentalities disclosed. In the drawings:
The inventive subject matter is described with specificity to meet statutory requirements. However, the description itself is not intended to limit the scope of this patent. Rather, the inventor(s) has (have) contemplated that the claimed subject matter might also be embodied in other ways, to include different steps or combinations of steps similar to the ones described in this document, in conjunction with other present or future technologies. Moreover, although the term “step” may be used herein to connote different elements of methods employed, the term should not be interpreted as implying any particular order among or between various steps herein disclosed unless and except when the order of individual steps is explicitly described.
Computer Enviornment
Numerous embodiments of the present invention may execute on a computer.
As shown in
A number of program modules may be stored on the hard disk, magnetic disk 29, optical disk 31, ROM 24 or RAM 25, including an operating system 35, one or more application programs 36, other program modules 37 and program data 38. A user may enter commands and information into the personal computer 20 through input devices such as a keyboard 40 and pointing device 42. Other input devices (not shown) may include a microphone, joystick, game pad, satellite disk, scanner or the like. These and other input devices are often connected to the processing unit 21 through a serial port interface 46 that is coupled to the system bus, but may be connected by other interfaces, such as a parallel port, game port or universal serial bus (USB). A monitor 47 or other type of display device is also connected to the system bus 23 via an interface, such as a video adapter 48. In addition to the monitor 47, personal computers typically include other peripheral output devices (not shown), such as speakers and printers. The exemplary system of
The personal computer 20 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 49. The remote computer 49 may be another personal computer, 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 personal computer 20, although only a memory storage device 50 has been illustrated in
When used in a LAN networking environment, the personal computer 20 is connected to the LAN 51 through a network interface or adapter 53. When used in a WAN networking environment, the personal computer 20 typically includes a modem 54 or other means for establishing communications over the wide area network 52, such as the Internet. The modem 54, which may be internal or external, is connected to the system bus 23 via the serial port interface 46. In a networked environment, program modules depicted relative to the personal computer 20, or portions thereof, may be stored in the remote memory storage device. It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers may be used. Moreover, while it is envisioned that numerous embodiments of the present invention are particularly well-suited for computerized systems, nothing in this document is intended to limit the invention to such embodiments.
Referring next to
Referring next to
Referring first to the first step 220 of
A typical situation in which it may be desirable to convert a single file into a template involves an item in MICROSOFT VISUAL STUDIO®, or comparable IDEs. Many IDEs have items or their equivalent. An item is a file that contains information such as code that accomplishes some discrete unit of functionality. In general, if a template is to be created from an item, it may be desirable to restrict the number of files in a group to one.
Project templates and item templates are both comprised of a single metadata file (e.g., .VSTEMPLATE metadata file) and the constituent file(s) for the project or item. These files are grouped into a single file such as a .zip file, for example. The metadata file is the main component of the template. It contains all of the metadata for how the template appears in the user interface such as the New Project dialog in MICROSOFT VISUAL STUDIO®, for example.
Template metadata file which contains metadata about the template. Project file. The project is a working project which contains items as they will appear in the instantiated project. Project Item files Optional icon file for display in the user interface The above files are grouped into a single file such as a .zip file, for example. The format for an item/file template is as follows:
The above files are grouped into a single file such as a .zip file, for example. The template metadata file is authored in a declarative programming language such as Extensible Markup Language (XML), for example. The template metadata file describes the content and creation process for the template. It comprises two main sections:
The following is an example of a metadata file written in XML following the format above for a console application written in the CSharp programming language:
Copyright© Microsoft Corp
The following is an example of a metadata file written in XML following the format above for a form written in the CSharp programming language:
Copyright© Microsoft Corp
Although it is not required to have the metadata file in XML, there are several advantages to having the metadatafile coded in XML or a similar language. XML provides XML Schema Definition (XSD) which is a way to describe and validate data in an XML environment. The XSD will be published to enable successful template authoring. Using XML helps to enable the template file format to be intuitive and easy to understand. Also, users are able to take existing templates shipped with an IDE program and customize them as desired to suit their needs. Templates in different formats, from previous versions of an IDE, for example, may continue to work without requiring modification.
In creating a template, there are any number of ways to associate a plurality of files, such as those of a project or item, in step 220. Various embodiments may allow a user to package the project or item as a ZIP file, which is a widely available compressed file format. Other ways to associate multiple files comprise placing them in a single folder, naming them with a common identifying string, and so forth. When a group is formed using the method of “ZIP”ing the various files of the group into a single ZIP file, it may be preferable in various embodiments to use a single ZIP file as an umbrella for all files that are to be converted to a template.
Referring next to the second step 221 of
Embodiments of the invention allow the user to take the first two steps 220 and 221, while an automated process can take the final step 222.
Referring to
Referring back to
As alluded to above, the template engine processes associated with step can be performed in response to an indication that a group is to be used as a template, as in step 221. For example, in embodiments where users can optionally create templates by placing a group on disk in one or more directories for user-added templates, the actions of indexing group content and placing the generated template in a UI accessible location may be taken in response to placement of a group in the directory location. In these embodiments, a user may simply save an existing project, for example, in a ZIP format and place the ZIP file on disk in a correct directory location. The ZIP file can be automatically picked up by the template engine, indexed, extracted into loose files for processing and exposed along with a metadata file as a template in the appropriate location for accessing templates. Such an appropriate location may be, for example, a location that is accessible by a “new project” dialog process which offers users a selection of templates to use in creating a new file or group of files. The location may also be considered appropriate if accessible by any other UI process, such as a “new website” dialog and/or an “add new item” dialog.
Starting with
An IDE may search certain specified directories for (1) Standard vendor provided or approved templates and (2) User templates. Separate search logic may be applied to each subdirectory. For vendor provided or approved templates, a first directory path may lead to the UI accessible location where the templates are stored, and the directory locations for vendor-provided templates may be not modifiable. For user added templates, a second directory path may lead to the UI accessible location where the templates are stored, and that location may be modifiable.
Once a new user-added group is detected, the template engine can proceed to create a template using the group content. The creation of a template from an existing file or files can entail identifying elements of the file(s) that are desirable to generalize, then indexing the file by determining all the occurrences of the identified elements. For example, it is generally useful to generalize the name of a file. Users do not want to name all files using the same name. Instead, a generic name identifier may be inserted into a template, and the user may be prompted to enter a new file name when creating a file from the template. If there are multiple locations in the file where the name is referenced, the processes that create a file from a template can find these locations—because they are indicated by a parameter and the file is marked for parameter replacement in the metadata file which drives the template engine—and insert the appropriate string—here, the name—into the parametrized locations locations. The appropriate string may be one that is entered by a user into a template dialog. A metadata file is used in conjunction with an indexed file to supply the identifications of the generalized elements. A UI process can reference the metadata file to prompt users to enter values for the generalized elements.
Returning to
Where no metadata is associated with a group, the template engine may instead proceed to create a metadata file for the group 442. The metadata file may be a skeleton metadata file in a file format such as a .VSTEMPLATE file in VISUAL STUDIO®. The properties of the created metadata file may be based on the project, item, or other file that is being converted to a template. A set of inference rules regarding the elements that should be generalized and indexed may be used. These inference rules can be configured to accomplish a level of generalization that is most likely to provide useful gains to users of the output template. If too many elements of the group are generalized, the usefulness of the template may be reduced due the need to provide excessive customization each time the template is used. On the other hand, if too few elements are generalized, the usefulness of the template may be reduced due the absence of automated features. Also, note that it may be difficult or impossible to accurately generalize many elements using inference rules. Some files may use unconventional element identifiers and thus be difficult to convert to a template without tailored metadata. However, many files use predictable element identifiers, and can thus be indexed according to a set of standardized inference rules.
The following exemplary inference rules may be used to supply an appropriate set of metadata that can be used for indexing a group that corresponds to a project file. The invention is not limited to any particular set of inference rules, and the following are provided by way of useful example only:
Using the exemplary metadata above, the various files of a group may be indexed. Standard parameter substitution strings may be used in any file in the template. For instance, a typical replacement is to name the namespace in a C# or Visual Basic project with the same name as the project, e.g., “namespace ConsoleApplication1”. The “project” name, as that term is used in the context of VISUAL STUDIO® comes from the user input in the dialog when the project is being created from a template. Other common replacements include an item name, again, in the context of VISUAL STUDIO®, a date, a time, a common language runtime version, and so forth.
The following is an example of a metadata file in Extensible Markup Language (XML) that is created using the inference rules set forth above:
Copyright© Microsoft Corp
The <TemplateData> section of the template will determine how the project appears in the New Project dialog. The following key attributes are examples of those that can be customized: placement under certain language/subcategory, sort order in the user interface dialog, whether the project should be created in its own folder, and other functions. Note that in the above example, the <TemplateData> section is rather sparse. Templates that are generated without any direction from the user may be supplied with a number of default properties, based on likely desires of a user. For instance, a CreateNewFolder property, which may determine whether a project is created in its own folder, may be automatically set to true. This property is used by 90% of project templates, and therefore supplying it as a default property may provide time savings for a user. Also, by customizing tags in the metadata file, the author can customize, for example: what files are in the template, whether a file is opened on template creation, whether, for item templates, any binary references should be added so that the item can build correctly, whether the parameter replacement function should run over the file (if the file has some parameters within it that should be replaced).
A list of other exemplary defaults, in the contexts of project templates and item templates, that may be used in conjunction with the other systems an methods herein is provided in Appendix A and Appendix B.
After indexing a group, such as a project file group, according to metadata that supplies a standard set of inference rules, as set forth above, the completed template can be placed in a UI accessible location for later access and use by a user 444. The reason for adding the template to a UI accessible location is practical, and not required for all embodiments of the invention. In general, users prefer classifying templates in a single location or a small set of locations. That way, templates can be quickly referenced when new file is desired, a determination of a suitable template can be made, and a new file can be instantiated by selecting an appropriate template. If templates are stored individually, the selection of an appropriate template may become more tedious. Various embodiments may display the newly created template in a UI accessible location, such as one identified with opening a new project, a new item, and/or a new file. In a common arrangement, these locations are accessible to dialog processes, i.e., user interface (UI) windows that open when a user indicates a desire to open a new entity (such as a file, project, or item).
Referring next to
For parameter replacement 610, the template supports parameter substitution to enable replacement of key parameters such as class names, namespaces, etc. on template instantiation. If the <ReplaceParameters> tag is true on any artifact in a template, the template engine will perform parameter substitution. For example, the format for parameters is $[parameter]$. Following are examples according to this format: $safeprojectname$ $safeclassname$ $guid1$ $guid5$. The library of available parameter replacement options is provided in appendix C. This library may be user-extensible. In one embodiment according to the library provided in appendix C, replacement parameters are case-sensitive.
Once parameter replacement 610 has completed, the template files are opened 615 and any custom code inserted into the metadata file is ran 620 such that a project is set up for the user as the user desired it to be created via the template.
Referring next to
The simplified structure of the templates makes it easy for users to modify them at will. The modification may include, for example, inserting custom code so that the user can set up certain code blocks and putting comments or files inside existing templates which they use frequently and which are more useful if tailored to individual needs. Templates may also be stored in one or more specified locations for easy access by users. Also, a differentiation may be made between user-created templates and pre-defined templates that may come with a software package or IDE that are modifiable by a user. The user-created templates and the pre-defined templates may be stored in different locations defined for that type of template. This is reflected in the UI for selection of templates such as in
The user may also customize the appearance of the UI for selection of the templates by adding folder structures under a top-level language node. This is handy for organization when a user has many templates.
In addition, the designation and search of a user-specifiable set of directories for template content is included. This is extremely useful for adding new templates. Users can access these directories without requiring admin or power user privileges which are required to access the Program Files directory in the MICROSOFT WINDOWS® operating system. For example, the default directory path in VISUAL STUDIO® for user-added templates is:
The location for picking up these templates may also be customized by users to point at any location. This can be user-specific for individual user customizations or to point at a single share for a team, allowing a team to share a block of templates together and commonly leverage a set of template components. An example showing how customization of template locations is implemented in the UI for VISUAL STUDIO® is provided in
The various systems, methods, and techniques described herein may be implemented with hardware or software or, where appropriate, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable storage medium, wherein, when the program code is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention. In the case of program code execution on programmable computers, the computer will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. One or more programs are preferably implemented in a high level procedural or object oriented programming language to communicate with a computer system. However, the program(s) can be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language, and combined with hardware implementations.
The methods and apparatus of the present invention may also be embodied in the form of program code that is transmitted over some transmission medium, such as over electrical wiring or cabling, through fiber optics, or via any other form of transmission, wherein, when the program code is received and loaded into and executed by a machine, such as an EPROM, a gate array, a programmable logic device (PLD), a client computer, a video recorder or the like, the machine becomes an apparatus for practicing the invention. When implemented on a general-purpose processor, the program code combines with the processor to provide a unique apparatus that operates to perform the indexing functionality of the present invention.
While the present invention has been described in connection with the preferred embodiments of the various figures, it is to be understood that other similar embodiments may be used or modifications and additions may be made to the described embodiment for performing the same function of the present invention without deviating there from. For example, while exemplary embodiments of the invention are described in the context of digital devices emulating the functionality of personal computers, one skilled in the art will recognize that the present invention is not limited to such digital devices, as described in the present application may apply to any number of existing or emerging computing devices or environments, such as a gaming console, handheld computer, portable computer, etc. whether wired or wireless, and may be applied to any number of such computing devices connected via a communications network, and interacting across the network. Furthermore, it should be emphasized that a variety of computer platforms, including handheld device operating systems and other application specific hardware/software interface systems, are herein contemplated, especially as the number of wireless networked devices continues to proliferate. Therefore, the present invention should not be limited to any single embodiment, but rather construed in breadth and scope in accordance with the appended claims.
Finally, the disclosed embodiments described herein may be adapted for use in other processor architectures, computer-based systems, or system virtualizations, and such embodiments are expressly anticipated by the disclosures made herein and, thus, the present invention should not be limited to specific embodiments described herein but instead construed most broadly. Likewise, the use of synthetic instructions for purposes other than processor virtualization are also anticipated by the disclosures made herein, and any such utilization of synthetic instructions in contexts other than processor virtualization should be most broadly read into the disclosures made herein.
Copyright© Microsoft Corp
Copyright© Microsoft Corp
Copyright© Microsoft Corp
This application is related to the following commonly-assigned patent application, the entire contents of which are hereby incorporated in this present application by reference: U.S. patent application Ser. No. 10/961,753, entitled “SYSTEMS AND METHODS FOR CREATING A TEMPLATE FROM AN EXISTING FILE”, filed Oct. 8, 2004. This application is related to the following commonly-assigned patent application: U.S. patent application Ser. No. ______, entitled “SYSTEMS AND METHODS FOR CREATING A TEMPLATE FROM AN EXISTING FILE”, filed Jan. 14, 2005.