Brainfuck
Which programming language is hard to understand?
Submitted 1 year ago by Albin7326@suppo.fi to programming@programming.dev
Comments
drew_belloc@programming.dev 1 year ago
Jummit@lemmy.one 1 year ago
Actually one of the few languages you can learn in its completeness in less than a day, so I wouldn’t really say it’s “hard to understand”. More like hard to read and understands programs written in it.
drew_belloc@programming.dev 1 year ago
You have a point
dingleberry@discuss.tchncs.de 1 year ago
Have you ever taken a look at Windows API, it’s disgusting.
qevlarr@lemmy.world 1 year ago
Uh? It’s about what I expect. Anything in particular?
space@lemmy.dbzer0.com 1 year ago
I honestly don’t think it’s so bad. There are some things which make it look ugly, the Hungarian notation, the fact that it’s a C API which means everything has to be functional and there are many limitations, and there is a lot of legacy stuff kept for backwards compatibility. There is a lot of "we did it this way before we knew the right way of doing it, but now we’re stuck with it because of backwards compatibility.
I think MFC is a lot worse. It’s basically a C++ API that wraps a lot of things from the win32 API. It heavily relies on macros, and I really dislike it in general. And don’t get me started on COM.
TheGiantKorean@lemmy.world 1 year ago
If by “hard to understand” you’re including trying to understand someone else’s code, Perl can be a nightmare.
DirigibleProtein@aussie.zone 1 year ago
I’ve heard a few people refer to perl as a “write-only” language.
dgriffith@aussie.zone 1 year ago
// Dear programmer // // When I wrote this code, both God and I // knew how it worked. Now only God knows!! // // Therefore if you are trying to optimise // this routine and it fails (most surely) // please increase this counter as a // warning for the next person // // total_hours_wasted_here = 254
ajjlyman@lemmy.sdf.org 1 year ago
There’s some truth to it, but it’s mostly that junior developers and senior developers with no discipline that give it a bad name.
The major problem is that it has one of the the highest capacities for writting incredibly dense code there is, paired with very powerful language transformation tooling (i.e. switch statements were added as a module, but can also be used for funny evil.)
frezik@midwest.social 1 year ago
Perl isn’t particularly worse than JavaScript. Which itself has a lot of quirks, of course. The big thing with Perl is getting your head around list and scalar context. There’s a learning curve to it, but can be very powerful once you understand. I wish more languages would do list flattening by default.
richieadler@lemmy.myserv.one 1 year ago
Or your own after six months.
alokir@lemmy.world 1 year ago
Depends on what you already know.
Functional languages like Haskell, Clojure or Erlang have a reputation of being hard to grasp.
Rust’s borrow mechanics are hard for some people at first, especially because it’s very unique to the language.
Javascript can be frustrating because it also has some rare features among popular languages, and uses the same keywords for different concepts. It’s not bad at all once you let go of your assumptions and dedicate the time to understand how it works under the hood.
C++ is also notorious for being hard but I haven’t used it for a very long time so I can’t say anything about it.
tatterdemalion@programming.dev 1 year ago
Javascript can be frustrating because it also has some rare features among popular languages, and uses the same keywords for different concepts.
I don’t think those are the reasons JS is frustrating.
gpopides@lemmy.world 1 year ago
For Erlang I would say that the hard part is not the language itself (maybe a bit because it is influenced by prolog) but because of the mental model. Using concurrency and parallelism as core concepts of the language and understanding that you don’t need a lot of the external tools you would with the more mainstream languages is what’s hard imo.
JackbyDev@programming.dev 1 year ago
Yeah I bet, I’ve always wanted to learn Erlang. People always speak to highly of it. The guy that made Sonic Pi was saying he wished he would’ve used it because Sonic Pi involves a lot of music loops playing at the same time and stopping individual ones and modifying them etc and because so many of those concepts are baked in he said it would’ve been nice
Nulubez@sh.itjust.works 1 year ago
Clojure : if lisp had an illegitimate baby with java. Add to it the pain of setting up fireplace in vim or having to use emacs. At a former employer we had one area in closure. I could read it without much difficulty but damn if it didn’t take me weeks to write or update it
sping@lemmy.sdf.org 1 year ago
Perl is a write-only language.
AnUnusualRelic@lemmy.world 1 year ago
You can write clean Perl easily. But it’s maybe a bit easier to write illegible code in Perl than in most other languages. It’s all up to you though.
sping@lemmy.sdf.org 1 year ago
I am just regurgitating one of my favorite Perl jokes for a laugh. Though for me the joke contains some truth. Most of the Perl code I’ve ever seen is pretty impenetrable for non-Perl programmers. I quite literally have returned to my own Perl efforts after just a couple of weeks and had some trouble working out what the code is doing (in ways I do not experience with other languages).
When Python was trying to unseat Perl, that in my view was reason alone to prefer it: I didn’t know Python but I could read Python. Though at that point Perl had the benefit of loads of libraries and ubiquity, and Python hadn’t got there yet. But it was enough to have me cheering for Python’s success at the expense of Perl. I get that Perl has many virtues, but they’re nullified by the ugliness and relative inaccessibility of its code in my eyes.
I really hate the magic side-effect variables where you do a pattern match or something various obtusely named variables now have meaningful values with relation to the last match. To me that’s just flat out bad coding, and it’s built into the language.
The above was my second-favorite Perl joke. My favorite being:
Perl is the vise-grips* of programming languages. It’s a tool that can do most jobs, and it’s the wrong tool for all of them.
*BrEng: mole-grips
Nulubez@sh.itjust.works 1 year ago
I love perl. 20y on I still think in perl.
GuybrushThreepwo0d@programming.dev 1 year ago
Any language if the code was written by me
glad_cat@lemmy.sdf.org 1 year ago
C++ because you have multiple versions, you can write in different styles (C, OOP, functional, meta-stuff, very low level like assembly, very high level like Python), it has undefined behaviors, and you can waste your whole life optimizing code.
PoisonedPrisonPanda@discuss.tchncs.de 1 year ago
you can waste your whole life
chuckles I am in danger
JackbyDev@programming.dev 1 year ago
C and C++. The pointer syntax being slightly different than the pointer declaration syntax always confuses me to no end. I conceptually under pointers perfectly but their syntax is wack.
miversen33@lemmy.world 1 year ago
C is simple. Like really simple. Hardly anything exists in C lol. You have Integers, floats, chars, arrays, functions, pointers and structs. That’s it.
Therefore reading C isn’t too difficult.
Now doing anything in C? Lol have fun with that, nothing exists in C.
C++, you’re absolutely right lol the standard lib in c++ is so god damn big I don’t even know where to begin when using it. And there’s like a billion different ways to approach a problem there.
I like C. I don’t like working on C just because if you want a hashmap you must first build the universe lol. But c is fun.
I’ve been finding that same fun feeling in Rust though I haven’t used it long enough to know whether that’s just the “ohh new shiny” fun or “I really like this” fun.
JackbyDev@programming.dev 1 year ago
Reading anything to do with pointers in C is confusing to me. Sorry to disappoint you.
noproblemmy@programming.dev 1 year ago
Fearing a bit to say it but Haskell. I know that it is a different concept, but it’s not just that for me. The way the elements are separated, sometimes spaces sometimes symbols, makes it hard for me to understand how things are grouped, and what gets plugged into what.
dneaves@lemmy.world 1 year ago
Haskell for sure has a very sloped learning curve. The functional style, different syntax, a myriad of symbols and pragmas, as well as the tooling around it.
The only reason I was able to pick it up as quick as I did was because I was used to Elm due to my job. Then it was just learning about the IO type (and how to use it), cabal, stack, built-in symbols, and the most common pragmas.
But the symbols part is especially harsh, since symbols only hold meaning if they’re universally understood. Sure, the base- language ones are kinda adopted at this point, so they’ll stay, but the fact that external modules can also make symbols (sometimes without actually-named counterparts) adds some confusion. Like, would you just know what
.:
is supposed to mean off the top of your head?marcos@lemmy.world 1 year ago
Like, would you just know what .: is supposed to mean off the top of your head?
Yeah, it’s point-free shenanigans people use for code-golf and satisfying the linter.
If you caught yourself using it, you should probably reevaluate.
FizzyOrange@programming.dev 1 year ago
I agree. OCaml too. I think there are several factors that lead to it being very difficult to read other people’s code:
- Currying and lack of syntax in general means you have to be a human parser for basic things like “which part of the text is a function name? which bits are arguments?”. Often it’s impossible to tell without looking up the function definitions.
- The functional style - while generally great - also makes it very tempting for people to write enormous heavily nested functions where the control flow is hard to follow. You sometimes get assignment expressions that are hundreds of lines long.
- Haskel & OCaml feature global type inference. Programmers often omit explicit type annotations which very often means that function types are inferred as generic. This means you lose several huge benefits from static types. For example you can no longer look up the types that will actually be passed into the function, and inferring the authors intent is much harder. It also makes error messages way more confusing.
- I don’t know why but Haskel and OCaml programmers love stupidly short identifiers.
- They also abhor comments.
JackbyDev@programming.dev 1 year ago
Same here. The syntax is just different enough from the C family for it to totally scramble my brain.
Chobbes@lemmy.world 1 year ago
I like Haskell, but the syntax is probably the worst part about it. The ability to define your own infix operators with arbitrary precedence / associativity is really cool and useful, but can make it a complete mess to read because then you have no idea how any of the operators combine. I vaguely like the syntax, there’s something kind of clean about it, but frankly if it was just a lisp it would be so much easier for people to pick up (aside from the fact that nobody would because it would look like lisp).
Knusper@feddit.de 1 year ago
I write tons of functional code and am still no fan of Haskell’s syntactical choices.
It’s trying to look like basic English or maths equations, when programming is not that. Programming has more concepts. And those concepts deserve being denoted by punctuation.
lysdexic@programming.dev 1 year ago
Objective-C and Objective-C++ are an abomination. Extending languages with other language constructs is ok, I guess, but I find Apple’s extremely poor documentation to worsen a situation that’s already quite bad.
JackbyDev@programming.dev 1 year ago
Objective C++ sounds scary. Two object systems living totally unaware of each other.
lud@lemm.ee 1 year ago
INTERCAL seems pretty hard. Its compiler error messages are pretty funny: gist.github.com/…/a5c73557230dee1f7a3934d6a7abee1…
PoisonedPrisonPanda@discuss.tchncs.de 1 year ago
i mean. i like good jokes
But why? insert meme here
vidarh@lemmy.stad.social 1 year ago
0xc0ba17@sh.itjust.works 1 year ago
The hardest languages to learn are the ones that have a different paradigm than the ones you’re used to.
Most modern languages today somehow derive from C, in a way or another. JavaScript, Go, PHP, Java, C#, even Python… If you’re used to one of these languages, you should be able to get a high level understanding of code written in other languages. Some like Rust can be a bit harder when diving into idiosyncrasies (e.g. borrow checker and lifetimes), but it’s not too hard.
But if I encounter a Lisp, or a more domain-specific language like Julia or Matlab, I need to put in a lot more effort to understand what I’m trying to read. Though Lisps are inherently simple languages, the lack of familiarity with the syntax throws me off.
Klear@lemmy.world 1 year ago
I’m not much of a programmer, but when I was a kid I used to play around in QBasic. Then dropped all programming for decades and picked up Lua a few years back. Made me realise it’s more of a dialect than a new language.
AA5B@lemmy.world 1 year ago
I had the most problems with Ruby, or was that Rails. However I have to admit I gave up quickly. It left me with the impression the language itself doesn’t do much but the magic is all in the framework. You can’t follow the logic but have to know where things are, you have to know whatever assumptions the framework started with, but they don’t seem to be set anywhere.
That was the paradigm jump I didn’t make, didn’t want to make. APL was just so much more straightforward, because it was logical.
ComradeWeebelo@lemm.ee 1 year ago
I find syntax wise, Rust is very closely bordering on esoteric. My employer is currently considering switching to Rust and I can say working in a department with a bunch of Data Scientists with varying degrees of programming experience and capability, this switch, if it happens, will probably be poorly received.
naonintendois@programming.dev 1 year ago
Malbolge en.m.wikipedia.org/wiki/Malbolge
It required a cryptanalyst to write hello world.
vidarh@lemmy.stad.social 1 year ago
Ignoring the intentionally esoteric languages, of languages in actual use: J, K. Any descendant of APL, basically, and APL itself, though arguably APL is less obtuse than many of its descendants.
E.g, quicksort in J:
quicksort=: (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#)) ^: (1<#)
(No, I can not explain it to you)
Synthead@lemmy.world 1 year ago
Probably whitespace.
TheCee@programming.dev 1 year ago
Please clarify, OP, did you mean
- hard to read semantically
- hard to read syntactically
- hard to relate how one could come with such a crappy idea, even considering all constraints of their time
- takes a lot brain real estate (justified or not)
?
onlinepersona@programming.dev 1 year ago
Haskell. I’ll just repeat what I said elsewhere: monads are escape hatches to imperative programming. The majority of haskell code I’ve read in projects must’ve been written by imperative programmers who picked up haskell, because there are monads everywhere.
But the hardest to read are List, then C, then C++. Even PHP is easier to read.
dicknipples@sh.itjust.works 1 year ago
Brainfuck
thepianistfroggollum@lemmynsfw.com 1 year ago
No one has mentioned COBOL yet, but COBOL.
yogsototh@programming.dev 1 year ago
malbolge
and just after haskell
AMDmi3@lemmy.world 1 year ago
Hard to understand as in learning it or as in reading others code?
shagie@programming.dev 1 year ago
APL and J have made there appearance in here with their awkward syntax and have the advantage of being practical languages in actual use.
Esolanguages are often things that are designed to be difficult in some way, shape, or form. Brainfuck is awkward, but it’s the source of some interesting problems that are only practical because it is such a simple language.
The thing is, once you get your head around it, it isn’t too bad of a language.
I was introduced to FRACTRAN (wiki) in Project Euler - projecteuler.net/problem=308
That one… still is beautiful and confusing. It’s based on the manipulation of variables through Gödel numbering (wiki). The program: ( ^455^/~33~ , ^11^/~13~ , ^1^/~11~ , ^3^/~7~ , ^11^/~2~ , ^1^/~3~ ) will multiply the exponents of 2^a^3^b^ leaving the result in 5^ab^.
The program ( ^17^/~91~ , ^78^/~85~ , ^19^/~51~ , ^23^/~38~ , ^29^/~33~ , ^77^/~29~ ^95^/~23~ , ^77^/~19~ , ^1^/~17~ , ^11^/~13~ , ^13^/~11~ , ^15^/~2~ , ^1^/~7~ , ^55^/~1~ ) will loop forever, however as it runs the state of the program will occasionally be just a power of 2 with all the other powers (variables) being zero. Those values are: 2^2^ , 2^3^ , 2^5^ , 2^7^ , 2^11^ , 2^13^ , … and so on. It computes prime numbers and stores them in the power of 2 before going to compute the next one.
While I understand the idea of Gödel numbering, the manipulation of those numbers through this process still is difficult for me.
Mandrew002@lemm.ee 1 year ago
Python
kuneho@lemmy.world 1 year ago
once I tried to read a Progress code (never before) and I tried to understand it, but I couldn’t.
I guess Progress itself isn’t too hard, but the very first contact with a code left me confused
jadero@programming.dev 1 year ago
For me, Unison is basically inscrutable. I know that part of it is that functional programming is 100% completely brand new to me, so there is just too much to take in all at once.
One of my retirement projects is to learn functional programming. I’m hoping that will be enough to get me far enough along to be able to figure out the other parts.
jeffhykin@lemm.ee 1 year ago
Prolog. I like Prolog but it’s unlike any other language, and it’s pretty hard to fully understand.
TehPers@beehaw.org 1 year ago
Before type hints, I would have said Python, but these days it’s Javascript. It takes a lot of effort to write decent size Javascript projects that others can read snippets or without any context and immediately understand well enough to contribute back to, from my experience. It’s doable, but when working on a project with others (especially when the project isn’t even your own), it can become difficult to follow the code in my opinion.
If we include esoteric languages, Seed is actually unreadable by any normal person. Writing code in Seed is extremely difficult, and with an inefficient algorithm (yes you can inverse the RNG to generate seeds directly), can be computationally expensive.
Templa@beehaw.org 1 year ago
Scala. I’d love to learn it though!
pinchcramp@lemmy.dbzer0.com 1 year ago
Back script. Not necessarily hard to understand but very unintuitive in my opinion. I’ve written so much bash script over the years and still have to look up how to do simple things like iterate over associative arrays or do basic string manipulation. Maybe it’s just a me problem though 🤷
guy@lemmy.world 1 year ago
I have to write powershell scripts and bash scripts at work. I hear people saying bash is great, powershell is bad, all the time in public, but honestly I feel like these people have barely actually written powershell. It’s a bit wordy, but it feels much more intuitive to me, much more akin to regular programming languages.
NewDark@unilem.org 1 year ago
It’s newer and Microsoft based. Easy way to get a bunch of people on the hate train for those reasons alone.
shalafi@lemmy.world 1 year ago
PS was built from the ground up to be intuitive. There are some interesting videos from the MS devs talking about the design process.
30p87@feddit.de 1 year ago
It’s not necessarily PS itself, I bet it would be fine on a Linux machine with a typical Linux terminal. It’s just that I cannot stand the rest of Windows, especially the CLI part, especially cmd: Awful to no tab complete support, no command history across cmd restarts, if tab complete works its only for files and even sucks there because of the ignore case design and completing a full name instead of to the next clear step (eg. “tes” for a dir containing “test.exe” and “test.mp4” will complete to “test.exe” instead of “test.”). Additionally, I associate PS with Windows and tasks on it. Most things I want to run on Linux only I write in C/C++ (depending on the task itself ofc). If I want compatibility with Linux and Windows I use python. To install that script to a usable state it’s literally a single command on Linux, if the method of transferring the script (probably a git repo) supports saving the executable permission bit:
sudo cp script.py /usr/local/bin/patchjar.py
. Even if you want an own directory with your own path, that’s no problem: Just cp a .sh file to /etc/profile.d/ that appends to the path. And removing it is as easy as deleting that file. On Windows? Chocolatey has a ~100 line script just for that purpose, backs up the path just in case and even explicitly states uninstall it can break your whole system? Why? Because Windows uses a single global PATH variable for everything. You need to edit the registry, extract your path with loops, remove it and write it back. And that’s a pattern being repeated through the whole OS. You want to move a window on the screen or start something on another monitor? Well fuck you. On Linux?assign [app_id=TuxKart] workspace gaming
. For an OS claiming to be integrated with everything in itself that seems like pretty damn dumb and frustrating to a dev.zygo_histo_morpheus@programming.dev 1 year ago
I can see how PS might be better for writing actual programs in but the wordiness really gets in the way when youre just trying to write something on the command line so it feels poorly optimized for cli usage. Bash is very poorly optimized for writing programs otoh.
miversen33@lemmy.world 1 year ago
My main issue with PS is that it is JavaScripty. And by that I mean, it makes tons of assumptions on what I “mean” by my command. And it’s usually right and thus I don’t see any issues. But then those assumptions are wrong, I have to do all kinds of parameter fuckery to make it be what I “expect”.
None of that is true is bash. It doesn’t make many assumptions at all (at least none that I’ve come across). Things act the same when I’m using bash in a script vs the cli vs over an ash connection vs within a subshell, etc.
And ya the whole “it’s pretty verbose” is irritating too (though that could also be a counter argument against bash relying on magic variables and abusing the shit out of symbols).
I don’t hate PS but I don’t enjoy spending time in it. I don’t hate bash but it hurts me less when I use it
Schmeckinger@feddit.de 1 year ago
I have done a lot of powershell scripting and found some very annoying edge cases, they all have solutions, but feels unnecessary. I once had a issue, where I had a dynamic array of strings and if thst array was only 1 long it would give you the first character instead of the first string.
pirrrrrrrr@lemmy.dbzer0.com 1 year ago
The object model is much easier to understand in PowerShell.
AnUnusualRelic@lemmy.world 1 year ago
Bash does have a weird syntax. I too have to look stuff up all the time.
lupec@lemm.ee 1 year ago
Yup, same. I’ve been a developer for years and used to code way before that and to this day I can’t write any non trivial bash script without looking up half a dozen of things lol, glad I’m not alone.
I’ve recently come across nushell, and it’s everything I’ve ever wanted when it comes to shell scripting. It’s not POSIX compliant so you can’t just run it anywhere but it helps keep my sanity in personal projects and whatnot. See also, elvish, xonsh.
naonintendois@programming.dev 1 year ago
Even worse is Windows batch scripts. The syntax also changes depending on if it’s in the terminal or run from a file
JackbyDev@programming.dev 1 year ago
Yeah, anything to do with iterative over strings. Basically anything that involves IFS is unintuitive.
fubo@lemmy.world 1 year ago
In shell languages, concurrency is easy and everything else is hard.
nous@programming.dev 1 year ago
Concurrency is not easy if you need the output and exit status of the commands. Fire and forget concurrency/parallelism is easy in any language. It is when you need to sync state up that it becomes hard.
atheken@programming.dev 1 year ago
My running joke, after four different friends told me they were using ChatGPT to help them with it, is that the language is so hard to learn that we invented an entirely new class of AI to help.
It’s a joke, of course, but it does have some “surprising” syntax, since some stuff is whitespace sensitive, and there are subtle differences between () and [] and [[ ]], for example. All of that’s due to the long history of shell behavior, so I don’t necessarily blame bash.
UFODivebomb@programming.dev 1 year ago
I don’t think it’s just a you problem :)
I’ve been curious to try fish or zsh to hopefully run into less weirdness.
pinchcramp@lemmy.dbzer0.com 1 year ago
I didn’t think so. I guess Reddit has conditioned me to not state my opinion without a disclaimer, lest someone wants to start arguing :D
Btw. I don’t you’ll find ZSH more intuitive to program. While it is an awesome interactive shell, the weirdnes