← Java OOP · guided lesson

OOP for DSA & Design Rounds

1 / 20 · story

the story

Classes, objects & encapsulation

Every tool here exists because something was too slow or broke without it. Here is what.

1962–1967 · Ole-Johan Dahl and Kristen Nygaard

Dahl and Nygaard, at the Norwegian Computing Center, wanted to describe and simulate real systems. Simula I, a simulation language, and Simula 67, a general-purpose language built on ALGOL 60, introduced classes, objects and inheritance. In 2001 they received the ACM Turing Award "for ideas fundamental to the emergence of object oriented programming". Java's class, new and extends are those same three ideas.

the problem it solved

Keep each piece of state together with the only code allowed to change it, and create as many independent copies (objects) as the program needs.

why it matters: without it

State and the code that guards it drift apart: any line could set a count to −1, and design answers become bags of global variables.

sources: ACM A.M. Turing Award 2001: Kristen Nygaard ↗ · ACM A.M. Turing Award 2001: Ole-Johan Dahl ↗

also in this chapter: Static nested vs inner classes · The equals/hashCode contract · Records · Generics · Enums