What makes generic programming attractive to students and programming beginners is its simplicity. It is better in the sense that one need not to explicitly declare or make known the attributes of the manipulated objects from the very beginning.
What Exactly Is Generic Programming?
Technicalities aside first, generic programming is defined in its simplest sense as the type of programming that enables the programmer to write general algorithms or make general programming templates instead of specific scripts and codes. Generic coding helps in keeping the details in places where they are the most relevant.
What Are The Most Basic Terms?
For those who want to start lessons about generic programming, it’s best that you start familiarizing with the jargon terms and technical words before proceeding with the substantive lessons.
An argument is information contained and passed using a parameter.
The concept is a set of abstractions (also types) wherein some set of requirements usually determines membership.
The container class is the most simple example of generic programming. They are like arrays, maps, or lists that contain a collection of objects. Template containers are those that hold integers, floats, and other types of information.
A function is a type of computer or programming procedure or routine. In some programming cases, a function is a sequence which returns a value or a definite result while a procedure performs or runs an operation (the process itself) but does not necessarily give an output or a value.
The concept of instance is the particular or specific realization of an object in object-oriented programming. It is the realized variation of an object. The creation of instance is the instantiation. Whenever a program runs, then it is an instance of the said program.
This concept is the creation of an instance or the making of a specific realization of an abstraction, object, or a template (such as a computer process, or a class of objects)
Some people also call iterators as design patterns that iterate over contents of a container class. This concept is an instance of a class that maps out or points to a member of the said container. You create an iterator (say i) to traverse through the list or the template. An advantage of iterators is that they provide a way (a unified way to be exact) to obtain access on the members of a container class. It is independent of how programmers can implement the said container.
In programming, a model is a particular style of programming. It is also commonly defined as a set of instructions to be implemented in different ways to achieve the desired result.
This is a programming language that is organized to focus on objects and data and not on actions or logic.
A parameter is a variable which is used to contain information and pass such to functions and procedures.
The language’s ability to perform procedures (or process) on objects in a variety of ways based on their data type, structure, or class.
The template is the basis, guide, or pattern used for unique units of the code. Programming libraries contain templates that a programmer can modify.
Generic programming generally allows the programmer to write algorithms that are expected to work on containers even with different data types. As mentioned, this type of programming doesn’t require you to declare right away the objects you need to implement or manipulate directly.
The above terms should serve as your basic guide before delving deeper into the world of generic programming. First lessons should not be hard if one will start finding the meaning of these terms to learn the basics of such programming flawlessly and without any further hindrance. There are simple examples and exercises to which one can already start working on even knowing only the basic idea, concept and terminologies of generic programming.