Creational Design Patterns
Effectively what a constructor being called by your code does is it causes cohesion between that piece of code and the way that object is instantiated.
15:44 Factory Method
The factory method creates an instance of several derived classes by defining an interface for creating an object. It lets subclasses decide which class to instantiate.
Singletons provide a way to access an object without the need to instatiate. Only one instance of the object can exist and it provides a global point of access.
Prototypes are fully initialized instances that can be copied or cloned by creating duplicate objects while keeping performance in mind. It specifies the kinds of objects to create usita and prototypical instance and creates new objects by copying this prototype.
The builder pattern separates object construction from its representation by building complex objects out of simple objects. It uses a step by step approach so the same process can be used for many representations.
35:31 Object Pool
An object pool recycles objects that are no longer in use by placing them in a pool so that a new object does not need to be instantiated. This provides a performance boost when the cost to initialize a class is high.
43:16 Abstract Factory
Abstract factories are super factories that create other factories. They create an instance of several families of classes providing an interface for creating families of related or dependent objects without specifying their concrete class.
Family Message Board
A family project using Amazon’s AWS SMS services, a Raspberry Pi, and an LED matrix to create a message board. A message can be sent from a phone to AWS that is then sent to the Raspberry Pi and displayed on the message board. It also includes a button and sensors to respond the message has been read.
Alimentation is a brand of charger or adaptor in Europe. In French when used for technology it means power.
- Raspberry Pi Model B+
- RGB Hat
- LED matrix
- Arcade Button
- Alimentation Mean-Wheel
- Ultrasonic Sensor HC-SR04
- XCode 7
- Python IDE
- Bitwise SSH Client
Tricks of the Trade
How long should an object exist?
When do you create an objec?
The lifetime of an object should only be as long as you need it. Creating and releasing an object should be done as closely to when it is needed as possible. This is how you write tight efficient code.