Search for tag: "preconditions"
Lesson 25.4 The raise StatementUp until now, the only way that we knew how to create an error is with an assert statement. But these always create errors with the type AssertionError. In this video we show how to create errors…
From Hannah Lee
70 plays
|
|
Lesson 24.2 The isinstance FunctionIn this video, we show that we can solve the problem of strict typing by using the isinstance function. This function will be our preferred way for enforcing preconditions going forward.
From Hannah Lee
73 plays
|
|
Lesson 24.1 Strict TypingWhenever we have enforced preconditions, we have always used the type function. In this video we show why that is a problem, particularly when we want to use an object argument that is a subclass of…
From Hannah Lee
65 plays
|
|
Lesson 21.6 Immutable AttributesGetters 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
93 plays
|
|
Lesson 21.4 Invariant EnforcementWe 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
109 plays
|
|
Lesson 21.3 Interface ImplementationOnce 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
96 plays
|
|
Lesson 20.4 Classes SpecificationsClasses are something we can define. That means we need a specification to tell us what it means for a definition to be correct. In this video we cover the basics of a class specification, and show…
From Hannah Lee
100 plays
|
|
Lesson 17.3 Recursion and the Call StackBecause a recursive function calls itself, it will have multiple call frames on the call stack. In this video we show exactly why we should be concerned about this and why it will affect our function…
From Hannah Lee
153 plays
|
|
Zoom Oct. 8. Asserts and Error HandlingIn this session we review how we read error messages in Python. We also show how to both create errors and how to recover from them.Once again, we will spend a significant amount of this class on…
From Hannah Lee
25 plays
|
|
Lesson 13.6 Assert HelpersSometimes we absolutely need to enforce all of our preconditions, and we cannot live with the compromises of the previous video. In this video we show how to use top-down design to give us more…
From Hannah Lee
74 plays
|
|
Lesson 11.6 Attribute InvariantsWhen you work on Assignment 3, you will discover that the color objects have some significant restrictions on how they can be used. These restrictions are called attribute invariants, and they are…
From Hannah Lee
118 plays
|
|
Lesson 7.4 Preconditions CategoriesIn this video, we break our preconditions up into categories. The primary reason for this is to help us analyze a specification. It will also become extremely imporant when we talk about enforcement…
From Hannah Lee
78 plays
|
|
Lesson 7.3 PreconditionsThe one thing that we have not talked about yet are the preconditions in a specification. However, as this video shows, they are arguably the most important part of the specification. They are what…
From Hannah Lee
82 plays
|
|