Still a learning noob... I have come to kind of have an 'ah ha' moment. In the oo paradigm the state is inside the object, which IS to say the DATA is in the object and running a function (method) on that object (which is the instance which means a running code with real stuff in it)(the class is a blueprint to build it, the same as a type is a blueprint) multiple times may give back different results. I know, you are like DUH! That data could have changed between the time of running the method once, data changed, then method ran again and different result.
Using the functional paradigm, YOU are providing the state/data to a function and if you provide the same input, the result will be the same every time. Or that is the goal. IO (things that can fail like network down) screws that up.
So it really is a matter of analyzing where you control the state/data like are you providing and tracking it or just issuing commands and seeing what you get back from the object.
I know, I know, this is basic for most of you, just maybe it will help someone else. I like the syntax of F# and I am finding that it can be as OO as you want as well, cuz sure, runs on same as C# etc. So I have had to struggle with what is really different. I have been digging into running F# on WASM very deeply and state and objects vs what is idiomatic in F#/functional has been a real stumbling block. I have been hacking Bolero very hard and github source of Blazor ComponentBase.
I finally came to realize that I can do an object in F# (a class) that is based on the ComponentBase and then a Bolero inherit and then say that is my conceptual line. That has to be an object to take advantage of wasm and blazor, but I just push the "page" (or html) to that object and let it render it. the logic is under my control in the style I would rather work in. (In case anyone wants to know, I am trying to see what the SAM pattern idea looks like in real F# code on WASM.) sam.js.org I am not as much a fan of ELM currently.
I have been trying to "get" F# for 10 years since watching Scott in a video that long ago. Some of these concepts are finally starting to click and become real things to use :)
Did you find this article valuable?
Support Ivan Rainbolt by becoming a sponsor. Any amount is appreciated!