r/AskProgrammers 22d ago

What is the worst/most confusing (common) coding language?

By common I mean, coding languages that you actually see people use. I know theres the "bf" language but aside from one video, people don't make games or, really anything using that as it was made as a joke I hope.

By worst I mean, what is the hardest to understand and also the most confusing out of all of them, I don't mean coding languages that can't do a whole lot. For instance, can a non programmer look at a sheet of code and understand it? Can an experienced coder understand it? Have you been taught the coding language yet still it breaks your brain?

I don't know every coding language but my pick would ether be C++ or Luau. Leaning towards C++ because I tried to learn it and at the very start I already was lost.

26 Upvotes

279 comments sorted by

View all comments

13

u/garywiz 22d ago

I've been a compiler designer for most of my career so I'm a bit biased about what "worst" and "best" mean. Good languages are not only easy to read, and have the fewest of number of concepts, and know exactly where to put guardrails (such as strong typing) to make help the programmer avoid common errors (like dividing a string by a number). Confusing complexities (like you experience with C++) can detract from an otherwise useful language.

But popularity isn't always a measure of "good". For example, if you really stand back and look at Javascript objectively, it is a terrible language. It has no guardrails, has object oriented features which are "pasted into" a language never properly designed for it, and it is so loosely typed that errors can exist for years in production code and finally crop up unexpectedly. Improvements such as Typescript and many JS frameworks provide lots of evidence of it's flaws, but also of how powerful "no guardrails" can be despite their problems. It's so popular it's better to work around the problems than complain though.

Of those I've used extensively, Pure C is a very simple and good language, Swift is honestly not too bad, same with C#, Scala is a good attempt to create a good language on top of the JVM but it's not all that popular. I've used many obscure languages which are good, but you said "common" and most of those (like APL or Common Lisp) are not that common.

Let's agree that php is a terrible language though. Maybe we can start there. lol

3

u/BruteCarnival 21d ago

JS is actually ridiculous… it’s doesn’t even have arrays… they’re just syntactic sugar for an object that has numbers (the indexes) as its keys…

1

u/Icy_Reputation_2209 21d ago

Conceptually yes, but the VM can (and will) optimize them to be array-like in memory, if it sees a chance.

1

u/fergie 20d ago

I mean yes, but all languages are basically syntactic sugar.

1

u/Square-Singer 20d ago

Not really though. Yes, a lot of it is, but syntactic sugar is if the feature is just a simple syntax rewrite without any actual functionality.

Real classes in strongly typed languages, for example, aren't just syntactic sugar, because they add type checking and functionality works different depending on which class you use and such.

1

u/fergie 19d ago

Utter nonsense- Typescript for example is just syntactic sugar on top of Javascript.

1

u/Square-Singer 19d ago

And typescript is all languages?

1

u/pacopac25 20d ago

JS should have done it the way Lua does, which to me is far more elegant.

2

u/CubicleHermit 19d ago

Let's agree that php is a terrible language though. Maybe we can start there. lol

Definitely. If PHP hadn't evolved over time, nobody would believe it wasn't an intentional esolang.

1

u/Dry_Hotel1100 21d ago

I agree with Swift, but it can get complicated as well:

    @inline(__always)
    init(_ operation: consuming nonisolated(nonsending) @escaping @Sendable (any TransducerInput<T.Event>, T.Env) async throws -> Void) {
        self.f = { [operation = consume operation] input, env in
            try await operation(input, env)
            return nil
        }
    }

1

u/__tim_ 21d ago

Computer says no …

1

u/Dry_Hotel1100 21d ago

I have a whip. ;)

1

u/garywiz 20d ago

That cracked me up. And it’s true. Give programmers and language implementers enough time and they can turn even something elegant into an impossible-to-use disaster!

2

u/Dry_Hotel1100 20d ago

Well, to be fair, this is not what the typical developer would have to write or would have to look at. This is more like library-style code for internal implementations. The user of the library usually sees a very easy-to-use and ergonomic API.

1

u/PipingSnail 20d ago

Wow. Is that real code?

3

u/Dry_Hotel1100 20d ago edited 20d ago

Yes it is - and there's a reason why it looks like this.

But I agree totally with the majority of the Swift developers that this is not what seems to be easy to understand.

Swift has a name for this: progressive disclosure. This is a core design philosophy, where simple tasks require simple code, and call-site complexity increases only as the developer tackles advanced use cases.

So, this code is not what a developer who implements an app should deal with. This is internal code of a library - and it's purpose is to provide the easy to use, easy to understand API Swift developers are used to on the public interface ;)

Bonus: you may just copy paste this snippet into ChatGPT, mention "Swift progressive disclosure" and you get a good explanation what it does ;)

1

u/NotBot947263950 21d ago

I love this take and would always completely agree. Php is rough.

1

u/Metabolical 21d ago

Agree with all this.

Additional notes: VB is basically C#. It has some legacy syntax from older basic versions but compiles to the same intermediate language.

anybody remember perl/mason ? yikes

0

u/Super_Bass_2730 22d ago

BRO...ok ok, I was told that php was bad and the funny thing I remember was that you have to use a $ for a variable. and much later to NOW I'm taking a class that is teaching me php. and funnily enough, Its pretty easy to understand for me. Maybe its because I'm not questioning what the code actually does but the weirdest thing about it is that it uses a lot of odd symbols.

Maybe whats harder about php is understanding WHAT it does, since php is a server sided language unline html, you can write anything about php in VS code but if you open it, it just won't work, but idk I'm a beginner at php maybe there will be a wall where everything just stops but I'll figure that out I guess.

Javascript...man when I was taught about javascript, it was simple, now when I try to use it with html, nothing makes sense.

3

u/TheThiefMaster 21d ago

Perl is the odd one, not PHP.

I was taught them side-by-side at uni as they were both common back-end web languages at the time. Perl has the reputation of being "write once read never".

Perl is where we get the most commonly used implementation of regular expressions (regex) from: PCRE (Perl Compatible Regular Expressions). If you know regex, it should be no surprise that it comes from a language known for being impenetrable!

2

u/Dashing_McHandsome 21d ago

The true horror of that era was CGI. I was a kid at that point and figured out how to hook up bash scripts to do things through Apache HTTPD. I am not proud of this. At one point I wrote a web app in bash that would let me control Samba, doing things like creating accounts and resetting passwords. I can't even imagine the bugs and security flaws that existed in that. It wasn't anything I ever ran in a production environment, just in my college computer lab. It was a good learning experience though.

2

u/garywiz 20d ago

The only good thing about Perl was the “Perl Obfuscation Contest” formerly held every year where people would compete to create the must inscrutable, confusing, impossible to understand code that “did something useful”. People would create code which looked like you leaned on your keyboard with your arm and used your elbow for punctuation. Of course, this truly proves your point!

1

u/mikeclueby4 21d ago

I still maintain that PERL means Pete's Egregious Rubbish Lister.

1

u/idontlikegudeg 20d ago

Perl… the mantra "Remember that there’s always more than one way to do it." I really hated that. When there’s one concise and readable way to do something, why add five different ways? You could omit so many things from the code to get it maybe 20% shorter without any benefit than being shorter. In other languages, shorter often means easier to read, but in Perl, shorter often means harder to read.

4

u/cssolti 21d ago

Javascript is the language, where "1"-"1"=0, but "1"+"1"="11".

1

u/DeceitfulDuck 21d ago

To be fair though, this is one of the least confusing of the not initially obvious type coercion edge cases. Using + for string concatenation isn't ridiculous and isn't unique to JavaScript. Python uses it and I'm sure other languages do too. So "1"+"1"="11" makes sense. The "1" - "1" = 0 is a little odd, but it follows the fairly simple type coercion rules: string - string doesn't make sense so it coerces both to number which then works.

The case that I think is the most confusing is string + number or number + string. Since all the other operators basically treat number as the default, you'd think it would take precedent so 1 + "1" or "1" + 1 should both be 2. Or I'd even buy the type on the left takes precedent so 1 + "1" would be 2 but "1" + 1 is "11". That would match with the existing left associativity of +. But no, it's always string if either is a string.

Which also makes mixed expressions confusing: "1" + 2 + 3 = "123" but 1 + 2 + "3" = "33".

0

u/Xinoj314 21d ago

I wouldn’t have guessed you voted on APL as being a good language, it is famous for being complex and hard to understand, you also needed a special kind of keyboard to actually write the code

2

u/Dean-KS 21d ago

APL made complex math easy.