CSCA48H3 Lecture Notes - Lecture 3: Class Variable, Empty String, Init

54 views4 pages

Document Summary

Csca48 - lecture 04 - queues (part 2) A representation invariant is written as an internal comment. Usually within the __init__ method of a class that implements an adt. It describes how the variables of the class represent the data of the adt. It is written as a true/false statement, which should always be true. By always, we mean when an instance of the class is created, and after every method call. Recall that public methods correspond to the operations of the adt. A representation invariant may not be true during the execution of a method. A representation invariant should not describe how the methods of the class (i. e. , the operations of the adt) are implemented. Based on the analogy of a client and a server a representation invariant: Describes how class variables represents the data. Ex: if q is not empty, then q[0] is the top of the queue, etc. Is written as internal comments in __init__ method.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents