TLDR Dev · ARTICLES & TUTORIALS
FILTERING AS DOMAIN LOGIC
Summary from the TLDR Dev newsletter
It's hard to guarantee correctness and testability for complex filtering logic embedded in server-side database queries. Instead, it's better to shift intricate filtering to a client-side Domain Model, where it can be thoroughly tested using standard tooling. To maintain performance, a simpler, coarse-grained filter is retained on the database server, and this server-side filter must be "wider" to make sure no essential data is inadvertently excluded.