

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Encapsulation
incomplete
2: Not Security
incomplete
3: Wizard Duel
incomplete
4: Encapsulation in Python
incomplete
5: Wizard Duel
incomplete
6: Encapsulation Practice
incomplete
This lesson's interactive features are locked, please to keep using them
Encapsulation is all about making code easy to work with by "hiding" complicated code within a "black box". It makes it so we don't have to worry about the details of how a function or method works... we just use it.
This is kinda like how the inner workings of your car's power steering are hidden from you. You don't need to be an expert on hydraulic systems to turn the wheel from side to side.
Let me say this next part loud and clear:
Encapsulation and the concepts of private and public members have NOTHING to do with security. This really confused me as a new developer. Just as the casing on your computer hides its inner workings but doesn't stop you from opening the case and looking inside, encapsulation doesn't stop anyone from knowing how your code works; it just puts it all in one easy-to-find place.
Encapsulation is about organization, not security.
Making a property "private" tells other developers that it's an internal detail of your class. It doesn't make the value stored in that property secret.