← Back to context

Comment by HiPhish

3 days ago

I really hope that functional programming and property-based testing [1][2] get taken seriously by real engineers who understand that it is important to know and understand what the program is doing. Something LLMs by their very nature cannot do.

I was writing a React application at work based on React Flow[3] and I was mucking about with state management libraries (because that's what the React Flow manual recommends). Maybe it was a skill issue on my part, but I had a hard time with the Zustand library. Then I read up on reducers in React and everything was perfectly clear. A reducer is just a pure function, it takes an existing state and an action and returns the new state. That's simple, I can wrap my brain around that. Plus, I know how to test a pure function, there is nothing to mock, stub or wrap. States and actions are just plain JavaScript objects, there is no history, no side effects, no executable code.

And this is where property-based testing comes in: if history does not matter it means I can randomly generate any valid state and any valid action, then apply the reducer function and verify that the resulting state has all the required properties. Only a formal proof would give me more certainty.

I fully understand people who want to use LLMs to write tests for them. Writing test cases is boring and tedious. There are many edge cases a human might miss. But relying on a guessing machine and praying it does not write nonsense is just plain irresponsible for someone who calls himself an engineer. People rely on the quality of our software for their work and personal safety. Property-based testing frees us from the tedium and will generate many more tests and we could write by hand, but it does so in a predictable manner that can be fully reasoned about.

[1] https://en.wikipedia.org/wiki/Software_testing#Property_test... [2] https://fsharpforfunandprofit.com/series/property-based-test... [3] https://reactflow.dev/

I agree with the core point: the more pure and deterministic a system is, the easier it is to reason about and test. Reducers + property-based testing push correctness into design, not brittle test cases.

One nuance though: property-based testing shines when the domain is already well-modeled. A lot of real QA pain comes where purity breaks down—distributed systems, async flows, partial failures, UI↔backend boundaries. At that point, the hard part isn’t generating tests, it’s reconstructing context.

On LLMs: I don’t think they should be trusted as correctness oracles either. Their real value isn’t guessing answers, but helping surface assumptions, generate counter-examples, and expose gaps in our mental model.

So the future of QA isn’t humans vs LLMs. It’s better system design + explicit invariants + tools that help engineers doubt their own certainty faster. Most serious bugs come from being sure we understood the system when we didn’t.