3 ms·
Most of the code that I write, whether C#, VB.Net, or even VBA, I generally write as much as possible in functional, single assignment style, with all informati
by kwhitefoot 8y ago
Most of the code that I write, whether C#, VB.Net, or even VBA, I generally write as much as possible in functional, single assignment style, with all information needed for a function passed as arguments even if the routine could have just grabbed the value from a global. So generally only the top most layer does any mutation. I think it saves me a lot of debugging because I don't have to worry much about side effects and I always know what a variable actually means. It also means that when I want to reorganize the code or extract a function to use it in another project that there is less work to do.
- draw_down 8y agoSure, that sounds like the code I write too. What I meant by FP as an overarching principle was stuff like wrapping side effects in monads and generally pretending your program is just a math routine that happens to include a few side effects. I don’t find that a useful way to organize programs.