• AnarchoSnowPlow@midwest.social
    link
    fedilink
    arrow-up
    50
    ·
    8 小时前

    Programming languages, much like the jackass in the middle, are tools. Different tools are for different things. The right tool for the job can make your day. The wrong tool can make you question your entire career.

      • MotoAsh@piefed.social
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 小时前

        A tool of a person is a fool who is being used by someone else. They might not be useful to you, but to who ever makes the koolaid they’re drinking, they’re a very good tool.

    • staircase@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      edit-2
      7 小时前

      Sometimes I just want to use a particular tool, and care less what I’m making with it.

      I rarely get this pleasure at work.

      • ugo@feddit.it
        link
        fedilink
        arrow-up
        1
        ·
        2 小时前

        Exactly! There is no best tool. There is, however, a worst tool. It’s bazel.

      • Sundray@lemmus.org
        link
        fedilink
        English
        arrow-up
        22
        ·
        7 小时前

        And what is the best tool?

        AI! (This message brought to you by The Microsoft Marketing Dept.)

      • BatmanAoD@programming.dev
        link
        fedilink
        arrow-up
        9
        ·
        7 小时前

        That’s just not terribly meaningful, though. Was JavaScript the “best tool” for client-side logic from the death of Flash until the advent of TypeScript? No, it was the only tool.

        • theneverfox@pawb.social
          link
          fedilink
          English
          arrow-up
          8
          arrow-down
          1
          ·
          edit-2
          6 小时前

          You’re halfway there.

          Yes, it was the best tool, in context

          In that context, what was better?

    • Sunrosa@lemmy.world
      link
      fedilink
      arrow-up
      10
      arrow-down
      1
      ·
      6 小时前

      One of the reasons i find it so hard to use non-Rust languages is how ugly they typically are by comparison. “fn” instead of “function” is such a great example of saving key presses where they’re most needed. And you get very used to seeing compact abbreviations. Idk if that’s what you’re talking about though.

      • Lucy :3@feddit.org
        link
        fedilink
        arrow-up
        2
        ·
        1 小时前

        Rust:

        fn getofmylawn(lawn: Lawn) -> bool {
            lawn.remove()
        }
        

        C:

        bool getofmylawn(Lawn lawn) {
            return lawn.remove();
        }
        

        With Rust you safe 1 char, and gain needing to skip a whole line to see what type something is.

    • Ethan@programming.dev
      link
      fedilink
      English
      arrow-up
      28
      ·
      8 小时前

      Almost any language is ok but some ecosystems make me want to turn into a murder hobo (looking at you, JavaScript).

      • Lucy :3@feddit.org
        link
        fedilink
        arrow-up
        1
        arrow-down
        1
        ·
        2 小时前

        Also looking at Rust. Yeah, I totally like recompiling thousands of crates for a single webapp single-threaded.

      • Lucy :3@feddit.org
        link
        fedilink
        arrow-up
        4
        arrow-down
        1
        ·
        2 小时前

        Average Rust code:

        macro_rules! sum {
            ( $initial:expr $(, $expr:expr )* $(,)? ) => {
                $initial $(+ $expr)*
            }
        }
        
        fn remove_prefix<'a>(mut original: &'a str, prefix: &str) -> &'a str
        
        let mut up = 1;
            'outer: loop {
        

        Hell I don’t want to know what you define as ugly then.

      • tyler@programming.dev
        link
        fedilink
        arrow-up
        12
        arrow-down
        2
        ·
        9 小时前

        List comprehensions are much stranger than tabs vs spaces. There are very very very few languages that use them, and python’s is by far the worst out of the popular ones.

        • Ethan@programming.dev
          link
          fedilink
          English
          arrow-up
          11
          arrow-down
          3
          ·
          8 小时前

          Indentation-driven control flow is one of the most cursed things ever invented, excluding things explicitly designed to inflict pain or death.

          • KSP Atlas@sopuli.xyz
            link
            fedilink
            arrow-up
            1
            ·
            2 小时前

            Haskell has the choice of both indentation based and brackets for things like do blocks, but most people use indentation based cause it’s the norm and looks cleaner

          • qjkxbmwvz@startrek.website
            link
            fedilink
            arrow-up
            3
            ·
            5 小时前

            Per the Linux kernel coding style:

            Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.

            • hemko@lemmy.dbzer0.com
              link
              fedilink
              English
              arrow-up
              2
              ·
              2 小时前

              First off, I’d suggest printing out a copy of the GNU coding standards, and NOT read it. Burn them, it’s a great symbolic gesture.

          • TeamAssimilation@infosec.pub
            link
            fedilink
            English
            arrow-up
            9
            ·
            8 小时前

            Whatever your place defines as a standard. I’ve seen ugly code in C, JavaScript, Java, etc., that uses them all over the place because they’re not mandatory.

            If you don’t have consistent indenting, your code looks like copy/paste from several sources; but if you do have consistent indenting, then the indenting of Python is a non-issue.

      • aloofPenguin@lemmy.world
        link
        fedilink
        arrow-up
        4
        arrow-down
        3
        ·
        9 小时前

        This is the one thing I hate about python, because the spacing would differ between editors. I used vim to create the files on one system, and geany to edit them on another. Via uses 8 spaces in a tab (at least for me), while geany uses 4. This makes python mad, and drives me crazy.

        Also, the rules for whitespace separation between things like loops, methods, and the rest of the code is annoying/ wierd (at least to me).

        • who@feddit.org
          link
          fedilink
          English
          arrow-up
          9
          ·
          7 小时前

          Via uses 8 spaces in a tab (at least for me), while geany uses 4.

          You know that editors let you change their defaults, right?

          • Eager Eagle@lemmy.world
            link
            fedilink
            English
            arrow-up
            4
            ·
            edit-2
            5 小时前

            and that indentation defaults in decent editors are usually language dependent. I’m not familiar with these editors, but… come on - if they use one default for all files, OP should use a better tool.

          • aloofPenguin@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            6 小时前

            Yes, but I don’t normally program in python, so I never did. When I had to, I never thought of changing it (it wasn’t for long anyways and was less of a thought out decision to do programming in vim)

      • Lucy :3@feddit.org
        link
        fedilink
        arrow-up
        2
        arrow-down
        2
        ·
        2 小时前

        Average Rust code:

        macro_rules! sum {
            ( $initial:expr $(, $expr:expr )* $(,)? ) => {
                $initial $(+ $expr)*
            }
        }
        
        fn remove_prefix<'a>(mut original: &'a str, prefix: &str) -> &'a str
        
        let mut up = 1;
            'outer: loop {
        

        This is on the level of the esolang I made at 8 y/o, with random characters denoting random actions everywhere, at random positions.

        • 5C5C5C@programming.dev
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          3 分钟前

          It’s incredibly disingenuous to call this average Rust code and further erodes your credibility. I may as well point to hundreds of lines of preprocessor macros in a C++ header and call it average C++ code.

          This is not what an average Rust developer is writing 99% of the time. If someone on my team submitted a PR with an implementation of sum that uses macro_rules! I would almost certainly reject it.

      • UnderpantsWeevil@lemmy.world
        link
        fedilink
        English
        arrow-up
        17
        arrow-down
        4
        ·
        10 小时前

        Maybe they’re confusing the literal name with the language? Idk.

        I grew up on Perl and holy fuck… Rust is fine.

        • jackr@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          1
          ·
          2 小时前

          Perl is ugly but great. It’s like shell scripting with a more solid programming language. I’d never use it outside of simple scripts in my os, but whenever I do use it it’s very fun. Anyway, yeah, rust looks fine to me. Maybe they are not very experienced with it? I know some of my programs used to have lines with just x.unwrap().unwrap().unwrap() or whatever, which is not pretty.

        • Kacarott@aussie.zone
          link
          fedilink
          arrow-up
          6
          ·
          4 小时前

          The majority of its syntax is very similar to many other languages. Can you give an example of a language with pretty syntax?

          • Lucy :3@feddit.org
            link
            fedilink
            arrow-up
            1
            arrow-down
            1
            ·
            2 小时前

            Key point being, similar to some random languages. JS and Python Syntax don’t fit a typed and compiled language at all.

            Pretty syntax would probably be something like C, where not every single character already widely reserved for specific keywords (like !, ', =) is reused in completely random ways.

        • 5C5C5C@programming.dev
          link
          fedilink
          arrow-up
          2
          arrow-down
          3
          ·
          4 小时前

          Being unable to give an actual example proves you’re just a foaming-mouth hater with nothing to contribute.

          • Lucy :3@feddit.org
            link
            fedilink
            arrow-up
            3
            arrow-down
            4
            ·
            2 小时前

            From the first syntax examples on Wikipedia:

            fn main() {
                let foo = 10; 
                // Suddenly, types are implicit now. A safe language should never have implicit types (now it's the (IDEs) implementations judgement which type that is. Combined with the variable shadowing "feature", this seems like a major clusterfuck. Now the IDE is the sole thing to tell you that you totally fucked up the logic, and both declarations/definitions (well which one is it? Would be nice to always have a direct KEYWORD telling you which type this fucking variable has. But no, the lazy piece of shit Rust 'programmer' left that as an exercise to the dear reader. Because in they just need to leave that part out instead of explicitly stating "I'm a lazy piece of shit" by *instead* typing 'auto'.) This is just Python-level BS. Yes, I also hate C++ for its auto keyword - but at least it explicit.
                println!("The value of foo is {foo}");
                let foo = 20;
                println!("The value of foo is {foo}");
            }
            
            fn add_two(x: i32) -> i32 {
            // That is, again, the syntax of Python. Why? Because Python is explicitly untyped. So having types be a *literal* afterthought is Ok. They're fully optional anywhere there. Now we're in Rust. They're sometimes optional, sometimes not, but they're always preferred. Yet, they're also an afterthought, seemingly.
                x + 2
                // Implicit statements are bad. Very bad. They so much invite to glossing over stuff, especially when your brain expects to see something else. Also, having every statement ended with ;, except context blocks, but suddenly *not* having statements ending with ;, is fucking ugly (which is the entire point of this rant). It's completly inconsistent. Which in itself is a huge magnet for errors.
            }
            
            if x > 5 {
            // Now why would you leave the parantheses, which are a major contributor to readability, away. Or even allow this. Rust is just memory safe, like dozens of other mainstream languages, but continues by allowing, promoting and requiring hazardous practices.
                println!("value is greater than five");
            }
            

            Now I’m slowly getting annoyed from typing on phone (at least in nvim), and my throat gets clogged with mucus again.

            Remember, some of that are subjective preferences and opinions. And the core idea of Rust - fast but safe programs - is good, yet very obvious and not innovative at all, while the syntax and implementation (of cargo (yes I like to wait an hour for a simple webapp to compile because there aren’t binary crates and cargo just doesn’t multicore 99% of the time)) is subpar to something that’s hailed as the savior for everyone and everything by such a large cult.

            • 5C5C5C@programming.dev
              link
              fedilink
              arrow-up
              1
              arrow-down
              1
              ·
              7 分钟前

              Types are not implicit, they’re inferred by the compiler when there is no ambiguity about what the type needs to be. This is a huge benefit for refactoring code and reducing maintenance. I acknowledge that sometimes you might care to know the exact type of the variable, and sometimes that’s not as easy for a human to infer as it is for the compiler, but every decent IDE will provide inline type hints for you. Interpreting code by reading it in plaintext is an exercise in masochism.

              Python is actually the opposite on this, and it’s one of Python’s worst characteristics. The type is unknown until runtime unless you annotate it, and then the annotation isn’t really enforced. It’s the worst of every dimension.

              C++11 introduced auto, and now the community is split between “almost always auto” and “never auto”.

              JavaScript needed a whole new compiled language (Typescript) to fix its type system problems, and Typescript is only an incremental improvement at best.

              Rust has the best type system of any modern language by far. If you’re tripped up by not always seeing the type declarations then you’re either focusing on the wrong details in the code or you just need a little more practice. The key thing that needs to sink in for new Rust users is that the compiler is always providing safety rails. That means it’s no longer your job to verify that every aspect of the code is correct. You can relax a little and actually have something akin to duck typing without all the pitfalls that usually come with it.

            • [object Object]@lemmy.world
              link
              fedilink
              arrow-up
              3
              arrow-down
              1
              ·
              1 小时前

              If you don’t understand how having any statement be an expression is useful, you don’t have enough experience to criticize programming languages.

      • rtxn@lemmy.world
        link
        fedilink
        arrow-up
        13
        arrow-down
        8
        ·
        edit-2
        10 小时前

        Enums and nested blocks. I understand the importance of Option and Result, but it’s fucking infuriating when I have to check and destructure the result of every function call and either bubble the result up the stack from six levels of nested if let blocks or risk Cloudflaring my program by using .unwrap(). And while I like being able to extract a return value from an if...else expression, the structure gets really convoluted when multiple if and match blocks are nested (of course each one returning a value), and it gets completely fucked once closures are introduced.

        I like Rust, but calling it pretty is delusional.

        • marcos@lemmy.world
          link
          fedilink
          arrow-up
          15
          arrow-down
          4
          ·
          10 小时前

          have to check and destructure the result of every function call

          Learn how to use enum error types, how error bubbling works, and how to convert between Options and Results.

          It’s Rust you are talking about, not Go.

          • rtxn@lemmy.world
            link
            fedilink
            arrow-up
            5
            arrow-down
            5
            ·
            9 小时前

            This isn’t about some feature of the language being good or bad. It’s about Rust being ugly or not. The things I mentioned will always look ugly in the source code.

            • 5C5C5C@programming.dev
              link
              fedilink
              arrow-up
              3
              arrow-down
              1
              ·
              4 小时前

              It’s hilarious to me that people talk about “ugly” as if their opinions are objective.

              I found Rust unpleasant to look at for the first two weeks of learning it, and now that I’ve been using it professionally for three years I loathe when I need to read code in other languages.

              No other language can rival Rust in showing the exact information needed to understand the code — never too much and never too little — while being concise, correct, and handling all edge cases.

              You can be more concise in other languages, but it will come the loss of handling every little possible bug. You can be prettier in other languages, but it will come at the price of adding a lot of useless boilerplate.

              Of course there are cases where Rust can be verbose or confusing, but that’s when you’re doing very esoteric things that would be just as confusing in other languages.

              Like any opinion on aesthetics, how someone feels about the prettiness of a language will have far more to do with familiarity than with any objective metrics.

          • balsoft@lemmy.ml
            link
            fedilink
            arrow-up
            4
            arrow-down
            8
            ·
            edit-2
            9 小时前

            Sadly there’s still no truly good way to handle errors in rust. TBH I’m not sure if we as an industry have figured out an efficient, foolproof, composable, not overly verbose way to handle errors, so it’s not entirely on Rust.

            • Ephera@lemmy.ml
              link
              fedilink
              English
              arrow-up
              1
              ·
              3 小时前

              Yeah, I was gonna say, error handling easily makes up 80+% of the code paths, and depending on whether you’re building a library or service or script etc., different strategies are most suitable for how to deal with those code paths.

              In a script, you often just want it to crash. In a library, you want to make these code paths matchable, in case the user cares why something failed. And then you have the awkward in-between, which is that 99% of your application codebase will be used by your main-function like a library, but you don’t want to spend as much effort on error handling for that as a proper library does, in particular also because you know what all consumers of your application-library need to know.

              So, it’s kind of multiple different problems, with overlap, and people are hoping for one easy solution to cover all these problems.

  • Gonzako@lemmy.world
    link
    fedilink
    arrow-up
    10
    ·
    9 小时前

    I like using python just cuz I can quickly get it working. I wish I had the time to undust C and try getting that to do what I want but my work cares more about iteration and speed to implement than speed of the program itself.

  • palordrolap@fedia.io
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    10 小时前

    This is pretty smart for the left guy. He’s usually down at the level of “HTML is a programming language” or “What’s a programming language?”.

    That said, the first one of those isn’t mutually exclusive with what he says in the meme.

    • flamingo_pinyata@sopuli.xyzOP
      link
      fedilink
      arrow-up
      7
      arrow-down
      1
      ·
      10 小时前

      It mostly reflects my own story. From a beginner enthusiast of multiple “cool” languages (Scala was all the rage back then), through considering myself more “mature” and thinking about business priorities, ending at understanding that using a good programing language is a business priority.

      If the team works with a language they enjoy, they will be happier (and more productive). Doesn’t even matter if the code is written by humans or machines.

  • SmokeyDope@piefed.social
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    9 小时前

    I’m only a hobbyist no skin in the game but as an engineer first programmer second I feel like how you design the architecture of your logic and how you choose to prioritize computational optimization or feature implementation have a much bigger impact than language. Obviously theres a time and place like using luajit instead of lua if you really need that speed boost, but in big complex programs I’m willing to bet lazy programmers skip optimization steps and copy paste thousands of lines to ship quickly regardless how performance optimized the underlying language is.

    I make a module that does a specific thing for version 1, after initial bug patches and maybe a feature addition theres usually an epithany that the logic can be generalized into an api type registry structure that allows the code to be reused and configured as needed on per item basis. Along the way you do stuff like ask what the not expensive calls are, add accumulator timers to reduce unneeded CPU usage , ensure early returns are up top when it makes sense, choosing to render a cleverly crafted sprite instead of a full 3d entity.

    A conditional if then logic loop Is a logic loop no matter what Turing complete language its written in. What really matters is how you use the loop not which syntax its written in.

    • expr@piefed.social
      link
      fedilink
      English
      arrow-up
      6
      ·
      7 小时前

      No one actually copy/pastes thousands of lines of code. We use libraries.

      Languages do matter a lot. Yes, they are all technically equivalent, but the craft of software engineering is much, much more about social/cultural/community considerations than it is computational ones. What the community around a programming language values matters, because it informs a great deal about what’s idiomatic in a language, what libraries are available, what kind of bugs are possible (or not), how easy code is to read, comprehend, and maintain, and much more.

      What makes a language good is not what programs you can write in it, but how it constrains what you can do such that you naturally writing good code. For example, null pointer exceptions (or segfaults in C, etc.) are a classic problem that plagues many mainstream languages like Java, C#, Python, etc. In Haskell (and a handful of other languages, including Rust), null pointer exceptions are not possible, because nulls do not exist in these languages. Taking away this language “feature” actually increases the power of the language, because you can guarantee that a certain class of common bugs are not possible in your program. So languages that restrict known bad programming practices lead to programmers writing better programs and, more generally, a community around the language that resonates with these philosophies.

    • Ethan@programming.dev
      link
      fedilink
      English
      arrow-up
      10
      ·
      8 小时前

      Any function can be written in any Turing complete programming language. That doesn’t mean a sane person would use malboge or brainfuck for a production system. Language choice can have a huge impact on productivity and maintainability and time is money.

    • AnarchoSnowPlow@midwest.social
      link
      fedilink
      arrow-up
      7
      ·
      8 小时前

      “We have decided that we will use deck screws to build our deck, it’s the right pattern and architecture for the job. Now get started with this hammer, the tool you use doesn’t matter as long as it’s functional as a tool. If it’s not working well that’s an optimization problem because you’re bad at your job.”

  • UnfortunateShort@lemmy.world
    link
    fedilink
    English
    arrow-up
    12
    arrow-down
    14
    ·
    10 小时前

    The most important thing is using Rust, be it only to avoid calls for a rewrite in Rust by people like me

    • Ethan@programming.dev
      link
      fedilink
      English
      arrow-up
      7
      arrow-down
      11
      ·
      8 小时前

      Keep your Rust to yourself. I don’t care what language someone else uses for their projects but Rust is an unreadable mess that I don’t want anywhere near my projects.