What are templates? The word template can conjure up many things for different people. For some it is a word processor and for others it is a form of artwork, while for some still it is something to be remembered as a past time. If we want to classify templates as something that can be classified under the broad categories of art, literature, and music then we must first explain what it is and how it came into existence.
A template is a unit of work which has a generic appearance and which can be reused for the purpose of re-use or for another similar application. The term template was probably first used by the great philosopher Aristotle. He put forward the theory of intension which was to do with the arrangement of things. According to this view a template is a device with fixed measures or standards by means of which we can arrange an object so that it can have its end result when we re-arrange it again.
In our modern times the term template has a much wider meaning than it did in Aristotle’s time. Now it refers not only to the devices with fixed standards and measurements but also to a set of practices, rules and technology by which objects of different types and purposes can be produced more rapidly and efficiently. In simple terms we can say that templates are the methods for arranging material so that it can be used for a variety of purposes and then be returned to its original state as soon as the work has been completed. We can call it a template if the end result of the production does not vary when we reuse it or re-arrange it.
In general the source code of templates is stored in a file called TEMPLOC. It consists of a series of generic instructions which tell the template engine how to configure the template and its associated features. A typical scenario would be that the developer uses the designer tab in an application to create a standard template. Then he uses the designer tab in the same program to specify the necessary parameters, click on ‘apply’ and then finally enters the order info (in the form of an int) into the text box.
The above example shows how easy it is to use templates. The developer can specify the desired parameters, click on ‘OK’ and then simply copy and paste the required information into the Int main window. The Int main process then lets the template do the rest of the work. It converts the int requested by the developer into a suitable format and assigns it to a variable of type int. After this the template returns the desired output. In other words it produces a standard outcome which can be used and then manipulated according to the needs of the situation.
The above example can be seen as a clear illustration of the general utility of templates. They are not just a set of guidelines for creating applications but they can be used for handling complex problems too. Moreover, templates can be used directly within an application or they can be used as part of a library of templates which can be easily accessed from a web browser. Templates may be both written and compiled.