An object , also in object-oriented programming (OOP), is an abstract data type that is created by a developer. This can include multiple properties and methods, even other objects. In most programming languages , objects are defined by classes.

Objects provides a structured approach to programming. As a custom object to define a dataset, a developer easily creates multiple similar objects and simultaneously modifies existing objects into a program. In addition, objects provide ” encapsulation ,” meaning data is protected in one object by modifying or destroying other functions or methods, unless they have been explicitly allowed.

An easy example is an object in which a user account is created for a website. In this case, the object can be defined as class user-account and contains attributes such as:

  • first name
  • last name
  • email address
  • password
  • age
  • location
  • photo

Instead of recreating all these properties for each new user account, a web script can simply be instantiated by a userAccount object. Data that is assigned to the object can be stored in a database if the user account is saved.

A more advanced example is an object, which is a character in a video game. The character has some standard attributes, such as a name, hitpoints, and movement speed. At the same time it can also include other objects, such as weapons, armor, items, etc. In such a case, the character is actually a ” parent object ” and the objects in it are all child objects.

Both parent and child objects have their own properties and methods. For example, the character can have many methods such as “move” and “attack.” The “attack” command can be a reference to a “weapon” object, which has its own methods, such as “swing” or “thrust.”

While objects are normally associated with object-oriented programming, if we look at the basis of general computer science terminology, then an object refers to a single programming element, such as a variable, constant, function, or method.

« Back to Wiki Index