

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: Abstraction
incomplete
2: Abstraction vs. Encapsulation Quiz
incomplete
3: Sprint
incomplete
4: How OOP Developers Think
incomplete
5: Abstraction Practice
incomplete
This lesson's interactive features are locked, please to keep using them
Classes in object-oriented programming are all about grouping data and behavior together in one place: an object. Object-oriented programmers tend to think about programming as a modeling problem. They think:
"How can I write a
Humanclass that holds the data and simulates the behavior of a real human?"
To provide some contrast, when functional programmers aren't busy writing white papers, they tend to think of their code as inputs and outputs, and how those inputs and outputs transition the world from one state to the next:
"My game has 7 humans in it. When one takes a step, what's the next state of the game?"
OOP isn't the only pattern for organizing code, but it's one of the more popular ones. If you understand multiple ways of thinking about code, you'll be a much better developer overall.