• pinchcramp@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    121
    arrow-down
    1
    ·
    edit-2
    1 year ago

    Bash 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
      link
      fedilink
      arrow-up
      42
      arrow-down
      2
      ·
      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
        link
        fedilink
        arrow-up
        24
        arrow-down
        2
        ·
        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
        link
        fedilink
        arrow-up
        11
        arrow-down
        1
        ·
        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.

      • zygo_histo_morpheus@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        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
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        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 when 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 ssh 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

      • 30p87@feddit.de
        link
        fedilink
        arrow-up
        5
        arrow-down
        2
        ·
        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.

        • lud@lemm.ee
          link
          fedilink
          arrow-up
          7
          ·
          1 year ago

          You shouldn’t really use CMD at all anymore. It’s pretty shit. Just use PowerShell (I prefer the newer version 7)

        • Tathas@programming.dev
          link
          fedilink
          arrow-up
          4
          ·
          1 year ago

          You’re talking about PowerShell but then complaining about cmd. Are you unaware that PowerShell is its own cli?

      • Schmeckinger@feddit.de
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        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. I don’t know exactly what made that happen, but I think it had something to do with functions or classes.

    • Lupec@lemm.ee
      link
      fedilink
      arrow-up
      14
      arrow-down
      1
      ·
      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.

      • nous@programming.dev
        link
        fedilink
        English
        arrow-up
        15
        arrow-down
        1
        ·
        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.

    • JackbyDev@programming.dev
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      1
      ·
      1 year ago

      Yeah, anything to do with iterative over strings. Basically anything that involves IFS is unintuitive.

    • atheken@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      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.

    • UFO@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      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
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        1 year ago

        I don’t think it’s just a you problem :)

        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 think you’ll find ZSH more intuitive to program. While it is an awesome interactive shell, the scripting part is Bash taken to the extreme.

    • Jummit@lemmy.one
      link
      fedilink
      arrow-up
      16
      ·
      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.

    • space@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      1
      ·
      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.

  • The Giant Korean@lemmy.world
    link
    fedilink
    English
    arrow-up
    42
    ·
    1 year ago

    If by “hard to understand” you’re including trying to understand someone else’s code, Perl can be a nightmare.

      • Dave.@aussie.zone
        link
        fedilink
        arrow-up
        46
        ·
        edit-2
        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
        link
        fedilink
        English
        arrow-up
        9
        arrow-down
        1
        ·
        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.)

        • The Giant Korean@lemmy.world
          link
          fedilink
          English
          arrow-up
          5
          ·
          1 year ago

          When I was a Perl programmer, I had to modify this other guy’s code, and all I could think was that this guy was writing code with job security in mind.

        • miversen33@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          Imo the amount of magic variables in perl is too damn high.

          Like I don’t want to have to keep all that in my head while parsing through thousands of lines of code. I spent a few years working as a perl developer and even near my last days there I still found myself digging through docs to figure out what certain symbols meant and did.

          My first developer role was as a junior developer and I was tossed into single letter variable loop hell in perl lol.

          I was telling my mentor that if I were introduced to perl now that I’ve got several years of experience in a variety of different languages and thought models, it probably wouldn’t bother me as much. I kind of like bash (sometimes) and perl is really a hyper extended scripting language so going from bash to perl isn’t too bad. But given that that is what I was started in, I have a massive distaste for it and I doubt that will ever change.

          • RichieAdler 🇦🇷@lemmy.myserv.one
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year ago

            Imo the amount of magic variables in perl is too damn high.

            “Explicit is better than implicit” and “There should be one-- and preferably only one --obvious way to do it” in The Zen of Python exist, I’m sure, as a direct reaction to Perl’s magic variables and TIMTOWTDI.

    • frezik@midwest.social
      link
      fedilink
      arrow-up
      4
      ·
      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.

  • alokir@lemmy.world
    link
    fedilink
    arrow-up
    39
    ·
    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
      link
      fedilink
      arrow-up
      11
      ·
      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
      link
      fedilink
      arrow-up
      9
      arrow-down
      1
      ·
      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
        link
        fedilink
        English
        arrow-up
        2
        ·
        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
      link
      fedilink
      arrow-up
      7
      arrow-down
      1
      ·
      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

    • AnUnusualRelic@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      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
        link
        fedilink
        English
        arrow-up
        10
        arrow-down
        1
        ·
        edit-2
        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 and then various obtusely named variables 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

        • AnUnusualRelic@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Those magic match variables from regexen weren’t very legible if you weren’t a little familiar with them, but they were super useful in lots of cases. Perl could be a godsend to quickly parse lots of text.

  • glad_cat@lemmy.sdf.org
    link
    fedilink
    arrow-up
    28
    ·
    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.

  • noproblemmy@programming.dev
    link
    fedilink
    arrow-up
    22
    arrow-down
    1
    ·
    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
      link
      fedilink
      arrow-up
      9
      ·
      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
        link
        fedilink
        arrow-up
        6
        ·
        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
      link
      fedilink
      arrow-up
      6
      ·
      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.
    • Chobbes@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      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
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      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.

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    24
    arrow-down
    3
    ·
    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
      link
      fedilink
      arrow-up
      2
      arrow-down
      2
      ·
      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.

        • miversen33@lemmy.world
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          1 year ago

          A pointer is nothing but an integer that “points to” a memory location.

          They can feel intimidating because it’s really easy to footgun with them, but they are not as complicated as they appear :)

          • JackbyDev@programming.dev
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year ago

            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.

  • lysdexic@programming.dev
    link
    fedilink
    English
    arrow-up
    18
    ·
    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.

  • 0xc0ba17@sh.itjust.works
    link
    fedilink
    arrow-up
    13
    ·
    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
      link
      fedilink
      arrow-up
      3
      ·
      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.

    • SpeakinTelnet@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 year ago

      From personal experience making the jump from Python to Julia was overall painless, it was probably made to be as well. I do agree that rust on the other end is something else. Even after clearing the whole rustlings course I was still brute forcing my way through code by relying on the compiler to tell me where borrowers were missing. Spoiler: everywhere!

    • AA5B@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      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. Variants of C and Java are all pretty easy. PERL and Groovy have been two of my favorites except I’m a strong believer in strict variable typing. I have to admit Python took some getting used to, because who makes spacing part of your code structure these days: I thought we gave that up many decades ago. The COBOLs of the world are pretty focused - I’m not sure if even call them a programming language, but fairly easy to embed a query or report in a real language

  • ComradeWeebelo@lemm.ee
    link
    fedilink
    arrow-up
    13
    arrow-down
    1
    ·
    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.

    • Potatos_are_not_friends@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      1 year ago

      Prayers man.

      We brought in a dept of data scientists when we bought a company.

      I never witnessed the worse code ever.

      I don’t know if they were all 1y bootcamp grads or something. I thought math formulas was supposed to be elegant. But everything was written top-down, no reusability, like coding excel formulas that feed one cell into another and takes a hour or two to calculate. I nope’d so fast out of one “system” they built which was just daisychaining SQL queries into a new file that is fed into another SQL query repeat 7 times.

      • 0xc0ba17@sh.itjust.works
        link
        fedilink
        arrow-up
        7
        ·
        1 year ago

        Mathematicians and scientists are notoriously awful programmers. They get shit done but with absolutely 0 regard to good practices and reusability.

      • UFO@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        1 year ago

        I’ve experienced similar.

        One thing that helped: separating research code from production.

        Research is to answer a decision problem and much of the optimization problems that are in software engineering do not, and should not, apply.

        Once the research problem is answered. Reproducing that answer with production quality systems should be it’s own project. This also serves as a reproduction of the science in the research. Satisfying that hallmark of the scientific method.

        Course, getting a company to agree to such an arrangement is near impossible. Especially if they have never been crippled by the mismatch expectations of putting research code in production.

        As that is an organizational problem not just an engineering problem, good luck convincing management.

        An alternative, if I can’t get such an arrangement is the building a platform that supports integration of research code. That can be… uh… hard. Aside from the people challenges not all tech can support such a platform.

    • thisisnotgoingwell@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      Bruh on one post people are bandwagoning rust and then on another post people calling it esoteric 🤣 hard to see what’s what past the hype. I mostly code in Python though so I might need to find out for myself