You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: di_in_scala.md
+11-14Lines changed: 11 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,21 +8,18 @@ DI(Dependency injection)Its a popular concept for decoupling client and server i
8
8
DI encourages you to use the constructor patterns which means passing the target dependency as
9
9
a param when the creation source object happens.
10
10
## DI in scala can be achieved by 2 ways:
11
-
1. Frameworks
12
-
a. subcut
13
-
b. scaldi
14
-
c. guice
15
-
d. Macwire
16
-
e. Grafter
17
-
f. Airframe
18
11
19
-
2. Pure Scala
12
+
- Frameworks
13
+
- Macwire
14
+
- scaldi
15
+
- guice
16
+
- subcut
17
+
- Grafter
20
18
21
-
a. Cake pattern =>Notes: its an anti pattern. https://kubuszok.com/2018/cake-antipattern/
22
-
b. Reader Monad => Cats Notes: Remove dependencies from function arguments, and remodel the functions as partially-curried on those dependencies.
23
-
pass them to monadic functions with run() method(not via function arguments).But it has some performance overhead and it makes the scope of dependencies ambiguous.
24
-
25
-
c. Dependency Injection in Functional Programming : This approach needs to use IO Monad library like Cats Effect.
19
+
- Pure Scala
20
+
- Cake pattern =>Notes: its an anti pattern. https://kubuszok.com/2018/cake-antipattern/
21
+
- Reader Monad => Cats Notes: Remove dependencies from function arguments, and remodel the functions as partially-curried on those dependencies.pass them to monadic functions with run() method(not via function arguments).But it has some performance overhead and it makes the scope of dependencies ambiguous.
22
+
- Dependency Injection in Functional Programming : This approach needs to use IO Monad library like Cats Effect.
26
23
27
24
28
25
## Comparison chart
@@ -46,7 +43,7 @@ a param when the creation source object happens.
0 commit comments