32:48

Object-Oriented Programming

by Benjamin Boster

Rated
4.7
Type
talks
Activity
Meditation
Suitable for
Everyone
Plays
7.6k

In this episode of the I Can't Sleep Podcast, learn about object-oriented programming. We'll explore all sorts of boring things like objects and classes, encapsulation, and polymorphism. You're bound to drift off within minutes on this one. Happy sleeping!

SleepProgrammingEncapsulationPolymorphismObject Oriented ProgrammingInheritanceDynamic DispatchModular ProgrammingClass Based ProgrammingPrototype Based ProgrammingHistory Of OopCompositions

Transcript

Welcome to the I Can't Sleep podcast,

Where I read random articles from across the web to bore you to sleep with my soothing voice.

I'm your host,

Benjamin Bostor.

This episode is from a Wikipedia article titled Object Oriented Programming,

Recommended by Diogo Orkowski.

Object Oriented Programming,

OOP,

Is a programming paradigm based on the concept of objects,

Which can contain data and code.

Data in the form of fields,

Often known as attributes or properties,

And code in the form of procedures,

Often known as methods.

A feature of objects is that an object's own procedures can access and often modify the data fields of itself.

Objects have a notion of this or self.

In OOP,

Computer programs are designed by making them out of objects that interact with one another.

OOP languages are diverse,

But the most popular ones are class-based,

Meaning that objects are instances of classes,

Which also determine their types.

Many of the most widely used programming languages,

Such as C++,

Java,

Python,

Etc.

,

Are multi-paradigm,

And they support object-oriented programming to a greater or lesser degree,

Typically in combination with imperative procedural programming.

Significant object-oriented languages include Java,

C++,

C-sharp,

Python,

R,

PHP,

VisualBasic.

Net,

JavaScript,

Ruby,

Perl,

ObjectPascal,

Objective-C,

Dart,

Swift,

Scala,

Kotlin,

Common Lisp,

Matlab,

And Smalltalk.

Features Object-oriented programming uses objects,

But not all of the associated techniques and structures are supported directly in languages that claim to support OOP.

The features listed below are common among languages considered to be strongly class- and object-oriented,

Or multi-paradigm with OOP support,

With notable exceptions mentioned.

Shared with non-OOP languages,

Variables that can store information formatted in a small number of built-in data types,

Like integers and alphanumeric characters.

This may include data structures like strings,

Lists,

And hash tables that are either built-in or result from combining variables using memory pointers.

Procedures,

Also known as functions,

Methods,

Routines,

Or subroutines,

That take input,

Generate output,

And manipulate data.

Modern languages include structured programming constructs like loops and conditionals.

Modular programming support provides the ability to group procedures into files and modules for organizational purposes.

Modules are namespaced,

So identifiers in one module will not conflict with a procedure or variable sharing the same name in another file or module.

Objects and Classes Languages that support object-oriented programming OOP typically use inheritance for code reuse and extensibility in the form of either classes or prototypes.

Those that use classes support two main concepts.

Classes,

The definitions for the data format and available procedures for a given type or class of object,

May also contain data and procedures known as class methods themselves,

I.

E.

Classes contain the data members and member functions.

Objects Instances of Classes Objects sometimes correspond to things found in the real world.

For example,

A graphics program may have objects such as circle,

Square,

Menu.

An online shopping system might have objects such as shopping cart,

Customer,

And product.

Sometimes objects represent more abstract entities like an object that represents an open file or an object that provides the service of translating measurements from U.

S.

Customary to metric.

Object-oriented programming is more than just classes and objects.

It's a whole programming paradigm based around objects,

Data structures,

That contain data fields and methods.

It is essential to understand this.

Using classes to organize a bunch of unrelated methods together is not object orientation.

Junade Ali Mastering PHP Design Patterns Each object is said to be an instance of a particular class.

For example,

An object with its name field set to Mary might be an instance of class employee.

Procedures in object-oriented programming are known as methods.

Variables are also known as fields,

Members,

Attributes,

Or properties.

This leads to the following terms,

Class variables.

Belong to the class as a whole,

There is only one copy of each one.

Instance variables or attributes.

Data that belongs to individual objects,

Every object has its own copy of each one.

Number variables refers to both the class and instance variables that are defined by a particular class.

Class methods belong to the class as a whole and have access only to class variables and inputs from the procedure call.

Instance methods belong to individual objects and have access to instance variables for the specific object they are called on,

Inputs,

And class variables.

Objects are accessed somewhat like variables with complex internal structure,

And in many languages are effectively pointers,

Serving as actual references to a single instance of said object in memory within a heap or stack.

They provide a layer of abstraction which can be used to separate internal from external code.

External code can use an object by calling a specific instance method with a certain set of input parameters,

Read an instance variable,

Or write to an instance variable.

Objects are created by calling a special type of method in the class known as constructor.

A program may create many instances of the same class as it runs,

Which operate independently.

This is an easy way for the same procedures to be used on different sets of data.

Object-oriented programming that uses classes is sometimes called class-based programming,

While prototype-based programming does not typically use classes.

As a result,

Significantly different yet analogous terminology is used to define the concepts of object and instance.

In some languages,

Classes and objects can be composed using other concepts like traits and mixins.

Class-based versus prototype-based.

In class-based languages,

The classes are defined beforehand,

And the objects are instantiated based on the classes.

If two objects,

Apple and orange,

Are instantiated from the class fruit,

They are inherently fruits,

And it is guaranteed that you may handle them in the same way,

E.

G.

A programmer can expect the existence of the same attribute such as color or sugar underscore content or is underscore ripe.

In the prototype-based languages,

The objects are the primary entities.

No classes even exist.

The prototype of an object is just another object in which the object is linked.

Every object has one prototype link,

And only one.

New objects can be created based on already existing objects chosen as their prototype.

You may call two different objects,

Apple and orange,

A fruit if the object fruit exists,

And both apple and orange have fruit as their prototype.

The idea of the fruit class doesn't exist explicitly,

But as the equivalence class of the objects sharing the same prototype.

The attributes and methods of the prototype are delegated to all the objects of the equivalence class defined by this prototype.

The attributes and methods owned individually by the object may not be shared by other objects of the same equivalence class,

E.

G.

The attribute sugar underscore content may be unexpectedly not present in apple.

Only single inheritance can be implemented through the prototype.

Dynamic dispatch message passing.

It is a responsibility of the object,

Not any external code,

To select the procedural code to execute in response to a method call,

Typically by looking up the method at runtime in a table associated with the object.

This feature is known as dynamic dispatch and distinguishes an object from an abstract data type or module,

Which has a fixed static implementation of the operations for all instances.

If the call variability relies on more than the single type of the object on which it is called,

I.

E.

At least one other parameter object is involved in the method choice,

One speaks of multiple dispatch.

A method call is also known as message passing.

It is conceptualized as a message,

The name of the method and its input parameters being passed to the object for dispatch.

Encapsulation.

Encapsulation is an object-oriented programming concept that binds together the data and functions that manipulate the data,

And that keeps both safe from outside interference and misuse.

Data encapsulation led to the important OOP concept of data hiding.

If a class does not allow calling code to access internal object data and permits access through methods only,

This is a strong form of abstraction or information hiding known as encapsulation.

Some languages,

Java for example,

Let classes enforce access restrictions explicitly,

For example denoting internal data from the private keyword and designating methods intended for use by a code outside the class with the public keyword.

Methods may also be designed public,

Private,

Or intermediate levels,

Such as protected,

Which allows access from the same class and its subclasses,

But not objects of a different class.

In other languages like Python,

This is enforced only by convention.

For example,

Private methods may have names that start with an underscore.

Encapsulation prevents external code from being concerned with the internal workings of an object.

This facilitates code refactoring,

For example allowing the author of the class to change how objects of that class represent their data internally without changing any external code,

As long as public method calls work the same way.

It also encourages programmers to put all the code that is concerned with a certain set of data in the same class,

Which organizes it for easy comprehension by other programmers.

Encapsulation is a technique that encourages decoupling.

Composition,

Inheritance,

And delegation.

Objects can contain other objects in their instance variables.

This is known as object composition.

For example,

An object in the employee class might contain either directly or through a pointer an object in the address class in addition to its own instance variables like first underscore name and position.

Object composition is used to represent has a relationships.

Every employee has an address,

So every employee object has access to a place to store an address object,

Either directly embedded within itself or at a separate location addressed via a pointer.

Languages that support classes almost always support inheritance.

This always classes to be arranged in a hierarchy that represents is a type of relationships.

For example,

Class employee might inherit from class person.

Also the data and methods available to the parent class also appear in the child class with the same names.

For example,

Class person might define variables first underscore name and last underscore name with method make underscore full underscore name.

These will also be available in class employee which might add the variables position and salary.

This technique allows easy reuse of the same procedures and data definitions in addition to potentially mirroring real world relationships in an intuitive way.

Rather than utilizing database tables and programming subroutines,

The developer utilizes objects the user may be more familiar with,

Objects from other application domain.

Subclasses can override the methods defined by superclasses.

Multiple inheritance is allowed in some languages,

Though this can make resolving overrides complicated.

Some languages have special support for mixins,

Though in any language with multiple inheritance,

A mixin is simply a class that does not represent and is a type of relationship.

Mixins are typically used to add the same methods to multiple classes.

For example,

Class unicode conversion mixin might provide a method unicode underscore to underscore ashy when included in class file reader and class web page scraper which don't share a common parent.

Abstract classes cannot be instantiated into objects,

They exist only for the purpose of inheritance into other concrete classes that can be instantiated.

In Java,

The final keyword can be used to prevent a class from being subclassed.

The doctrine of composition over inheritance advocates implementing has-a relationships using composition instead of inheritance.

For example,

Instead of inheriting from class person,

Class employee could give each employee object an internal person object,

Which then has the opportunity to hide from external code even if class person has many public attributes or methods.

Some languages like Go do not support inheritance at all.

The open-closed principle advocates that classes and functions should be open for extension but closed for modification.

Conversion is another language feature that can be used as an alternative to inheritance.

Polymorphism Subtyping,

A form of polymorphism,

Is when calling code can be agnostic as to which class in the supported hierarchy it is operating on,

The parent class or one of its descendants.

Meanwhile,

The same operation name among objects in an inheritance hierarchy may behave differently.

For example,

Objects of type circle and square are derived from a common class called shape.

The draw function for each type of shape implements what is necessary to draw itself,

While calling code can remain indifferent to the particular type of shape being drawn.

This is another type of abstraction that simplifies code external to the class hierarchy and enables strong separation of concerns.

Open recursion In languages that support open recursion,

Object methods can call other methods on the same object,

Including themselves.

Simply using a special variable or keyword called this or self.

This variable is late bound.

It allows a method defined in one class to invoke another method that is defined later,

And some subclass thereof.

History Terminology invoking objects and oriented in the modern sense of object oriented programming made its first appearance at MIT in the late 1950s and early 1960s.

In the environment of the artificial intelligence group as early as 1960,

Object could refer to identified items,

LISP atoms,

With properties attributes.

Alan Kay later cited a detailed understanding of LISP internals as a strong influence on his thinking in 1966.

I thought of objects being like biological cells and or individual computers on a network,

Only able to communicate with messages.

So messaging came at the very beginning,

Took a while to see how to do messaging in a programming language efficiently enough to be useful.

Alan Kay.

Another early MIT example was Sketchpad created by Ivan Sutherland in 1960 to 61.

In the glossary of the 1963 technical report based on his dissertation about Sketchpad,

Sutherland defined notions of object and instance with the class concept covered by master or definition,

Albeit specialized to graphical interaction.

Also an MIT ALGOL version,

AED-0,

Established a direct link between data structures,

Plexes in that dialect,

And procedures prefiguring what were later termed messages,

Methods,

And member functions.

In 1962,

Kristian Nygaard initiated a project for a simulation language of the Norwegian Computing Center based on his previous use of the Monte Carlo simulation and his work to conceptualize real-world systems.

Ole Johan Dahl formally joined the project and the Simula programming language was designed to run on the Universal Automatic Computer,

UNIVAC 1107.

Simula introduced important concepts that are today an essential part of object-oriented programming such as class and object,

Inheritance,

And dynamic binding.

Simula was also designed to take account of programming and data security.

For programming security purposes,

A detection process was implemented so that through reference counts a last resort garbage collector deleted unused objects in the random access memory RAM.

But although the idea of data objects had already been established by 1965,

Data encapsulation through levels of scope for variables such as private,

Minus,

And public,

Plus,

Were not implemented in Simula because it would have required the accessing procedures to be also hidden.

In the early stages,

Simula was supposed to be a procedure package for the programming language ALGOL 60.

Dissatisfied with the restrictions imposed by ALGOL,

The researchers decided to develop Simula into a fully-fledged programming language,

Which used the UNIVAC ALGOL 60 compiler.

Simula was promoted by Dahl and Nygaard throughout 1965 and 1966,

Leading to increasing use of the programming language in Sweden,

Germany,

And the Soviet Union.

In 1968,

The language became widely available through the Burroughs B5500 computers and was later also implemented in the Ural 16 computer.

In 1966,

Dahl and Nygaard wrote a Simula compiler.

They became preoccupied with putting into practice Tony Hoare's record class concept,

Which had been implemented in the free-form English-like general-purpose simulation language Simscript.

They settled for a generalized process concept with record class properties and a second layer of prefixes.

Through prefixing,

A process could reference its predecessor and have additional properties.

Simula thus introduced the class and subclass hierarchy and the possibility of generating objects from these classes.

A Simula 67 compiler was launched for the System 360 and System 370 IBM mainframe computers in 1972.

In the same year,

A Simula 67 compiler was launched free of charge for the French CII 10070 and CII Iris 80 mainframe computers.

By 1974,

The Association of Simula Users had members in 23 different countries.

Early 1975,

A Simula 67 compiler was released free of charge for the DEC System 10 mainframe family.

By August the same year,

The DEC System 10 Simula 67 compiler had been installed at 28 sites,

22 of them in North America.

The object-oriented Simula programming language was used mainly by researchers involved with physical modeling,

Such as models to study and improve the movement of ships and their content through cargo ports.

In the 1970s,

The first version of the Smalltalk programming language was developed at Xerox Park by Alan Kay,

Dan Ingalls,

And Adele Goldberg.

Smalltalk 72 included a programming environment and was dynamically typed and at first was interpreted not compiled.

Smalltalk became noted for its application of object orientation at the language level and its graphical development environment.

Smalltalk went through various versions and interest in the language grew.

While Smalltalk was influenced by the ideas introduced in Simula 67,

It was designed to be a fully dynamic system in which classes could be created and modified dynamically.

In the 1970s,

Smalltalk influenced the Lisp community to incorporate object-based techniques that were introduced to developers via the Lisp machine.

Experimentation with various extensions to Lisp,

Such as loops and flavors introducing multiple inheritance and mixins,

Eventually led to the Common Lisp Object-Oriented System,

Which integrates functional programming and object-oriented programming and allows extension via a meta-object protocol.

In the 1980s,

There were a few attempts to design processor architectures that included hardware support for objects in memory,

But these were not successful.

Examples include the Intel iAPX 432 and the LinSmart recursive.

In 1981,

Goldberg edited the August issue of Byte Magazine,

Introducing smalltalk and object-oriented programming to a wider audience.

In 1986,

The Association for Computing Machinery organized the first conference on object-oriented programming,

Systems,

Languages,

And applications,

UPSLA,

Which was unexpectedly attended by 1,

000 people.

In the mid-1980s,

Object C was developed by Brady Cox,

Who had used Smalltalk at ITT,

And Bjorn Stroustrup,

Who had used Simula for his PhD thesis,

Eventually went to create the object-oriented C++.

In 1985,

Bertrand Meyer also produced the first design of the Eiffel language.

Focused on software quality,

Eiffel is a purely object-oriented programming language and a notation supporting the entire software lifecycle.

Meyer described the Eiffel software development method based on a small number of key ideas from software engineering and computer science in object-oriented software construction.

Essential to the quality focus of Eiffel is Meyer's reliability mechanism,

Designed by a contract,

Which is an integral part of both the method and language.

In the early and mid-1990s,

Object-oriented programming developed as the dominant programming paradigm when programming languages supported the techniques became widely available.

His included Visual,

FoxPro,

3.

0,

C++,

And Delphi.

Its dominance was further enhanced by the rising popularity of graphical user interfaces,

Which rely heavily upon object-oriented programming techniques.

An example of a closely related dynamic GUI library and OOP language can be found in the Coco frameworks on Mac OS X written in Object C,

An object-oriented dynamic messaging extension to C based on Smalltalk.

OOP toolkits also enhance the popularity of event-driven programming,

Although this concept is not limited to OOP.

At ETH Zurich,

Niklaus Wirth and his colleagues had also been investigating such topics as data abstraction and modular programming,

Although this had been in common use in the 1960s or earlier.

Modula 2,

1978,

Included both,

And their succeeding design,

Oberon,

Included a distinctive approach to object-orientation classes and such.

Object-oriented features have been added to many previously existing languages including Ada,

Basic,

Fortran,

Pascal,

And Cobol.

Adding these features to languages that were not initially designed for them often led to problems with compatibility and maintainability of code.

More recently,

A number of languages have emerged that are primarily object-oriented,

But that are also compatible with procedural methodology.

Two such languages are Python and Ruby.

Probably the most commercially important recent object-oriented languages are Java,

Developed by Sun Microsystems,

As well as C Sharp and Visual Basic.

NET,

VB.

NET,

Both designed for Microsoft's.

NET platform.

Each of these two frameworks show,

In its own way,

The benefit of using OOP by creating an abstraction from implementation.

The VB.

NET and C Sharp support cross-language inheritance,

Allowing classes defined in one language to subclass classes defined in the other language.

Meet your Teacher

Benjamin BosterPleasant Grove, UT, USA

4.7 (136)

Recent Reviews

Forrest

February 13, 2024

What is your favorite band? Mine is AJR and I’m going to be attending a concert!

Diane

January 28, 2023

Total snooze fest, Benjamin. Thank you! Did you make it all the way through without falling asleep yourself? Guess I’ll never know. 😉💤

Katherine

March 20, 2022

Thank you.

Anthony

June 22, 2021

Thought this might put me to sleep, but despite his soothing voice.. the content was riveting and I conscious through the end. Sure to put any non-programmer to sleep though.

Antoinette

May 19, 2021

Asleep in no time. Thank you.

alida

May 18, 2021

This was a new one I had not heard before on programming but tht is all I remember. I wish I could submit a donation to Benjamin or any teacher but every time I try I get an error message. I have reported the problem and got a message that someone would contact me to rectify this. Have never heard from anyone. Maybe the teacher who reads this can report the problem as well.

More from Benjamin Boster

Loading...

Related Meditations

Loading...

Related Teachers

Loading...
© 2026 Benjamin Boster. All rights reserved. All copyright in this work remains with the original creator. No part of this material may be reproduced, distributed, or transmitted in any form or by any means, without the prior written permission of the copyright owner.

How can we help?

Sleep better
Reduce stress or anxiety
Meditation
Spirituality
Something else