Hacker News new | ask | show | jobs
by mtVessel 805 days ago
LINQ is an interesting example because it exists in two forms, query syntax and method syntax. You might consider these "mini-paradigms". Most users know one or the other. I've rarely met people who are equally proficient at both. But almost anything you can accomplish in query form can also be done in method form, and the industry has settled on method syntax as the standard.

Why do you think that is? I think it's because method syntax fits more neatly into the larger C# paradigm of imperative code. Using both requires the developer to pivot to a different mental model (declarative coding), so we try to standardize on the one that fits best in the bigger picture. This is what I mean by cognitive load. Most devs can surely handle both, but why make them do extra mental work when that effort is better spent on the problem domain.

1 comments

I think it is more about education, the way "we" study/teach programming than an intrinsecally problem about paradigms. I personally find the query syntax better and I am not working as a developer "anymore". I would say that is a matter of taste and education. Related [1]. Personally, I look for simple and clear syntaxes and don't have a problem switching from one programming language to another while the focus in the solution is clear.

[1] https://www.reddit.com/r/csharp/comments/w7n11s/why_does_the...

I understand what you're saying, and I agree people should be able to switch as needed. But look at one of the top comments from that link (I swear that wasn't me):

"I find query syntax nigh unreadable. It's like someone stuck some other language in the middle of my C#. The mental switch between that small snippet of code and the surrounding code is harsh and annoying." [1]

[1] https://www.reddit.com/r/csharp/comments/w7n11s/why_does_the...