I rather write garage code than using slop

    • dfyx@piefed.social
      link
      fedilink
      English
      arrow-up
      4
      ·
      13 days ago

      I would say the main downside of C++ is that it carries around a lot of baggage from the last 40 years. Even if you decide to use a modern standard in your own code, you’ll have to deal with libraries that can’t use many of the new features because they need to stay backwards compatible with old code bases. Also, a lot of tutorials and examples still look like they are from pre-C++11 times.

      I recently started a project that would have been a great fit for C++ (simple 2D game engine + editor) but the way Qt has to reinvent half the standard library, GTK basically asks you to write plain C and gtkmm had some other issues that I can’t even remember, all the fun of working on the project was gone. I decided to switch to C# (which I use for work anyway) and Avalonia and so far it’s going well. Not being able to use C++ still nags at me anyway. I would have loved to get more comfortable with modern C++ but I just couldn’t keep up the motivation.

      I’ll try again for the next project.

  • AMA@piefed.zip
    link
    fedilink
    English
    arrow-up
    26
    arrow-down
    1
    ·
    13 days ago

    Hell yeah 🎉🎉

    in the current age of AI bros vibe coding everything, finding an actual human learning a programming language to fix a problem they have is like finding a deepslate emerald ore (iykyk)

    wishing you the best of luck :D

  • Hugh@programming.dev
    link
    fedilink
    arrow-up
    9
    ·
    13 days ago

    Is this your first programming language? If so I strongly recommend Harvard’s CS50 course. It’s mostly in C but it’s very well taught and you learn enough fundamentals that you can quickly transition to another language.

    • 14th_cylon@lemmy.zip
      link
      fedilink
      arrow-up
      8
      ·
      13 days ago

      It is on YouTube, and you can enroll it here - https://www.edx.org/cs50 - and submit your homeworks and have them machine graded.

      All for free. The homework part is not necessary, but you will get that feeling of being in school and stressing about deadline ;)

    • Ŝan • 𐑖ƨɤ@piefed.zip
      link
      fedilink
      English
      arrow-up
      2
      ·
      13 days ago

      Yup. And it starts with C and gets to Python later, which I þought was an odd way to structure it. My utterly non-STEM-oriented wife took þe class because it was a prereq for Harvard’s AI course, which she wanted to take. While she struggled a bit wiþ programming in general, my proudest moment was when - a week into Python - she said: “This sucks. C was easier.”

  • istdaslol@feddit.org
    link
    fedilink
    arrow-up
    10
    arrow-down
    3
    ·
    14 days ago

    As C++ is a superset of C, I reckon you should start with C, as many concepts of C++ are translatable to C, which is what the first C++ compiler did.

    I still use fprintf instead of cout because it feels more “proper”

    • ColdWater@lemmy.caOP
      link
      fedilink
      arrow-up
      13
      ·
      14 days ago

      That’s what I tried to get started with, but I wanna make programs with qt6 and the qt creator doesn’t support it so c++ it is

        • ColdWater@lemmy.caOP
          link
          fedilink
          arrow-up
          9
          ·
          13 days ago

          but from what I understand from form posts is it’s harder to make qt6 programs with c than c++, because I have to make warper in my qt6 program with c++ for that c code to work? Idk I’m just getting started

          • istdaslol@feddit.org
            link
            fedilink
            arrow-up
            7
            ·
            13 days ago

            Honestly C and C++ code are the same. You can use C++ function calls and objects when needed and have everything else pure C. Don’t think of them as two completely different languages, C++ is more of an “object oriented framework for c” than its own language. That is a gross oversimplification but you get what I mean.

            • ImgurRefugee114@reddthat.com
              link
              fedilink
              arrow-up
              2
              ·
              13 days ago

              That really hurts to read. Have you programmed with any spec newer than c++11? Best-practices have changed a lot. It isn’t “c with classes” anymore. Yes, most of the ancient code will work; but there are better, more efficient, and more ergonomic alternatives now.

          • ImgurRefugee114@reddthat.com
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            13 days ago

            The problem with QT is that everything becomes a “QT app” when you start writing with QT. You’ll end up using more of their types than the standard library, and getting a clean front-end / back-end separation is more difficult.

            Anyways, C++ isn’t just a superset of C; they’re surprisingly different, and the best modern approaches are extremely so. That advice may have been true before 2014 and a bit until 2017, but it certainly isn’t now.

      • mamg22@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        arrow-down
        2
        ·
        13 days ago

        Props to you for learning C++, its a neat powerful language, although it has grown quite overcomplicated through the years.

        Though if you want something a bit easier, you can also use Python for Qt development through the PySide6 library. It is one of the officially supported Qt languages alongside C++ and JS. I’ve personally used it for a few programs and it works wonderfully, it is one of my favorite ways to make GUIs for myself, it just works™

    • one_old_coder@piefed.social
      link
      fedilink
      English
      arrow-up
      9
      ·
      13 days ago

      I reckon you should start with C

      I tried that 20 years ago and it was a massive waste of time. Spend a few days to understand pointers, then embrace modern C++ with the STL, it’s safer and more productive.

      Also cout is dead, you can use print, println, and format now.

    • mmmm@sopuli.xyz
      link
      fedilink
      arrow-up
      5
      ·
      14 days ago

      At uni I was taught C++ first (all the basics, logic 101, control flow, pointers, etc). Then I was taught data structures with C the next period (linked lists, stacks, queues, a tiny bit of trees…). Then I found out I sucked at maths and switched to graphic design!

      All in all OP is in for a hell of a ride - yeah you could just start with C but they could start with C++ too so just to get the feel of it.

      • istdaslol@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        13 days ago

        True, it was just a recommendation because for me it made more sense this way around. Like objects are just structs with function pointers and some compiler magic to ensure private and publicness, polymorphism is just unions etc.

    • observantTrapezium@lemmy.ca
      link
      fedilink
      arrow-up
      5
      ·
      13 days ago

      I very strongly disagree. It’s practically a superset for backwards compatibility reasons but modern C++ coding patterns are vastly different to C. Modern English is kind of a superset of Shakespearean English, but you don’t need to know it for most daily tasks. C++ is much more elegant and safe when avoiding C patterns. C has its place and I use it sometimes, but the two should absolutely not get confused because of the name and compatibility.

      • Possibly linux@lemmy.zip
        link
        fedilink
        English
        arrow-up
        0
        ·
        13 days ago

        C++ is a lot of things but elegant and safe are not words that come to mind. C++ has far more issues than regular C.

        Best option would be to use something with memory safety

        • observantTrapezium@lemmy.ca
          link
          fedilink
          arrow-up
          0
          ·
          13 days ago

          Well, I mentioned safe in the comparative degree. Modern C++ could be actually safe if you restrict yourself to a subset of it, that’s sometimes not really practical. I do think that things are improving and with C++26 it’s becoming way easier to write perfectly (memory-)safe code that’s also (subjectively) elegant.

          • Miaou@jlai.lu
            link
            fedilink
            arrow-up
            0
            ·
            13 days ago

            C++26, you mean the standard that’s been rejected for being so crap?

            • observantTrapezium@lemmy.ca
              link
              fedilink
              arrow-up
              1
              ·
              13 days ago

              I don’t think it’s a fair characterization. To my understanding there were specific concerns about contracts. Hopefully these will get resolved, or contracts will be moved to C++29.

    • mkwt@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      13 days ago

      As C++ is a superset of C

      This is not true. Both ISO C++ and ISO C have have features that are not available in the other language. Therefore, there is no subset or superset relationship.

      I would tweak this recommendation. If you want to start with C, consider writing C-style code into .cc or .cpp files, and compile as C++. You will therefore be learning “C++ with functions only” as opposed to “C with classes.”

  • justme@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    6
    ·
    13 days ago

    the good old “hello world” program. even with decades of experience you always come back to it to solve problems :)

  • charmed_electron@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    13 days ago

    Wishing you the best of luck! My unsolicited advice after nearly 30 yrs of C/C++ and a couple Qt apps is that it’s not too soon to start studying the Qt docs. Understanding how Qt apps are architected is a separate learning exercise from the syntax of the coding language itself.

  • ImgurRefugee114@reddthat.com
    link
    fedilink
    arrow-up
    4
    ·
    13 days ago

    Over 15 years of low level c and modern c++ programming for resource-constrained systems; tutored it too. Feel free to DM if you have questions or get confused about anything.

  • Buddahriffic@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    13 days ago

    I suggest you also spend some time learning about data structures and algorithms. That’s one of the things that separate university trained computer scientists from many self-taught or college trained programmers. Spending some time learning about how the hardware works is also worthwhile. Just stick these on your todo list, they aren’t necessary to understand to program, but the quality of what you make will improve if you understand these.

    There’s a lot of other ways you can increase your depth or breadth of knowledge, but IMO those are the two biggest.

    And for software design in general, the biggest thing I’d emphasise is modularization. Try to break up your program into different pieces that fit together. Like for a game engine, you could have the renderer framework as one module, input handling as another, and game logic as a third. Then, if you want to make a different game, you just swap out the game logic module and you’ve got a different game using the same renderer and input modules. This is essentially what libraries are.

    • Jankatarch@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      13 days ago

      Also see: How to read other peoples’ code and understand enough to replicate same effects.

      Really hard skill but EXTREMELY helpful with projects.

    • starelfsc2@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      13 days ago

      imo these are things you learn if you really want to understand coding deeply and write good code, not if you just want to make some software. I also don’t know if you would really understand what you’re seeing unless you know why you need it, at least that was the case for me. I majored in CS and most of my understanding still comes from how I actually ended up using things, and most of it never fully clicked until a couple years of using it.

      • Buddahriffic@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        13 days ago

        Somehow I got into an efficiency/performance focused mindset pretty early on, so I appreciated the algorithm analysis when I got to it (though I thought then and still do think that big O notation simplifies it a bit too much… Those dropped terms can be just as or even more significant as the final term when it comes to typical data sets, but it’s still useful in understanding how an algorithm scales).

        And I’d say that just going over the existing data structures and understanding their strengths and weaknesses can help just by being aware something exists. Like if all you know are arrays and linked lists, you’ll probably struggle a bit to handle key/value pairs. And then, once you learn about them, you might use them for everything and then wonder why your code runs so slowly.

        And the main reason why I’d like more people to be aware of how to be good programmers is that there seems to be a lot of people that just go from “something I’m doing as a hobby” to “something I’m doing for money” or “a large hobby project that has been picked up by the community”. And software quality has been dropping at a similar rate to how much hardware is improving.

        But you’re right that, without the greater context, a lot of it can be confusing and can beg the question of “why do I need this?”

    • PotatoesFall@discuss.tchncs.de
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      edit-2
      13 days ago

      algorithms and data structures are overrated IMO. No average programmer is manually writing sorting algorithms or reversing linked lists. And if you do need something like that, you can just google it

      edit: People have raised some VERY good points about why DSA is actually really helpful, and I guess I have to agree. I think this comes from my disappointment upon entering the professional programming scene and realizing that readability, maintainability, organization and structure are 10x more important when it comes to collaborating with others on production-grade codebases.

      • expr@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        13 days ago

        Tired of this trope. Learning data structures and algorithms is not about memorizing the specifics of some particular algorithm. That’s like thinking that learning math is about memorizing formulas.

        DS&A is about learning *algorithmic thinking" and how common data structures actually work, so you can begin to build a toolbox of things you can use when making your own data structures. Software engineers that are actually good know this shit backwards and forwards, because it does actually come up all over the place (and these are the kind of people that actually write libraries). Even the basic things you learn in school are actually incredibly useful for understanding the implementation details of databases and how query planners and indexes work, for example (very helpful when trying to understand query performance).

        And don’t get me started on just how fucking much directed acyclic graphs come up in the real world. Git? DAG. Any package manager? DAGs. Nix? DAGs. Open Telemetry? DAGs (the main data structure is a tree which is a special case of DAGs, but if you use linked spans, it would form a DAG). Hell, I’m working on something right now that needs to be modeled as a DAG. It’s almost comical how useful they are.

        We should be encouraging people to learn and grow more, not less.

      • Euphoma@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        13 days ago

        The average programmer will have times where they have to pick between datastructures though and pick an algorithm

      • Buddahriffic@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        13 days ago

        Even if you aren’t implementing them directly, it can help to just understand how a library you’re using implements them. Most data structures have scenarios where they are the best option and other scenarios where they are the worst option. Which one you pick can be the difference between an operation taking under a second vs minutes or hours. Hell, even if you pick the correct structures overall but layer them poorly, you can see a difference like that.

        It’s like adding an understanding of engineering to woodworking skills. Sure, a carpenter could probably build a house frame on their own, but it takes engineering knowledge to minimize the amount of wood used while still being sure that it won’t fall over if the wind gusts to 100 km/h or it snows during winter.

      • JackbyDev@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        13 days ago

        On the one hand, I get you, but on the other hand, a lot of math people aren’t doing by hand, but it’s still important for a foundational understanding.

    • ColdWater@lemmy.caOP
      link
      fedilink
      arrow-up
      5
      ·
      13 days ago

      I want gui with different tabs, dynamic images scaling with different window size, right click context menu to open a file or text in another program, auto close when I unfocus the window (for applet like networkmanager bluetooth, mpris), different layout depending on what tab I’m on, interactive element within the program.

      • AgentOrangesicle@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        13 days ago

        Oh, snap, you’re right! Garbage did that one James Bond song. I do all of my processing in a hole of my own making that drives my existential terror.