

Why?Ġ1:34 Because they’ll have to change attribute access and mutation operations into method calls throughout their codebase if they want the code to continue working.Ġ1:45 One solution for this issue is to provide additional methods for manipulating the attributes of your classes. So changing an attribute’s internal implementation will require converting the attribute into a method, which will probably break your user’s code. A stored attribute will immediately respond to access and mutation operations by just retrieving and storing the data, whereas a computed attribute will run computations before such operations.Ġ1:19 The problem with regular attributes is they can’t have an internal implementation because they are just variables. Having an attribute that’s part of a class’s API will become a problem if you need to change the internal implementation of the attribute itself.Ġ1:03 A clear example of this issue is when you want to turn a stored attribute into a computed one. This means that your users will directly access and mutate the attributes in their code. If you expose the attributes of a class to your users, then those attributes automatically become part of the class’s public API.Ġ0:46 They’ll be public attributes. Typically, you’ll have at least two ways to access and mutate attributes.Ġ0:30 You can either access and mutate the attribute directly or use methods to access and mutate the attribute. In many cases, you’ll need to access and mutate the state, which involves accessing and mutating the attributes. These attributes are just variables that you can access through the instance, the class, or both.Ġ0:16 Attributes hold the internal state of objects. When you define a class in object-oriented programming, you’ll likely end up with some instance and class attributes.
