Instantiate

Why Trust Techopedia

What Does Instantiate Mean?

Instantiate (a verb) and instantiation (the noun) in computer science refer to the creation of an object (or an “instance” of a given class) in an object-oriented programming (OOP) language. Referencing a class declaration, an instantiated object is named and created, in memory or on disk. Resources are allocated for it, it gains a place in the general codebase as a whole and it fills a role in what the programmers are constructing. It also is delineated or identified with its own attributes.

Advertisements

Object instantiation uses various methods and terminology in different programming environments: For example, in C++ and similar languages, to instantiate a class is to create an object, whereas in Java, to instantiate a class creates a specific class. The results in both languages are the same (executable files) but the path to getting there is a bit different.

Tech professionals might talk about instantiation a bit differently, depending on the environments they are using, as well as the protocols and methods they use in working with active classes to create objects. For instance, instantiating a virtual server refers to the virtualization of the predefined properties (disk space, allocated RAM, type of operating system, installed software) of each server.

In general terms, to “instantiate” an object just means to create it, again, as an instance of a class. But there are technical aspects to how this is done. The terminology can be confusing. The connection of “instantiate” to “instance” helps, but for those who do not practically work on OOP, the jargon might still seem pretty opaque. The key is to fully understand what a class is, what an object is and how the two are different, as well as how an object works in code, what it holds and what it means to create an object.

An Instantiation is also known as an instance.

Techopedia Explains Instantiate

To explain the process to those who might not be familiar with the details of this kind of programming, some might use examples of class indicators to show how object instantiation works. If the class, for example, is “human,” then the object is “instantiated” in the form of a new person (a new instance of a human) when the new “baby” is born. The application of a name or other attribute to the baby would be the initialization, in the form of creating the variable value.

This example also addresses one of the confusing parts of terminology around these processes: Instantiation is often confused with the process of initialization, or the work of assigning variables to an object.

One of the simplest ways to explain this difference is that objects are instantiated, while variables are initialized. It is also important to note that objects are instantiated as an instance of a particular class, and that the instantiation takes place with specific tasks like the allocation of memory, as explained above.

Another way to explain this is that after an object has been instantiated, it can be initialized by assigning it a variable, which is where the programmer assigns value (or “contents”) to the object. For example, the use of the word dimension or “dimming” is a practice of initializing the variable in code.

Can object instantiations and initialization take place together? The following two sentences from a Java operator manual are an excellent example showing that they can:

“The new keyword is a Java operator that creates the object – the new operator is followed by a call to a constructor which initializes the new object.”

Thus, when the instantiation and initiation commands are colocated, the two procedures to take place together.

Another way to distinguish the process of instantiation is to contrast it with the practice of declaration, which specifies properties of variables and classes, but not objects. With a declaration, the programmer notifies the compiler of these properties (or uses an alternative method such as an interpreter). As experts point out, declarations do not instantiate objects.

Although it may seem like a small detail, the practice of instantiation is one of the most fascinating parts of OOP to some newcomers, given how objects and components are created “ex nihilo” in the construction of forms, code modules and assorted digital frameworks that accomplish application functionality. Understanding instantiation also gives the user a better knowledge of the object in the codebase in general, helping to clarify the relationship between things such as classes, objects, variables and functions.

Advertisements

Related Terms

Margaret Rouse
Editor

Margaret jest nagradzaną technical writerką, nauczycielką i wykładowczynią. Jest znana z tego, że potrafi w prostych słowach pzybliżyć złożone pojęcia techniczne słuchaczom ze świata biznesu. Od dwudziestu lat jej definicje pojęć z dziedziny IT są publikowane przez Que w encyklopedii terminów technologicznych, a także cytowane w artykułach ukazujących się w New York Times, w magazynie Time, USA Today, ZDNet, a także w magazynach PC i Discovery. Margaret dołączyła do zespołu Techopedii w roku 2011. Margaret lubi pomagać znaleźć wspólny język specjalistom ze świata biznesu i IT. W swojej pracy, jak sama mówi, buduje mosty między tymi dwiema domenami, w ten…