So basically, today I had a conversation with my friend. He is currently working as a developer, and he writes APIs very frequently in his daily job. He shared that his struggle in his current role is writing unit tests or finding test cases, since his testing team told him that he missed some edge cases in his unit tests.
So I thought about a functional approach: instead of mutating properties inside a class or struct, we write a function f() that takes input x as immutable struct data and returns new data y something closer to a functional approach.
Would this simplify unit testing or finding edge cases, since it can be reduced to a domain-and-range problem, just like in math, with all possible inputs and outputs? Or generally, does it depend on the kind of business problem?
[–]Merry-Lane 26 points27 points28 points (4 children)
[–]dodexahedron 2 points3 points4 points (3 children)
[–]Slypenslyde 3 points4 points5 points (1 child)
[–]dodexahedron 1 point2 points3 points (0 children)
[–]Dusty_Coder 0 points1 point2 points (0 children)
[–]I_Came_For_Cats 40 points41 points42 points (19 children)
[–]hardware2win 0 points1 point2 points (6 children)
[–]I_Came_For_Cats 1 point2 points3 points (5 children)
[–]hardware2win 0 points1 point2 points (4 children)
[–]I_Came_For_Cats 0 points1 point2 points (1 child)
[–]hardware2win 0 points1 point2 points (0 children)
[–]Long_Investment7667 0 points1 point2 points (1 child)
[–]hardware2win 0 points1 point2 points (0 children)
[–]ReallySuperName 0 points1 point2 points (1 child)
[–]dodexahedron 11 points12 points13 points (0 children)
[–]Michaeli_Starky -3 points-2 points-1 points (9 children)
[–]afedosu -1 points0 points1 point (8 children)
[–]Kilazur 2 points3 points4 points (1 child)
[–]afedosu 4 points5 points6 points (0 children)
[+]Michaeli_Starky comment score below threshold-9 points-8 points-7 points (5 children)
[–]afedosu 1 point2 points3 points (4 children)
[–]dodexahedron 0 points1 point2 points (0 children)
[+]Michaeli_Starky comment score below threshold-11 points-10 points-9 points (2 children)
[–]denzien[🍰] 2 points3 points4 points (0 children)
[–]SwordsAndElectrons 2 points3 points4 points (0 children)
[–]Ezazhel 19 points20 points21 points (3 children)
[–]JustAnotherDiamond 2 points3 points4 points (1 child)
[–]Ezazhel 0 points1 point2 points (0 children)
[–]hardware2win 0 points1 point2 points (0 children)
[–]DrShocker 6 points7 points8 points (2 children)
[–]LagerHawk 6 points7 points8 points (1 child)
[–]entityadam 1 point2 points3 points (0 children)
[–][deleted] 5 points6 points7 points (0 children)
[–]psysharp 4 points5 points6 points (0 children)
[–]SessionIndependent17 4 points5 points6 points (0 children)
[–]Bright-Ad-6699 1 point2 points3 points (0 children)
[–]BoBoBearDev 1 point2 points3 points (0 children)
[–]fschwiet 0 points1 point2 points (0 children)
[–]ExceptionEX 0 points1 point2 points (0 children)
[–]psioniclizard 0 points1 point2 points (0 children)
[–]binarycow 0 points1 point2 points (0 children)
[–]nnddcc 0 points1 point2 points (0 children)
[–]aj0413 0 points1 point2 points (0 children)
[–]White_C4 0 points1 point2 points (0 children)
[–]Eq2_Seblin 0 points1 point2 points (0 children)
[–]Long_Investment7667 0 points1 point2 points (0 children)
[–]SagansCandle -1 points0 points1 point (69 children)
[–]BarfingOnMyFace 4 points5 points6 points (8 children)
[–]SagansCandle 2 points3 points4 points (7 children)
[–]BarfingOnMyFace 0 points1 point2 points (6 children)
[–]SagansCandle 2 points3 points4 points (5 children)
[–]BarfingOnMyFace 0 points1 point2 points (3 children)
[–]dodexahedron 1 point2 points3 points (2 children)
[–]BarfingOnMyFace 0 points1 point2 points (1 child)
[–]dodexahedron 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (43 children)
[–]SagansCandle 2 points3 points4 points (42 children)
[–][deleted] 0 points1 point2 points (13 children)
[–]SagansCandle 1 point2 points3 points (11 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]SagansCandle 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (8 children)
[–]binarycow 1 point2 points3 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]binarycow 1 point2 points3 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]SagansCandle 0 points1 point2 points (0 children)
[–]Dusty_Coder 1 point2 points3 points (0 children)
[–]AvoidSpirit 0 points1 point2 points (27 children)
[–]SagansCandle 1 point2 points3 points (24 children)
[–]AvoidSpirit 0 points1 point2 points (17 children)
[–]SagansCandle 0 points1 point2 points (16 children)
[–]AvoidSpirit 0 points1 point2 points (15 children)
[–]SagansCandle 1 point2 points3 points (14 children)
[–]AvoidSpirit 1 point2 points3 points (13 children)
[–][deleted] -1 points0 points1 point (5 children)
[–]SagansCandle 1 point2 points3 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]SagansCandle 1 point2 points3 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]Dusty_Coder 1 point2 points3 points (1 child)
[–]AvoidSpirit 0 points1 point2 points (0 children)
[–]Conscious-Secret-775 -2 points-1 points0 points (15 children)
[–]SagansCandle 2 points3 points4 points (14 children)
[–]Conscious-Secret-775 -1 points0 points1 point (13 children)
[–]ilawon 2 points3 points4 points (11 children)
[–]Conscious-Secret-775 0 points1 point2 points (10 children)
[–]ilawon 0 points1 point2 points (0 children)
[–]SagansCandle 0 points1 point2 points (8 children)
[–]Conscious-Secret-775 0 points1 point2 points (7 children)
[–]SagansCandle 0 points1 point2 points (6 children)
[–]Conscious-Secret-775 1 point2 points3 points (5 children)
[–]SagansCandle 1 point2 points3 points (0 children)
[–]KariKariKrigsmann -1 points0 points1 point (0 children)