Search for tag: "attributes"

Zoom Nov. 10. Operators and Abstraction

in this presentation we review the Python data model, showing off the various operators we can define in Python. This is an area where Python is much more advanced than older object-oriented…

From  Hannah Lee on November 12th, 2020 3 plays

Lesson 25.5 Custom Error Types

Now that we can raise an error of any type, it is time to make our own error types. In this video we show that this is incredibly simple, and needs almost no code.

From  Hannah Lee on November 12th, 2020 27 plays

Lesson 24.4 Duck Typing

This partial typing from the previous video has a name. It is called duck typing. In this video we show both why this is so popular among Python programmers and also why it is so controversial.

From  Hannah Lee on November 12th, 2020 25 plays

Lesson 24.3 Dynamic Attribute Access

Types guarantee that an object supports a set of operations (methods) and has a certain set of attributes. However, in this video we show that we can actually get this information without typing an…

From  Hannah Lee on November 12th, 2020 25 plays

Zoom Nov. 5. Inheritance

In this presentation, we continue with several of the classes that we worked on last time. But this time, we create subclasses of them.On the exam, the class question will always be a two-parter. One…

From  Hannah Lee on November 8th, 2020 3 plays

Zoom Nov. 3. Object-Oriented Design

In ths presentation, we will spend the time creating several example classes. This is another major part of the next exam.When we work with classes, it is very important to pay attention to…

From  Hannah Lee on November 8th, 2020 4 plays

Lesson 23.8 Properties (OPTIONAL)

This video introduces an advanced topic that is completely optional and will not appear on any exam. Classes like RGB and Point3 appear to enforce their invariants without any getters and setters.…

From  Hannah Lee on November 8th, 2020 8 plays

Lesson 23.1 The Principle of Abstraction

In this video we introduce the principle of abstraction, which is simply hiding unnecessary details about a class from the user of a class. However, there are many different ways to do that, which is…

From  Hannah Lee on November 8th, 2020 37 plays

Lesson 22.8 Subclass Initializers

In this video we show that thte primary purpose of the super function is in the initializer method of the subclass. That is because we cannot guarantee that all of the attributes for the parent class…

From  Hannah Lee on November 8th, 2020 29 plays

Lesson 22.6 Method Overriding

Subclasses inherit all of the methods of their parent. But suppose you do not want to use the inherited version of a method, but want to define a new one instead? In this video we talk about the…

From  Hannah Lee on November 8th, 2020 29 plays

Lesson 22.3 The object Class

Every class must be a subclass of something, and that parent class goes inside of the parentheses. That means that the word object we have been using in all of class definitions is actually a class.…

From  Hannah Lee on November 8th, 2020 28 plays

Lesson 21.6 Immutable Attributes

Getters and setters have another advantage in that they allow us to completely disable to any changes to an attribute. This allows us to separate attributes into mutable and immutable attributes,…

From  Hannah Lee on October 30th, 2020 44 plays

Lesson 21.5 Data Encapsulation

In this previous video we introduced the concept of getters and setters. But how do we force the user to use these when the attribute is so much simpler. In this video we talk about the concept of…

From  Hannah Lee on October 30th, 2020 46 plays

Lesson 21.4 Invariant Enforcement

We know how to enforce preconditions, but how do we force invariants for our attributes? As we see in this video, we do it much the same as for preconditions. But that is because we are going to…

From  Hannah Lee on October 30th, 2020 50 plays

Lesson 21.3 Interface Implementation

Once you have the interface to a class, it is time to start writing code. As we see in this video, the idea is much the same as writing functions. However, attributes – and specifically…

From  Hannah Lee on October 30th, 2020 48 plays

Lesson 21.2 Interface Design

When designing a class, we need to come up with the interface first. In this video we talk about how to do that. We approach this problem returning to our understanding of types: a collection of…

From  Hannah Lee on October 30th, 2020 43 plays