1. Michelle Yaiser - Presenter
1.1. @MichelleYaiser
1.2. Adobe Dev Connection
1.3. [email protected]
1.4. Wrote a ton of content on adobe.com/devnet actionscript 3 documentation
1.5. Apache Flex Committer
1.6. Taught interactive development for 10 years
2. Dependency Injection
2.1. Object does not call the injector
2.1.1. object doesn't even know about the injecor
2.2. Things are installed
2.2.1. passed in
2.3. Loose coupling of objects via seams
2.4. Only the root object is returned by the injector
2.5. Injectors can be context/scope specific
2.6. Benefits
2.6.1. more flexibile
2.6.2. more reusable
2.6.3. more easily maintained
3. Where to inject?
3.1. Constructor injection
3.1.1. required dependencies should be injected in the constructor
3.1.2. can't forget a dependency because the object can't be created without them
3.2. Setter injection
3.2.1. Optional dependencies should be njected in a setter
3.2.2. You can forget to call theh setter method which is okay because the dependencies are optional
3.3. Manual injection
3.3.1. you are the injector
3.3.2. you need to understand the full object graph to know all of the dependencies
3.3.2.1. knowing the object graph violates encapsulation
3.3.2.2. violating encapsulation is really problematic when code is used by many clients
3.3.3. you have to manage a lot
3.3.4. TEDIOUS
3.4. Frameworks
3.4.1. deal with all the pain of manual injection
3.4.2. if implemented correctly, you can easily switch between frameworks or manual injection
3.4.3. Fled Frameworks
3.4.3.1. Spring ActionScript
3.4.3.2. SwiftSuspenders
3.4.3.3. Swiz
3.4.3.4. SmartyPants
3.4.3.5. RobotLegs
3.4.3.6. Parsely
4. Object Oriented Initial Teaching
4.1. House Example
4.1.1. Object Structure
4.1.1.1. House
4.1.1.1.1. Bedroom
4.1.1.1.2. Bathroom
4.1.2. To add a purple bed
4.1.2.1. new house, new bedroom, new bed to change one thing
4.1.2.1.1. Bad
4.1.3. Real house doesn't build iteslef
4.1.3.1. contractor does
4.1.3.1.1. he finds all the requirements
4.1.3.1.2. all the configurations needs it
4.1.3.1.3. and builds all the pieces to put it together
4.2. Race Car Example
4.2.1. starter busted
4.2.1.1. if the car had to build all of its own pieces it would have required to buy a whole new car
4.3. Sweater Example
4.3.1. button popped off
4.3.1.1. have to create a whole new sweater
5. Seams
5.1. definition
5.1.1. seams are where objects join each other
5.1.2. are places where you can alter behavior in your program without editing that place
5.2. Factory Pattern
5.2.1. each factory only produces a specific object so a factory is needed for every class
5.2.1.1. seems weird to have a factory for one instance
5.2.1.2. lots of additional code to be tested
5.2.1.3. lots of additional code to be maintained
5.2.2. Dependency upon the factory
5.2.3. negative
5.2.3.1. still has dependency on the factory
5.2.3.2. real world objects don't always call to a factory for a replacement peice
5.3. Service Locator
5.3.1. kind of factory that can create any object rather than a specific one
5.3.1.1. reduces amount of code to maintain
5.3.2. uses lots of conditional logic
5.3.3. negative
5.3.3.1. still has a dependency on the service locator
5.3.3.2. real world objects don't know who to call to fix their dependencies
6. Inversion of Control
6.1. Control is inverted
6.1.1. framework calls me rather me calling the framework
6.2. Hollywood principle
6.2.1. don't call us we'll call you