4 ms·
you can write horrid code intentionally in any programming language
by jitl 1y ago
you can write horrid code intentionally in any programming language
- mrweasel 1y agoIt just seems like it's happening way more often in JavaScript, but I've seen absolute horrid and confusing Python as well. The JavaScript syntax wasn't great to begin with, and as features are added to the language it sort of has to happen within the context of what's possible. It's also becoming a fairly large language, one without a standard library, so things just sort of hang out in a global namespace. It's honestly not to dissimilar to PHP, where the language just grew more and more functions. As others point out there's also some resemblance to C#. The problem is that parts of the more modern C# is also a confusing mess, unless you're a seasoned C# developer. The new syntax features aren't bad, and developers are obviously going to use them to implement all sorts of things, but if you're new to the language they feel like magical incantations. They are harder to read, harder to follow and doesn't look like anything you know from other language. Nor are they simple enough that you can just sort of accept them and just type the magical number of brackets and silly characters and accept that it somehow work. You frequently have no idea of what you just did or why something works. I feel like Javascript has reached the point where it's a living language, but because of it's initial implementation and inherit limits, all these great features feel misplaced, bolted on and provides an obstacle for new or less experienced developers. Javascript has become an enterprise language, with all the negative consequences and baggage that entails. It's great that we're not stuck with half a language and we can do more modern stuff, it just means that we can't expect people to easily pick up the language anymore.
- neonsunset 1y ago> parts of the more modern C# is also a confusing mess Do you have any examples?
- mrweasel 1y agoFor me, personally, heavy use of the => operator (which happens to coinside with my main complaint of a lot JavaScript code and anonymous functions). You can avoid it, but is pretty standard. Very specifically I also looking into JWT authentication in ASP.NET Core and found the whole thing really tricky to wrap my head around. That's more of a library, but I think many of the usage examples ends up being a bunch of spaghetti code.
- neonsunset 1y agoWait, what? The => operator is just for lambdas, short-form returns and switch expression arms, which is as common as it gets! Have you never worked with any other language which lets you do these? var say = (string s) => Console.WriteLine(s); or struct Lease(DateTime expiration) { public bool HasExpired => expiration < DateTime.UtcNow; } or var num = obj switch { "hello" => 42, 1337 => 41, Lease { HasExpired: false } => 100, _ => 0 }; You'll see forms of it in practically every (good) modern language. How on Earth is it confusing? Authentication is generally a difficult subject, it is a weaker(-ish) aspect of (otherwise top of the line) ASP.NET Core. But it has exactly zero to do with C#.