At WiseGEEK, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.
In computer science, an object type is any item in a computer program that can be altered or changed in some way by the computer program. Object types are a subclass of data types. Data types simply refer to the type of information represented by each item. An object type often has a specific set of attributes that can be changed to different values. In object-oriented programming, an object type refers to a specific item built from a class — the set of rules that acts as guidelines for building new objects.
To envision an object, it's best to imagine building a house. Computer programming languages, such as the Java or C++, are the tools used to build the house. A set of rules and guidelines, often known as a class, show what types of houses can be built from a program. Object types are like these metaphorical houses.
If a programmer wants to build a house with two doors and two windows, he can input those values and create an object. This new object follows the rules set out by its class, but looks at the computer program's specifications for its characteristics such as number of doors and windows. A second programmer might build an object from the same class but set a different number of doors and windows.
The house metaphor translates into the virtual world of computer programming because an object type must follow certain guidelines to function, just as a house must be assembled according to a blueprint. Object-oriented programming relies heavily on object types to create new programs while using the smallest amount of required code. This lowers the chance of errors in the code and speeds up the process of creating a program from scratch.
Using objects in object-oriented programming has a distinct advantage over other programming types. The guidelines for each object are already determined. All the programmer has to do is decide what object type he wishes to use and then set any special attributes he wants that object type to have.
Object types are the key to making any computer program run. Each one serves a specific function, such as retrieving data from a server or reacting to input typed by the user, and creating multiple objects that work together is what makes a piece of software run. The computer programmer must understand how the object works and what variables to assign it. Then the program code can run behind the scenes while the user can use an easy-to-understand interface to interact with the program.