Incase it doesn’t show up:

  • RedWeasel@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    I started to learn C++ once, had semester and couldn’t wrap my head around the object oriented part. At some point I looked at learning objective C on my own, though I didn’t really use it. I had a 1000x better understanding after an hour.

    • tiredofsametab@fedia.io
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Something like ruby is a pretty quick way to get up and running with something easy and object-oriented. Groovy if you already have a jvm running (though ruby might be easier depending upon your background)

    • ⸻ Ban DHMO 🇦🇺 ⸻@aussie.zoneOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      3 months ago

      Yeah JavaScript is a bit weird, semicolons being optional and compulsory at the same time: I remember trying to build an electron example ~5yrs ago and it didn’t work unless I put in the semicolons which the developers omitted.

      Python is just glorified shell scripting. Libraries like numpy are cool but I don’t like the indentation crap, I’m getting used to it because University likes it.

      • flying_sheep@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        3 months ago

        Python is just glorified shell scripting

        Absolutely not, python is an actual programming language with sane error handling and arbitrarily nestable data structures.

        I don’t like the indentation crap

        Don’t be so superficial. When learning something, go with the flow and try to work with the design choices, not against them.

        Python simply writes a bit differently: you do e.g. more function definitions and list comprehensions.

    • void_star@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Python has its quirks, but it’s much much cleaner than js or c++, not fair to drag it down with them imo

      • tunetardis@lemmy.ca
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 months ago

        I think the thing with C++ is they have tried to maintain backward compatibility from Day 1. You can take a C++ program from the 80s (or heck, even a straight up C program), and there’s a good chance it will compile as-is, which is rather astonishing considering modern C++ feels like a different language.

        But I think this is what leads to a lot of the complexity as it stands? By contrast, I started Python in the Python 2 era, and when they switched to 3, I was like “Wow, did they just break hello world?” It’s a different philosophy and has its trade-offs. By reinventing itself, it can get rid of the legacy cruft that never worked well or required hacky workarounds, but old code will not simply run under the new interpreter. You have to hope your migration tools are up to the task.

          • tunetardis@lemmy.ca
            link
            fedilink
            English
            arrow-up
            0
            ·
            3 months ago

            There were breaking changes between C and C++ (and some divergent evolution since the initial split) as well as breaking changes between different releases of C++ itself. I am not saying these never happened, but the powers that be controlling the standard have worked hard to minimize these for better or worse.

            If I took one of my earliest ANSI C programs from the 80s and ran it through a C++23 compiler, I would probably need to remove a bunch of register statements and maybe check if an assumption of 16-bit int is going to land me in some trouble, but otherwise, I think it would build as long as it’s not linking in any 3rd party libraries.

      • jaybone@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        3 months ago

        The terse indexing and index manipulation gets a bit Perl-ish and write-only to me. But other than that I agree.

  • Presi300@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    Sums up my experience with C++. It’s fun until you actually start using it and then you get hit with: Idiotic syntax, no package management, C compilers, different operating systems, compiling in general, having to code everything from scratch, memory management and a lot more…

    Shit hit me so hard, I began learning web dev instead and never looked back…

  • mokus@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    I actually just started learning C++ today.

    If Lovecraft were alive today one of his stories would start with this line.

  • AnarchistArtificer@slrpnk.net
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    A friend of mine whose research group works on high throughout X-ray Crystallography had to learn C++ for his work, and he says that it was like “wrangling an unhappy horse”.

    • xthexder@l.sw0.com
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      I’m not sure how I feel about someone controlling an X-ray machine with C++ when they haven’t used the language before… At least it’s not for use on humans.

      • AnarchistArtificer@slrpnk.net
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 months ago

        He doesn’t directly control anything with C++ — it’s just the data processing. The gist of X-ray Crystallography is that we can shoot some X-rays at a crystallised protein, that will scatter the X-rays due to diffraction, then we can take the diffraction pattern formed and do some mathemagic to figure out the electron density of the crystallised protein and from there, work out the protein’s structure

        C++ helps with the mathemagic part of that, especially because by “high throughput”, I mean that the research facility has a particle accelerator that’s over 1km long, which cost multiple billions because it can shoot super bright X-rays at a rate of up to 27,000 per second. It’s the kind of place that’s used by many research groups, and you have to apply for “beam time”. The sample is piped in front of the beam and the result is thousands of diffraction patterns that need to be matched to particular crystals. That’s where the challenge comes in.

        I am probably explaining this badly because it’s pretty cutting edge stuff that’s adjacent to what I know, but I know some of the software used is called CrystFEL. My understanding is that learning C++ was necessary for extending or modifying existing software tools, and for troubleshooting anomalous results.

        • xthexder@l.sw0.com
          link
          fedilink
          arrow-up
          0
          ·
          3 months ago

          Neat, thanks for sharing. Reminds me of old mainframe computers where students and researchers had to apply for processing time. Large data analysis definitely makes sense for C++, and it’s pretty low risk. Presumably you’d be able to go back and reprocess stuff if something went wrong? Or is more of a live-feed that’s not practical to store?

          • AnarchistArtificer@slrpnk.net
            link
            fedilink
            English
            arrow-up
            0
            ·
            edit-2
            3 months ago

            The data are stored, so it’s not a live-feed problem. It is an inordinate amount of data that’s stored though. I don’t actually understand this well enough to explain it well, so I’m going to quote from a book [1]. Apologies for wall of text.

            “Serial femtosecond crystallography [(SFX)] experiments produce mountains of data that require [Free Electron Laser (FEL)] facilities to provide many petabytes of storage space and large compute clusters for timely processing of user data. The route to reach the summit of the data mountain requires peak finding, indexing, integration, refinement, and phasing.” […]

            "The main reason for [steep increase in data volumes] is simple statistics. Systematic rotation of a single crystal allows all the Bragg peaks, required for structure determination, to be swept through and recorded. Serial collection is a rather inefficient way of measuring all these Bragg peak intensities because each snapshot is from a randomly oriented crystal, and there are no systematic relationships between successive crystal orientations. […]

            Consider a game of picking a card from a deck of all 52 cards until all the cards in the deck have been seen. The rotation method could be considered as analogous to picking a card from the top of the deck, looking at it and then throwing it away before picking the next, i.e., sampling without replacement. In this analogy, the faces of the cards represent crystal orientations or Bragg reflections. Only 52 turns are required to see all the cards in this case. Serial collection is akin to randomly picking a card and then putting the card back in the deck before choosing the next card, i.e., sampling with replacement (Fig. 7.1 bottom). How many cards are needed to be drawn before all 52 have been seen? Intuitively, we can see that there is no guarantee that all cards will ever be observed. However, statistically speaking, the expected number of turns to complete the task, c, is given by: where n is the total number of cards. For large n, c converges to n*log(n). That is, for n = 52, it can reasonably be expected that all 52 cards will be observed only after about 236 turns! The problem is further exacerbated because a fraction of the images obtained in an SFX experiment will be blank because the X-ray pulse did not hit a crystal. This fraction varies depending on the sample preparation and delivery methods (see Chaps. 3–5), but is often higher than 60%. The random orientation of crystals and the random picking of this orientation on every measurement represent the primary reasons why SFX data volumes are inherently larger than rotation series data.

            The second reason why SFX data volumes are so high is the high variability of many experimental parameters. [There is some randomness in the X-ray pulses themselves]. There may also be a wide variability in the crystals: their size, shape, crystalline order, and even their crystal structure. In effect, each frame in an SFX experiment is from a completely separate experiment to the others."

            The Realities of Experimental Data” "The aim of hit finding in SFX is to determine whether the snapshot contains Bragg spots or not. All the later processing stages are based on Bragg spots, and so frames which do not contain any of them are useless, at least as far as crystallographic data processing is concerned. Conceptually, hit finding seems trivial. However, in practice it can be challenging.

            “In an ideal case shown in Fig. 7.5a, the peaks are intense and there is no background noise. In this case, even a simple thresholding algorithm can locate the peaks. Unfortunately, real life is not so simple”

            It’s very cool, I wish I knew more about this. A figure I found for approximate data rate is 5GB/s per instrument. I think that’s for the European XFELS.

            Citation: [1]: Yoon, C.H., White, T.A. (2018). Climbing the Data Mountain: Processing of SFX Data. In: Boutet, S., Fromme, P., Hunter, M. (eds) X-ray Free Electron Lasers. Springer, Cham. https://doi.org/10.1007/978-3-030-00551-1_7

      • AnarchistArtificer@slrpnk.net
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 months ago

        Unfortunately no. I don’t know any research scientists who even make 6 figures. You’re lucky to break even 50k if you’re in academia. Working in industry gets you better pay, but not by too much. This is true even in big pharma, at least on the biochemical/biomedical research front. Perhaps non-research roles are where the big bucks are.

  • Aceticon@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Reminds me of the joke about the guy falling from the top of the Empire State Building who, half way down, was heard saying: “Well, so far, so good”

      • Aceticon@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        3 months ago

        I suspect indirectly both variants come from the same source or maybe even it’s the La Haine that’s indirectly the source for my variant (though I learned this joke a long time ago, possibly before 1995).

        By the way, that’s excellent film intro.

  • tiredofsametab@fedia.io
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    I learned c from a book from the 80s and then skipped to rust.

    The only time I touched c++ was modding games in the early aughts and to try it for a couple coding challenges. I’ve heard templates are a thing of note when it comes to complications but not sure.

    As for c# … We don’t talk about that (jk. I had to do it for one or two projects and played with unity a bit ages ago)

    • TheHarpyEagle@pawb.social
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      3 months ago

      Honestly C# has grown on me quite a bit. Shakes off some of the bloat of Java and linq is pretty handy. God knows if I can’t tell you what the distinction is between C# and .NET Core and whatever the hell ASP is.

    • ⸻ Ban DHMO 🇦🇺 ⸻@aussie.zoneOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      3 months ago

      Was that “The C Programming Language”? I learned C from that after a bit of C++ and it made everything make so much sense. C is refreshingly simple.

      I’ve heard templates are a thing of note when it comes to complications but not sure

      It’s funny because that is the one feature I really wish C had, I can live without member functions but templates or even a good generics system would be great. I did some C# with MonoGame and FNA. Language has gotten better as of late but idk about performance, way better than VB.

      • tiredofsametab@fedia.io
        link
        fedilink
        arrow-up
        0
        ·
        3 months ago

        Probably. I think I still have the book in storage back in the US. At some point, I also got “learn c in 24 hours” or something as well.

  • Tyfud@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Unfortunately, those of us that make games in Unreal Engine are stuck writing a lot of C++, unless we want to do everything in BPs (no thanks, they’re fine, but it’s not coding, and it’s difficult to maintain and refactor for complicated projects, they’re good for taking C++ components and building bigger components out of the base C++ functionality though).

    With that said, UE’s support for C++ is decent. Which is, that as long as you tag all your fields, properties, methods, classes, etc. with some UnrealEngine attribute filter (like UCLASS or UPROPERTY), Unreal will handle the memory management of those constructs for you. Which is nice.

    Unfortunately it has some other limitations to the C++ language that you can’t work around, like disallowing pure abstracts because every C++ derivative class based on any UE construct (Actor, Character, Pawn, etc.) has to be instantiatable in the editor. So no pure abstracts and such.

    In general, I’d give it a 6/10.

    It’s still mostly C++, but some of the things suck less.

  • philluminati@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    This is so believable. You copy a few examples out of a textbook using cout and cin and it seems reasonably inline with other languages.

  • mindbleach@sh.itjust.works
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    C is dangerous like your uncle who drinks and smokes. Y’wanna make a weedwhacker-powered skateboard? Bitchin’! Nail that fucker on there good, she’ll be right. Get a bunch of C folks together and they’ll avoid all the stupid easy ways to kill somebody, in service to building something properly dangerous. They’ll raise the stakes from “accident” to “disaster.” Whether or not it works, it’s gonna blow people away.

    C++ is dangerous like a quiet librarian who knows exactly which forbidden tomes you’re looking for. He and his… associates… will gladly share all the dark magic you know how to ask about. They’ll assure you, oh no no no, the power cosmic would never turn someone inside-out, without sufficient warning. They don’t question why a loving god would allow the powers you crave. They will show you which runes to carve, and then, they will hand you the knife.

  • itsmegeorge@lemmy.zip
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    In my country C++ is taught as a base language along with Scratch(not a language, but yk what I mean). I recently started learning Kotlin with Jetpack Compose (the only sane way to learn Kotlin) and I realized I wasted two years of my life learning C++, with 5 more to come as it is mandatory in ICT classes… :((

      • AItoothbrush@lemmy.zip
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 months ago

        Idk about other people but just learning c is so logical. You do stupid shit, you get stupid results. Of course there are a lot of bad things with c but at least when you sit down to understand how it works, it works while most oop languages are so detached from the hardware its hard to understand anything. It might be just me but oop breaks my brain. Also ive never coded in c++ but i automatically avoided it. I heard rust has very minimal oop and its just to make things smoother so i may try that.