Object-Oriented Programming Languages
Object Oriented Programming (OOP) is a way of designing and organizing software using "objects," which are self-contained structures that hold both data and functionality.
The ideas for OOP grew out of Simula, a language used for simulation programming. In Simula programs, a simulation of a car might have various data points (current speed, current location, RPMs, gas tank level) and also functions (turn the car on, turn it off, turn on windshield wipers). The car object encapsulates all of these into a single object that other objects in the system can interact with.
These ideas were expanded from real-world simulation to more abstract software system concepts with the advent of the Smalltalk programming language in the 1970s. Smalltalk's inventor, Alan Kay, was the first person to fully articulate a concept of object orientation. These ideas were further developed through the 80s and 90s, especially under the influence of the Design Patterns movement.
General Resources on Object Oriented Programming
Object-oriented programming is such an important concept that there are many resources that deal with it in an abstract way.
Here are some of the best online resources that we've found:
- Object Oriented Programming: an extensive Wikibook guide
- The Confusing World of Object-Oriented Programming, Explained as an RPG: a clever and informative look at OOP, through the lens of fantasy role playing computer games
- What is Object Oriented Programming? (Without the Hype): a now-classic introductory essay
- A Brief History of Object-Oriented Programming.
OOP rose to prominence just before the internet and World Wide Web became ubiquitous. Because of this, many of the best classic resources are only available as print books.
- An Introduction to Object-Oriented Programming
- Design Patterns: Elements of Reusable Object-Oriented Software: the classic book on object-oriented programming
- Object-Oriented Analysis and Design with Applications
- The Object-Oriented Thought Process
- Object-Oriented Software Construction
- Object Models: Strategies, Patterns, and Applications
- Design Patterns Explained: A New Perspective on Object Oriented Design.
Object Modeling and UML
Modeling — the art and science of designing software in pictures and diagrams before writing code — is a major part of serious object-oriented design culture. While you can write classes and instantiate objects without first drawing pictures of them, many of the most important benefits to OOP can only be realized in conjunction with model-based design.
The Universal Modeling Language was developed specifically to enable OOP system modeling, and is the standard way of illustrating OOP programs and programming patterns.
- UML Distilled: A Brief Guide to the Standard Object Modeling Language
- Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development
- Fundamentals of Object-Oriented Design in UML
- Use Case Driven Object Modeling with UML: Theory and Practice.
If patterns, designs, and modeling really interest you, you should check out The Timeless Way of Building, by Christopher Alexander. This book on architecture (buildings, not software) was hugely influential on the OOP and design patterns movement.
OO Resources by Language
Not all programming languages support object-oriented programming. Some languages are designed to do nothing but support OOP. Others allow for a variety of approaches to programming. Still others appear to be object-oriented, but implement the concepts of object orientation in non-standard, incomplete, or just plain unusual ways.
Below is a list of some of the more popular OO-capabable languages, with notes about their approach to Object Orientation, and some resources to help you get into OOP with that language.
The internet is filled with essays that look at language X vs language Y — most of which just scratch the surface. We suggest you check out this more general Programming Language Comparison. This thoughtful analysis looks at specific details of several popular OO languages, discussing how particular OO concepts are implemented in each.
C is not an object-oriented language. However, it is at least possibleto write OO code in it:
- Object-Oriented Programming in ANSI-C (PDF)
- Object-Oriented Programming with ANSI-C (PDF)
- Phil's Guide to Object-Oriented ANSI C
- Object-Oriented Programming In C.
None of the techniques described in those books and articles are particularly robust or easy to deal with for non-trivia programs. Rather than trying to stretch C to its limits, there are three direct descendants of C which include object-oriented language tools.
C++ is multi-paradigm, which means that it supports several different programming methods (PDF), including object-orientation. It is based on C, and developed specifically as a way to add support for OOP's concept of classes.
- Object-Oriented Programming (OOP) in C++: a great intro guide from Computer Science professor
- Learning Object Oriented Programming in C++: a large, multi-part tutorial on OOP
- C++ Tutorial 20-1 — Classes and Object-Oriented Programming: part of a larger video series on C++, this session begins the coverage on OOP concepts
- Introduction to Object-Oriented Programming Using C++
- Object-Oriented Programming in C++.
C# ("C sharp") is another C derivative, mostly designed as an improvement over C++ for use in Microsoft's .NET Framework.
- Object Oriented Programming in C#
- C# Object Oriented Programming Basic to Advance (video)
- C# OOPS Concepts (video)
- Object-Oriented Programming Fundamentals in C#: a premium tutorial from PLuralsight (free trial available)
- Introduction to Object Oriented Programming Concepts in C#: covers abstraction, encapsulation, inheritance and polymorphism in C#
- Top 10 OOPS Concepts In C# .NET With Examples: a great quick guide to orienting yourself in C# if you already understand OOP concepts
- Learning C#: How to Master an Object Oriented Programming Language: a high-level overview of how to best approach learning C# and OOP in general
- Beginning C# Object-Oriented Programming.
Objective-C was developed about the same time as C++, with essentially the same goal — the addition of OOP capabilities to C. Today, Objective-C is really only used in Apple's Cocoa Development Platform for OS X and iOS, and GNUstep, its Open Source alternative.
- Object-Oriented Programming with Objective-C
- Intro to Object-Oriented Design
- Object Oriented Programming and the Objective-C Language (PDF)
- Intro to Object Oriented Programming.
The approach to Object Orientation implemented in CLOS is radically different than the way OO is handled in other languages. This means that CLOS is not a great place to start if you want to learn OO in general, or apply OO in other types of languages. However, if you are getting into Lisp, CLOS is very important. Additionally, if you find OOP especially intriguing, you'll enjoy studying CLOS to see OO concepts in a different light.
- Fundamentals of CLOS
- A Brief Guide to CLOS
- The Common Lisp Object System: An Overview (PDF)
- CLOS: Integrating Object-Oriented and Functional Programming (PDF)
- Object-Oriented Programming in COMMON LISP: A Programmer's Guide to CLOS.
According to some conventional points of view, Erlang is not an object-oriented language. However, there is a fascinating minority opinion to the contrary, and its proponents state that Erlang Is the Most Object Oriented Language, or even that Erlang is the only true Object Oriented language.
F# ("F sharp") is a multi-paradigm language. Its core is really functional programming, but it includes support for OO and attempts to reconcile these two different approaches to programming.
- The "Object-oriented programming in F#" series
- F# Quick Guides: Object Oriented Programming
- F# Overview — Imperative and Object-Oriented Programming
- Object Oriented F# — Creating Classes
- Object-oriented Programming in F# (PDF)
- OOP without classes in F#.
Fortran is the oldest programming language still in common use. When it was invented in the 1950s, there was no such thing as object orientation. Explicit OOP support was added to Fortran with the Fortran 2003 release of the language. But it was possible to implement some basic OOP concepts in earlier versions of the language.
- OOP in Fortran before Fortran was Object Oriented:
- OOP in Fortran with official support:
Go doesn't have anything in it called "object" or "class," but it does have some analogous structures. From a certain point of view, then, you can think of Go as object oriented.
Many people in fact do think that Go is OO:
- Go Object Oriented Design
- Object Oriented Programming in Go
- Object Oriented Language Patters in Go
- Go for Object Oriented Programmers or Object Oriented Programming without Objects (video)
- Summary of Object Oriented Programming Goodness in Go, without the pain.
Java was built from the ground up to be object-oriented. Here are some great resources to get you going with Java:
- Object Oriented System Design: the website for Stanford's CS108, with links to code, handouts, lecture slides, and pretty much everything you need to work through the course on your own
- The Java Tutorial: Object-Oriented Programming Concepts
- Java Programming Tutorial Object-oriented Programming (OOP) Basics
- Object-Oriented Programming Concepts (six video series)
- Object Oriented Programming — Java Tutorial
- Java Fundamentals Tutorial: Object Oriented Programming in Java
- Object-oriented Programming in Java
- Object-Oriented Programming Basics With Java (PDF).
PHP did not support even basic OO concepts until version 4, and didn't support full object orientation until PHP5.
- Object Oriented PHP for Beginners
- Object-Oriented PHP for Absolute Beginners
- Principles Of Object Oriented Programming in PHP
- Object Oriented PHP (video)
- Object-Oriented PHP: Concepts, Techniques, and Code.
Python codes does not need to be object-oriented, but the language fully supports it. Check out these resources:
- Object-Oriented Programming: an introduction to OOP, by way of Python, from MIT's Open Courseware
- Object-Oriented Programming in Python
- Improve Your Python: Python Classes and Object Oriented Programming
- Python Course: Object Oriented Programming
- Python 3 Object Oriented Programming.
In Ruby everything is an object, even "primitive" data types like strings and integers. You add two integers by calling the addition method on one of them; you find the length of a string by calling the length method on it.
- Ruby User's Guide: Object-oriented Thinking
- Ruby Module: A Major OOPs Feature of the Ruby Programming Language
- Practical Object-Oriented Design in Ruby.
Smalltalk is probably the most influential object-oriented language, having had a profound effect on the languages that came later. As a result, it is good to have at least some familiarity with it. These resources will get you started:
- Object Oriented Programming with Smalltalk (PDF)
- Smalltalk and Object Orientation: An Introduction (PDF)
- Smalltalk: Getting started with the language (video)
- Programming Smalltalk - Object-Orientation from the Beginning: an Introduction to the Principles of Programming.
On the Other Hand...
If you want to be a well-rounded developer, it is important to understand both the good and bad of any concept. Even though object orientation has become the dominant way of understanding programming, there are legitimate criticisms to be made — both of the ideas themselves, and the culture of hype surrounding them.
Here are a handful of resources presenting the counter-argument to OOP:
- Object Oriented Programming Is an Expensive Disaster Which Must End
- Object Oriented Programming Is Inherently Harmful
- Object-Oriented Programming: a Disaster Story.
Bottom Line on OOP
Object-oriented programming is the dominant mode of software development today, and has been since the beginning of the 21st century. While other modes of writing software (eg, imperative programming) are certainly valid and useful, no developer can really afford to not understand object orientation — both as a way of coding and as a way of analyzing and designing software systems.
Further Reading and Resources
We have more programming guides, tutorials, and infographics related to coding and development:
- C++ Developer Resources: in addition to information about C++, there is more information about object-oriented programming.
- Linux Programming Introduction and Resources: although not specifically about object oriented programming, this discussion of the many levels of Linux programming is bound to energize you.
- INTERCAL Introduction and Resources: if you find object-oriented programming hard, studying INTERCAL will make it seem easy. This parody (or joke) language is so complicated and horrible that even the deepest discussion of polymorphism will seem pleasant.
What Code Should You Learn?
Confused about what programming language you should learn to code in? Check out our infographic, What Code Should You Learn? It not only discusses different aspects of the languages, it answers important questions such as, "How much money will I make programming Java for a living?"