• nik9000@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    3 hours ago

    It’d be fun to talk shop with the fast code in slow languages folks. I do that for a living. I remember three ways, but I’m sure there’s more:

    • “Just use a better data structure”
    • “My language is a DSL for a faster language” (Polars, Numpy, etc)
    • “My compiler is surprisingly good if I’m careful” (Julia, JVM, etc)
  • melsaskca@lemmy.ca
    link
    fedilink
    arrow-up
    5
    ·
    4 hours ago

    “Key Search Words 101”. Make it quicker and easier to find other programmers solutions on the web.

  • WolfLink@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    ·
    3 hours ago

    I would actually love to take 3300! That sounds fun.

    As for 4020, writing performant code in Python typically means calling into libraries that are written in C.

  • terminatortwo@piefed.social
    link
    fedilink
    English
    arrow-up
    53
    arrow-down
    2
    ·
    19 hours ago

    I always find it funny to see calls to “unlearn oop”. It’s a tool, useful in some contexts and not useful in others. At some point industry treated it like a silver bullet, and now people are reacting to it by checks notes treating the hot new paradigm as a silver bullet.

    learn oop, learn fp, learn logic programming, learn whatever you want. Also, learn when not to use them.

    • squaresinger@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      3 hours ago

      I’ve been working as first a Python and then a Java dev for the last 15 years and I can count the amount of times when I’ve seen actual OOP on one hand.

      I mean, we write “class” at the beginning of our modules and at the beginning of our structs, and we write “interface” at the beginning of our header files, but none of that is actually OOP.

      If you use Spring Boot, you are essentially doing C (not even C++) in Java.

      You have data-only classes without methods (at best there’s a conversion method or something shallow like that) that work identical to C structs. You have service interfaces, which serve the same purpose as C header files. And then you have data-less collections of functions (service/controller classes), which work like .c files.

      Nowhere in this whole process are you actually using OOP techniques.

    • expr@programming.dev
      link
      fedilink
      arrow-up
      7
      arrow-down
      4
      ·
      16 hours ago

      FP has been around a long time, and yes, it is outright better than OOP. Sorry. I write Haskell professionally, and never have I ever felt like something would be easier done in an OOP language. Quite the opposite.

      Unrestricted mutation makes programming really hard, and OOP and mutability go hand-in-hand. If you try to make immutable objects, then you’re just doing FP with worse ergonomics.

      • stingpie@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        3 hours ago

        FP & OOP both have their use cases. Generally, I think people use OOP for stateful programming, and FP for stateless programming. Of course, OOP is excessive in a lot of cases, and so is FP.

        OOP is more useful as an abstraction than a programming paradigm. Real, human, non-computer programming is object-oriented, and so people find it a natural way of organizing things. It makes more sense to say “for each dog, dog, dog.bark()” instead of “map( bark, dogs)”.

        A good use case for OOP is machine learning. Despite the industry’s best effort to use functional programming for it, Object oriented just makes more sense. You want a set of parameters, unique to each function applied to the input. This allows you to use each function without referencing the parameters every single time. You can write “function(input)” instead of “function(input, parameters)”. Then, if you are using a clever library, it will use pointers to the parameters within the functions to update during the optimization step. It hides how the parameters influence the result, but machine learning is a black box anyway.

        In my limited use of FP, I’ve found it useful for manipulating basic data structures in bulk. If I need to normalize a large number of arrays, it’s easy to go “map(normalize, arrays)” and call it a day. The FP specific functions such as scan and reduce are incredibly useful since OOP typically requires you to set up a loop and manually keep track of the intermediate results. I will admit though, that my only real use of FP is python list comprehension and APL, so take whatever I say about FP with a grain of salt.

      • steventhedev@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        5 hours ago

        An object is a poor man’s closure.

        A closure is a poor man’s object.

        These are two sides of the same coin, and both of them miss the point. You should be dealing with scale, and you should use a language that allows you to concisely describe how to compute large amounts of data easily. The best part is that once you start writing APL, you’ll feel like a wizard.

        • expr@programming.dev
          link
          fedilink
          arrow-up
          3
          ·
          4 hours ago

          I mean, I have an OOP background. I found FP as a result of my dissatisfaction with OOP. In fact, I used to teach OOP languages to new students and saw the same mistakes over and over again, mistakes that are simply not possible in FP. It’s a very similar story for everyone I work with, too. We all had jobs in various OOP languages before we managed to get jobs writing Haskell.

          Oh, and I’m currently teaching Haskell to someone at work who has a CS degree and has only done OOP languages (and C), and while it’s different than what he’s used to, he’s still picking it up very quickly (working towards making him a junior engineer, which I think shouldn’t take too much longer). In fact, just the other day we pair programmed on a bug ticket I have and he was not only following along with the code, he spotted issues I hadn’t seen yet. Part of it is certainly that’s he smart (which is why I’m doing this in the first place), but part of it is also that, with a bit of familiarity, FP languages are incredibly easy to read and follow. The primary difference is that FP does everything explicitly, whereas OOP encourages a lot of implicit (and hidden) behavior. When you organize code around functions, there’s necessarily more explicit arguments and explicit return values, which makes it far, far easier to follow the flow of logic of code (and test!). Recently I was trying to read through our Kotlin codebase at work (for our Android app), and it was so much harder because so much is implicit.

  • villainy@lemmy.world
    link
    fedilink
    arrow-up
    77
    arrow-down
    1
    ·
    21 hours ago

    Where’s

    Using Solutions that Already Exist

    No, seriously, you don’t have to build everything from scratch by yourself. Other people write code too.

    • squaresinger@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      3 hours ago

      It’s a double-edged sword and understanding when to re-use and when to re-implement is an art that goes wrong more often than right.

    • PolarKraken@programming.dev
      link
      fedilink
      English
      arrow-up
      3
      ·
      11 hours ago

      Ah, the ever-elusive, mysterious stage in my process - the one I can’t ever seem to move much before the “planning” and at least “beginning to implement” stages, and sometimes stubbornly comes even later than that.

  • noughtnaut@lemmy.world
    link
    fedilink
    arrow-up
    45
    ·
    20 hours ago

    There’s a lot of humour in there, but this:

    CSCI 3300: Classical Software Studies
    Discuss and dissect historically significant products, including VisiCalc, AppleWorks, Robot Odyssey, Zork, and MacPaint. Emphases are on user interface and creativity fostered by hardware limitations.

    I’d take that course in a heart beat. I’ve read some of Atkinson’s ideas and thoughts, and the man was deeply sane.

    It must be decades now that my LinkedIn background banner is a screen shot of Zork source code.

  • SoftestSapphic@lemmy.world
    link
    fedilink
    arrow-up
    26
    ·
    19 hours ago

    I feel like I’m the only CS major to have taken a CS focused ethics class

    Would be nice if all engineers had to take ethics

    • mr_account@lemmy.world
      link
      fedilink
      arrow-up
      14
      ·
      16 hours ago

      I’m a CS major who had to take ethics, but the REQUIRED textbook was written by the professor teaching the class. Managed to get through the semester with an A without buying it and called him out in the class survey.

    • expr@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      15 hours ago

      I was required to take an ethics class, but it was a complete joke. Guy just wasted a bunch of time on very surface-level, Philosophy 101 stuff like talking about who Aristotle was. I’m not sure we even had homework actually. Real ethics were nowhere to be found.

    • bleistift2@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      10
      arrow-down
      11
      ·
      19 hours ago

      Ethics are worthless if you’re not the one calling the shots. Your only options are doing what you’re told or quitting.

      • squaresinger@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        2 hours ago

        Have you ever seen a real-world project that actually uses OOP in any significant capacity? I haven’t.

        When using Java, you might write “class” on top of your structs and modules, but actual OOP with self-contained classes that contain both data and business logic using inheritance and all the other OOP concepts, that’s incredibly rare.

      • fibojoly@sh.itjust.works
        link
        fedilink
        arrow-up
        8
        ·
        20 hours ago

        Like everything that’s impressive at first sight, but misunderstood because you never go past that first impression.