An introduction to the idea of an object in object-oriented programming, part 1

Object-oriented programming is a computing paradigm implemented in widely used languages like Java and C#. It is often described colloquially in terms of the following intuitively plausible ideas: 1) that the most basic beings in the universe are particular objects, 2) that objects belong to kinds, mathematically represented as classes, and 3) that objects have states and behavior, which are represented mathematically by fields and methods.

States and behavior can only belong to things, which themselves belong – in a different sense – to kinds. To enforce this, object-oriented programming requires fields and methods for kinds of objects to be attached to an associated class. This is usually achieved by placing the code for the methods and fields an object of a given class may have within brackets {} that give the code for the class as a whole. When this happens, fields and methods are said to be encapsulated in their class.

Since objects belonging to one class can belong to a second class by virtue of belonging to the first, as e.g. whatever is a chihuahua is thereby a dog, objects in one class are able to inherit the behavior of other classes – if there are any behaviors or characteristics that all dogs have in common, chihuahuas will also have them.

The principles specifying the above general ideas in ways appropriate for programming languages are called encapsulation and inheritance and these are two of the basic principles of every object-oriented programming language.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s