Search for tag: "preconditions"

Lesson 25.4 The raise Statement

Up 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…

+19 More
From  Hannah Lee 70 plays

Lesson 24.2 The isinstance Function

In 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.

+19 More
From  Hannah Lee 73 plays

Lesson 24.1 Strict Typing

Whenever 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…

+19 More
From  Hannah Lee 65 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,…

+19 More
From  Hannah Lee 93 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 109 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…

+19 More
From  Hannah Lee 96 plays

Lesson 20.4 Classes Specifications

Classes 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…

+19 More
From  Hannah Lee 100 plays

Lesson 17.3 Recursion and the Call Stack

Because 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…

+19 More
From  Hannah Lee 153 plays

Zoom Oct. 8. Asserts and Error Handling

In 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…

+19 More
From  Hannah Lee 25 plays

Lesson 13.6 Assert Helpers

Sometimes 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…

+19 More
From  Hannah Lee 74 plays

Lesson 11.6 Attribute Invariants

When 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…

+19 More
From  Hannah Lee 118 plays

Lesson 7.4 Preconditions Categories

In 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…

+19 More
From  Hannah Lee 78 plays

Lesson 7.3 Preconditions

The 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…

+19 More
From  Hannah Lee 82 plays

CS2110-FA17-05 Session 05

2017-09-05 00:00:00+00

From  mjp337@cornell.edu 240 plays