Meaning of Object in Computer Languages

By Xah Lee. Date: . Last updated: .

object! you hear it about in every lang, every lang's docs. Though, their nature is quite different.

Java's Concept of Class/Object

Java, is a tight pant. The whole language is encased in class/object model. In fact, except some primitive types such as int, float, everything in the lang is a class. In fact, the entire lang, what Sun Micro scum called API/Platform, is a giant class tree. In Java, the class/object thing has a rather definite meaning. A Class is kinda like a factory, from which spring objects. To do things in Java, first you create a factory to spawn the object things. Class/Object in Java, we might say is the classic.

In Java, “Object” refers to a instance of a class.

Also, “Object” (java.lang.Object) is root class of all classes. (

“class” is is a language keyword. (for code example, see: Java Tutorial: The “extends” Keyword.)

“class” also refers to the datatype created by a constructor with keyword “class”.

here's a quote from Java lang spec to taste:

The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types (§4.2) are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types (§4.3) are class types, interface types, and array types. There is also a special null type. An object (§4.3.1) is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object (§4.3.2). String literals are represented by String objects (§4.3.3).

note: when you try to parse that sentence, it's confounding and ambiguous.

Python's Concept of Class/Object

Now, python, is also OOP. However, its concept of class/object is very different from Java. But in python, “object” and “language data type” means about the same thing.

In python, most values, is a “object”. A string is object. A list is object. Hash table is object. And they all have methods. In contrast to Java, there's not much sense of “class” in the language, but it has “object”, defined as a language data type.

here's a quote from python doc 3. Data model — Python v3.3.3 documentation:

Objects are Python's abstraction for data. All data in a Python program is represented by objects or by relations between objects. (In a sense, and in conformance to Von Neumann's model of a “stored program computer,” code is also represented by objects.)

Every object has an identity, a type and a value. An object's identity never changes once it has been created; you may think of it as the object's address in memory. The ‘is‘ operator compares the identity of two objects; the id() function returns an integer representing its identity.

An object's type determines the operations that the object supports (e.g., “does it have a length?”) and also defines the possible values for objects of that type. The type() function returns an object's type (which is an object itself). Like its identity, an object's type is also unchangeable. [1]

Python's class/object is almost the reverse of Java's class/object. In python, object is the class. Object is a language data type. “Class” is a convenient programer term.

Although almost every value in python is object, but you don't really have to do OOP. For example, you can translate the entirety of shell scripts on earth to python, sans a iota of oop. In fact python is often used for sys admin, as perl.

Though, python the lang is heavily “object” tied, and you have to buy it in order to live in it. Its doc, its data types, all talk and revolve about objects. God forbid you don't think of objects.

Lisp Object

in lisp, you also have object. Though, here, the “object” isn't any object of OOP. In lisp, “object” basically means the internal representation of your lisp expression.

here's a quote from emacs lisp manual:

A Lisp “object” is a piece of data used and manipulated by Lisp programs. For our purposes, a “type” or “data type” is a set of possible objects.

(info "(elisp) Lisp Data Types")

[see Xah Emacs Lisp Tutorial]

JavaScript Object

in JavaScript, almost everything is also a object. [see What's Object in JavaScript?] However, js object is nothing like Java/python, nor as lisp's internal entity.

JavaScript object is basically a hash table, by definition. So, in sharp contrast to java, js in fact do not have any class at all. But also, in sharp contrast to python, even though everything is a “object” in both languages, yet JavaScript's object has almost nothing to do with OOP. What oop it has, is mostly created by people, as libraries.

Node.js Object

In node.js, its “object” is used mostly as a namespace mechanism. See: Object Oriented Programing: is Object Data or Namespace?

C Language Object

here's what Nick Alcock says about C:

C has objects too, pretty much denoting “a thing in memory which can have a value, or whose components can have values”. (Thus, a bitfield is an object, even though you can't take the address of it; a string constant is an object even though you can't modify it, and even though it's an array; a function is not an object, even though you can take its address.)

This is a rather ad-hoc definition mostly used to declare in the standard that certain things can be done to objects that cannot be done to anything else (such as freely casting pointers to them to void *, which you can do to an array, but not to a function pointer, since that's not an object).

However, note that this terminology postdates OOP: nobody was talking about “objects' when C was young. So this, like ‘const’”, is actually terminological leakage back from OOP languages (mostly C++, which was already several years old when the C standardization effort began) into C.

The Point of Confoundedness

one might ask, what's the point?

it's confounding❕

g+ discussion:

Thanks to Dan Lentz on correction on Java's Object terminology.

Ask me question on patreon