Skip to main content
Version: 26sp

Review for Quiz 4

Coupling / cohesion / encapsulation

It is recommended to review these topics:

  • Identifying and mitigating coupling between two or more classes
  • Identifying and mitigating lack of cohesion in a class
  • How to further enhance encapsulation in an existing class

Iterator

It is recommended to review this table:

IterableIterator
Protocol's required methods__iter__(self) -> Iterator[T]: returns an iterator__next__(self) -> T: returns the next element or raises StopIteration
__iter__(self) -> Iterator[T] : returns itself
abc interface's required methods__iter__(self) -> Iterator[T] (same as protocol)__next__(self) -> T (same as protocol)
not __iter__(self) -> Iterator[T] because it's aleady there

Comparable

It is recommended to review these topics:

  • Implementing the Comparable protocol
  • Checking for inconsistencies between implemented Comparable methods
  • Rules for using <, >, etc.

Decorator, Strategy, Observer, and Data Pull Design Patterns

It is recommended to review these topics:

  • Why and how to make a function decorator
  • When to use the Strategy pattern (and how)
  • When to use Observer versus Data Pull (and how)