Home
Starting Up
Case Studies DB
Products
Ideas DB
Vibe Coding Tools
Subscribe to IH+
Starting Up
Case Studies
Ideas DB
Products DB
Join
14
Likes
4
Comments
Functional programming in Rust
by
Ryan Randall
https://kerkour.com/rust-functional-programming
I think that imperative code is easier to understand at an intuitive level, since, in real life, we don't deal much with recursion and immutable objects. However, it is very difficult to reason about formally and prove properties like correctness, complexity easier. On the formal reasoning front, functional wins most of the time.
So, all other things equal, I like a functional approach for formal problems like when building algorithms (most of the time). On the other hand, I find it much easier to use an imperative approach when trying to implement business logic and constraints as they pertain to users and the real world.
I agree mostly, but used in imperative code-bases, it can be a nightmare when it comes to debugging - at least, I find it harder to understand the division of responsibility. Yes, not having to define new classes saves time, but having fewer "categories" or "definitions" also means less structure - all functions blur into one.
Oh really? I actually think it's more formulaic and easy to understand. If I had to read a series of code for example and explain it to someone, I'd find this a much more intuitive way to talk through the process.
Isn't writing functions that depend on other functions as input essentially the same as dependency injection, except with functions as opposed to objects? It seems to me like this would complicate things if anything.