Autoplay
Autocomplete
Previous Lesson
Complete and Continue
Dynamic Proxies in Java
Resources
Exercise files and slides
Dynamic Proxies in Java Mini-Book
Playground files and solved exercises
Welcome
0.1. Why I wrote this book (and course) (3:05)
0.2. Hearty welcome (2:12)
0.3. Course author (1:23)
0.4. Comfort and Learning (1:30)
0.5. How to ask questions (1:25)
0.6. Exercises (1:57)
0.7. Exercises in IntelliJ 2020.1 (or later) (2:12)
0.8. History of dynamic proxies (2:13)
0.9. Big Win (3:10)
0.10. Infrastructure Code (1:01)
0.11. Risk of dynamic proxies (3:22)
0.12. What will we learn? (0:59)
0.13. Java version (1:17)
0.14. Shallow vs deep reflection (2:25)
0.15. Book sample code (1:10)
0.16. How code is modularized (2:28)
0.17. Enjoy! (0:21)
0.18. Exercise 0.1 (2:13)
Design Patterns Cousins
1.0. Design Patterns Cousins (0:36)
1.0.1. Christopher Alexander and Design Patterns (2:42)
1.0.2. What's in a name? (3:10)
1.0.3. Four Cousins (1:14)
1.1.1. Proxy Intent (1:32)
1.1.2. Proxy Structure (1:20)
1.1.3. Proxy Variations (1:31)
1.1.4. Proxy Exercises (1:04)
1.2.1. Adapter Intent (1:24)
1.2.2. Adapter Structure (2:25)
1.2.3. Object Adapter vs Proxy (1:31)
1.2.4. Adapter Exercises (0:23)
1.3.1. Decorator Intent (3:18)
1.3.2. Decorator Structure (1:18)
1.3.3. Decorator OutputStream (2:27)
1.3.4. OutputStream Objects (1:00)
1.3.5. OutputStream Code Samples (3:24)
1.3.6. Decorator vs Proxy (1:13)
1.3.7. Decorator Exercises (0:32)
1.4.1. Composite Intent (0:50)
1.4.2. Composite Structure (0:59)
1.4.3. Composite vs Proxy (0:25)
1.4.4. Merging and reducing return values (0:24)
1.4.5. (Ab)using dynamic proxies to implement all four cousins (0:16)
1.4.6. Composite Exercises (0:30)
1.5.1. Chain of Responsibility Intent (0:58)
1.5.2. Chain of Responsibility Sample Code (2:31)
1.5.3. Chain of Responsibility Summary (0:28)
1.5.4. Chain of Responsibility Pitfalls (0:19)
1.5.5. Chain of Responsibility Exercises (0:17)
Handcrafted Proxies
2. Handcrafted proxies (1:47)
2.1.1. Virtual Proxy (1:04)
2.1.2. CustomMap Interface (0:34)
2.1.3. CustomHashMap Class (1:46)
2.1.4. VirtualCustomMap Class (1:58)
2.1.5. CustomMap Class Diagram (1:40)
2.1.6. Using VirtualCustomMap (1:47)
2.1.7. Sizeof in Java (1:24)
2.2. Remote Proxy (2:06)
2.2.1. RealCanada (0:41)
2.2.2. Spark Framework (1:16)
2.2.3. Service Publisher with Spark (0:48)
2.2.4. Service Publisher with Jetty (0:48)
2.2.5. Remote Proxy CanadianEmbassy (2:03)
2.2.6. Canada Class Diagram (0:44)
2.2.7. Heinz Applying for Canadian Visa (0:28)
2.3. Protection proxy (1:24)
2.3.1. ConcurrentTest for testing thread safety in CustomMap (2:33)
2.3.2. Code walk-through and demo for ConcurrentTest (5:12)
2.3.3. Protection Proxy to the rescue (0:16)
2.3.4. SynchronizedCustomMap (0:29)
2.3.5. Synchronized or ReentrantLock? (1:49)
2.3.6. SynchronizerTestDemo (0:47)
2.3.7. Unmodifiable Map (1:05)
2.3.8. UnmodifiableCustomMap (1:25)
2.3.9. UnsupportedOperationException (2:03)
2.4. Cascaded Proxies (0:40)
2.4.1. More flexible proxy structure (0:27)
2.4.2. Cascading proxies code (1:14)
2.5. equals() in proxies (1:18)
2.5.1. IDE-generated equals() in CustomHashMap (1:46)
2.5.2. How AbstractMap implements equals() (1:09)
2.5.3. New CustomHashMap.equals() method (Broken contract) (1:58)
2.5.4. Proxy's equals() delegates call (0:24)
2.5.5. Correct CustomHashMap.equals() (2:52)
2.6.1. Exercise 2.1. Problem Statement (3:23)
2.6.2. Exercise 2.1. Walkthrough (7:43)
2.6.3. Exercise 2.2. Problem Statement (16:13)
2.6.4. Exercise 2.2. Walkthrough (24:03)
2.7. Summary (0:47)
Dynamic Proxies
3. Dynamic Proxies (0:46)
3.0.1. Avoid Copy and Paste (3:53)
3.1. Proxy.newProxyInstance() (3:55)
3.1.1. IllegalArgumentException from Wrong ClassLoader (0:45)
3.1.2. Correct ClassLoader Specified (1:13)
3.1.3. Java Platform Module System (4:26)
3.1.4. InvocationHandler (1:38)
3.2. LoggingInvocationHandler (1:13)
3.2.1. invoke() Method for LoggingInvocationHandler (3:51)
3.2.2. toString() Prints Methods with Args (0:49)
3.2.3. Demo of LoggingInvocationHandler (1:21)
3.3. Dissecting a Dynamic Proxy (0:28)
3.3.1. Dynamic Proxy Class Name (1:03)
3.3.2. Decompiling $Proxy0 (0:48)
3.3.3. $Proxy0 Code Walkthrough (6:41)
3.3.4. How Does $Proxy0 Work? (1:29)
3.3.5. EscapeAnalysisTest of Arguments Array (4:45)
3.3.6. Turbo-boosting Reflection Methods (1:41)
3.3.6.1. TurboBoosterTest Demo (6:27)
3.3.6.2. MethodTurboBooster Code Review (2:02)
3.4. Recasted Exceptions (0:15)
3.4.1. Unexpected Exceptions Causing Issues (0:30)
3.4.2. RecastingExceptionsBroken (1:31)
3.4.3. Unwrapping InvocationHandler (1:30)
3.4.4. RecastingExceptionsFixed (0:26)
3.5. Proxies Facade (1:01)
3.5.1. Proxies.castProxy() (1:16)
3.5.2. simpleProxy() (0:53)
3.5.3. RealISODateParser (0:50)
3.5.4. Using Proxies Facade (1:17)
3.6. Virtual Dynamic Proxy (1:04)
3.6.1. Proxies Facade virtualProxy() (0:26)
3.6.2. Creating Virtual Proxy (1:08)
3.6.3. Company and MoralFibre (1:24)
3.6.4. CompanyTest (0:59)
3.7. Synchronized Dynamic Proxy (1:02)
3.7.1. Proxies Facade synchronizedProxy() (0:17)
3.7.2. SynchronizedTest (0:51)
3.8. Cascading Dynamic Proxies (1:12)
3.9. EnhancedStream (1:57)
3.9.1. EnhancedStream Code Review (1:42)
3.10. Dynamic Proxy Restrictions (0:28)
3.10.1. Interfaces Only (0:36)
3.10.2. UndeclaredThrowableException (0:32)
3.10.3. Return Types Have to be Correct (0:58)
3.10.4. Naming Mysteries (1:33)
3.10.5. Deeper Call Stacks (0:39)
3.10.5.1. Leaky Abstractions (1:59)
3.10.6. Shared Proxy Classes (1:47)
3.11. Performance (3:00)
3.11.1. Model for Benchmark using JMH (4:05)
3.11.2. Benchmark increment() Results (1:37)
3.11.3. Benchmark consumeCPU() Results (0:50)
3.11.4. Summary of Benchmark Results (0:40)
3.12. Exercises (0:15)
3.12.1. Exercises 3.1. Problem Statement (0:24)
3.12.2. Exercises 3.1. Walkthrough (1:30)
3.12.3. Exercises 3.2. Problem Statement (2:13)
3.12.4. Exercises 3.2. Walkthrough (8:31)
Dynamic Decorators
4. Dynamic Decorator (0:36)
4.0. Decorator Structure (0:36)
4.1. Filtering for Immutability (2:53)
4.1.1. ImmutableCollection (1:14)
4.1.2. HandcodedFilter (1:04)
4.1.3. MutableCollection (0:22)
4.1.4. UML Diagram (1:04)
4.1.5. HandcodedFilter Demo (1:44)
4.2. FilterHandler (4:52)
4.2.1. FilterHandler Class (4:54)
4.2.2. Proxies Facade Gets filter() Method (1:43)
4.2.3. Dynamic Filter Demo (1:07)
4.2.4. What Happened? (2:24)
4.3. VTable (0:44)
4.3.1. VTable Overview (2:05)
4.3.2. ParameterTypesFetcher (4:48)
4.3.3. MethodKey (4:52)
4.3.4. VTable (3:57)
4.3.4.1. VTable put() and findIndex() (7:38)
4.3.4.2. VTable.getDefaultMethodHandle() (6:08)
4.3.4.3. Turbo-Boosting Methods in VTable (0:57)
4.3.4.4. VTable.lookup() and stream() (3:41)
4.3.5. VTable.Builder (19:03)
4.3.6. VTables Facade (1:39)
4.3.7. VTable Summary (0:22)
4.4. ChainedInvocationHandler (5:41)
4.4.1. UnhandledMethodException (0:44)
4.4.2. VTableHandler (1:48)
4.4.3. VTableDefaultMethodHandler (3:39)
4.4.4. UnifiedInvocationHandler (6:37)
4.5.1. Exercise 4.1. Problem Statement (0:48)
4.5.2. Exercise 4.1. Walkthrough (2:11)
4.5.3. Exercise 4.2. Problem Statement (3:32)
4.5.4. Exercise 4.2. Walkthrough (13:30)
Dynamic Object Adapter
5. Dynamic Object Adapter (0:30)
5.0.1. Singer and Rapper (0:59)
5.0.2. Class Adapter (1:12)
5.0.3. Object Adapter (1:21)
5.1. Better Collections (0:12)
5.1.1.1. Generics Type Erasure (2:31)
5.1.1.2. Demo of ArrayList (2:17)
5.1.1.3. Covariant Return Types (2:44)
5.1.2.1. BetterArrayList (1:33)
5.1.2.2. Demo of BetterArrayList (1:00)
5.1.3.1. BetterCollection Interface (1:24)
5.1.3.2. BetterConcurrentSkipListSet (0:34)
5.1.4.1. Object Adapter Pattern (1:16)
5.1.4.2. BetterCollectionObjectAdapter (1:23)
5.1.4.3. Demo of BetterCollectionObjectAdapter (0:24)
5.1.4.4. What if we want to make a better Set, List, etc.? (0:51)
5.1.5.1. ObjectAdapterHandler (1:53)
5.1.5.2. Proxies.adapt() (1:43)
5.1.5.3. BetterCollectionFactory (2:22)
5.1.5.4. Demo of Dynamic Object Adapter (1:15)
5.2.1. Dynamic Object Adapter Restrictions (1:09)
5.2.2. AdapterPuzzle1 (3:45)
5.2.3. AdapterPuzzle2 (1:07)
5.3. Performance (0:28)
5.3.1. Benchmark (3:19)
5.3.2. JMH Benchmark Code (6:21)
5.3.3. Benchmark size() Results (3:14)
5.3.4. Benchmark toArray() Results (4:26)
5.3.5. Benchmark forEachFiltered() Results (6:22)
5.4.1. Exercise 5.1. Problem Statement (1:51)
5.4.2. Exercise 5.1. Walkthrough (5:21)
5.4.3. Exercise 5.2. Problem Statement (1:16)
5.4.4. Exercise 5.2. Walkthrough (5:47)
5.4.5. Exercise 5.3. Problem Statement (1:24)
5.4.6. Exercise 5.3. Walkthrough (11:07)
Dynamic Composite
6. Dynamic Composite (3:21)
6.0.1. Composite Structure (1:12)
6.0.2. Visitor Pattern (1:06)
6.0.3. add() and remove() in Component? (5:32)
6.1. Mailing List (3:01)
6.1.1. Contact and Person (0:55)
6.1.2. DistributionList (1:36)
6.1.3. Contact Class Diagram (1:18)
6.1.4. Let's Build a Mailing List (1:12)
6.1.5. Mailing List Object Graph (0:28)
6.1.6. Composite Classes Look Similar (0:34)
6.1.7. BaseComponent (0:51)
6.1.8. Contact extends BaseComponent (0:24)
6.1.9. BaseComponent Class Diagram (0:48)
6.2. CompositeHandler (0:53)
6.2.1. CompositeHandler Constructor (1:47)
6.2.2. Matching add() and remove() methods (1:09)
6.2.3. requiresAllInterfaces() (1:42)
6.2.4. addChildMethods() (7:02)
6.2.5. UncheckedException (1:08)
6.2.6. mapFunction() (2:09)
6.2.7. map and reduce (3:53)
6.2.8. Reducer.PROXY_INSTANCE_REDUCER (0:44)
6.2.9. Merging final result and unwrapping UncheckedException (0:28)
6.2.10. CompositeHandler summary (0:13)
6.2.11. Proxies.compose() (1:10)
6.2.12. Dynamic Composite Contact (0:56)
6.3. TeeAppendables (1:15)
6.3.1. Demo of TeeOutputStream (0:52)
6.3.2. OutputStreamComposite (0:26)
6.3.3. Interfaces of OutputStream and Writer (2:24)
6.3.4. TeeAppendable Handwritten Composite (1:39)
6.3.5. Making TeeAppendable into Writer (1:01)
6.3.6. Demo of TeeAppendable (2:27)
6.4. AppendableFlushableCloseable (1:44)
6.4.1. Composing Appendable Dynamically (0:58)
6.5.1. Exercise 6.1. Problem Statement (2:18)
6.5.2. Exercise 6.1. Walkthrough (9:44)
6.5.3. Exercise 6.2. Problem Statement (0:42)
6.5.4. Exercise 6.2. Walkthrough (3:22)
Conclusion
7. Conclusion (4:56)
Teach online with
5.2.2. AdapterPuzzle1
Lesson content locked
If you're already enrolled,
you'll need to login
.
Enroll in Course to Unlock