1/9
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
types of patterns
creational, structural, behavioral
examples of creational patterns
factory function, builder, singleton
examples of structural patterns
adapter
examples of behavioral patterns
iterator
singleton (“factory function”
can return instances of different classes in different cases. EX: return new PolarPoint (x,y) instead of having to create a new object
cons of constructors
they have no name, multiple methods with the same name
overloading
multiple methods with the same name. distinguished by parameters
builder creational pattern
helps us create other objects, like a string builder bit by bit. good pairing: mutable Builder for an immutable type
adapter structural pattern
allows you to use instances from other classes to make 2 interfaces compatible
iterator design pattern
enumerate a collection while hiding data structure details