File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
06.composition-vs-inheritance Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 3232
3333## Prerequisites
3434
35- - [ Programming Foundations] ( https://github.com/epicweb-dev/programming-foundations ) workshop
35+ - [ Programming Foundations] ( https://github.com/epicweb-dev/programming-foundations )
36+ workshop
3637- [ Structured Data] ( https://github.com/epicweb-dev/structured-data ) workshop
37- - [ Type Safety] ( https://github.com/epicweb-dev/type-safety ) workshop (or equivalent knowledge)
38+ - [ Type Safety] ( https://github.com/epicweb-dev/type-safety ) workshop (or
39+ equivalent knowledge)
3840- Understanding of interfaces and type annotations
3941
4042## Pre-workshop Resources
Original file line number Diff line number Diff line change @@ -21,8 +21,9 @@ flexibility.
2121
2222<callout-info >
2323 OOP is a tool, not a religion. Many successful TypeScript codebases use a mix
24- of OOP and functional patterns. Use the right tool for each situation—sometimes
25- that's a class, sometimes it's a function, and often it's a combination.
24+ of OOP and functional patterns. Use the right tool for each
25+ situation—sometimes that's a class, sometimes it's a function, and often it's
26+ a combination.
2627</callout-info >
2728
2829Congratulations! You've completed the Object-Oriented TypeScript workshop! You
Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ class ShoppingCart {
4040``` ts
4141type Cart = readonly Product []
4242const addItem = (cart : Cart , product : Product ): Cart => [... cart , product ]
43- const getTotal = (cart : Cart ): number => cart .reduce ((sum , p ) => sum + p .price , 0 )
43+ const getTotal = (cart : Cart ): number =>
44+ cart .reduce ((sum , p ) => sum + p .price , 0 )
4445```
4546
4647** Both are valid.** OOP excels at encapsulation and polymorphism. FP excels at
You can’t perform that action at this time.
0 commit comments