LINQ and Learning To Be Declarative If you’re familiar with functional programming concepts, you may enjoy the idea of declarative programming using LINQ or Language Integrated Query. Querying data is a common solution to a lot of problems in business, but within itself we get a lot of different issues. What’s the best way to query data? SQL is by far the weapon of choice for most developers. It’s simple to pickup and is performant as long as your DBA has some sense of professionalism. After you learn the quirks of your specific flavor of SQL, it’s straightforward to solve the majority of problems you encounter. While LINQ and SQL both facilitate data querying, their use cases diverge. LINQ integrates directly into the host language and can operate over in-memory collections or data providers, whereas SQL remains for direct interaction with relational databases. SQL is still preferred for relational data problems and large-scale ETL. The question remains: What if you don’t have access to SQL directly? Data is often stored in strange places, like an XML document or a random unstructured format. As said by C# language designer Eric Lippert: When querying a database, functional programming works extraordinarily well. LINQ is entirely based on the idea of constructing immutable query objects that can be turned into efficient database queries. - Eric Lippert on his blog in 2016 Functional programming isn’t an afterthought in C#, it’s effective and you should learn it if you haven’t already. Being declarative is a legitimate style of programming here and can be used to your advantage to write incredibly concise one-liners that will make your code easier to read. https://en.wikipedia.org/wiki/Functional_programming https://en.wikipedia.org/wiki/Language_Integrated_Query https://en.wikipedia.org/wiki/SQL https://x.com/ericlippert https://ericlippert.com/2016/01/14/functional-style-follow-up/ From Imperative to Declarative The Business Problem You’re a backend engineer worki...
First seen: 2025-10-16 14:48
Last seen: 2025-10-16 16:49