#rustlang #softwarearchitecture #softwaredevelopment
This video is part of a playlist: https://www.youtube.com/playlist?list=PLFdNoRgzggbr7tkQsO4VrF1UGy0ji9sZl
Decorators are an amazingly elegant way of introducing flexibility to your code without changing existing functionality. In this video, we will see a prime situation in which attack moves for a game can be layered beautifully with the decorator pattern, all while increasing modularity, readability and testability.
00:00 Intro
00:50 Introductory example
02:43 Naive attack extension
04:05 Problems of the naive extension
06:05 Decorator pattern
10:13 Applying decorators to our example code
12:19 Static vs dynamic dispatch
14:13 Visitor vs decorator pattern
15:00 When to use decorators
15:35 Typical use cases
Find this code on GitHub: https://github.com/Thodin/rust-decorators