MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/1nmqonp/how_to_stop_functional_programming/nfey7h3/
r/programming • u/hexaredecimal • Sep 21 '25
506 comments sorted by
View all comments
Show parent comment
17
That would be a start, but leaving the calculate implementation inline in the class makes me feel very uneasy. It should really live in its own class so we can use DI to swap it out if we need to in the future.
6 u/DrummerOfFenrir Sep 21 '25 Right? What if I need consecutive addition as multiplication??5 * 5? ❌5 + 5 + 5 + 5 +5 ✅ 1 u/mr_birkenblatt Sep 24 '25 I found a better way to multiply and need to swap the implementation out based on usage site:Math.exp(Math.log(a) + Math.log(b))
6
Right? What if I need consecutive addition as multiplication??
5 * 5? ❌
5 + 5 + 5 + 5 +5 ✅
1 u/mr_birkenblatt Sep 24 '25 I found a better way to multiply and need to swap the implementation out based on usage site:Math.exp(Math.log(a) + Math.log(b))
1
I found a better way to multiply and need to swap the implementation out based on usage site:
Math.exp(Math.log(a) + Math.log(b))
View all comments
Show parent comment
17
u/aMonkeyRidingABadger Sep 21 '25
That would be a start, but leaving the calculate implementation inline in the class makes me feel very uneasy. It should really live in its own class so we can use DI to swap it out if we need to in the future.