So I’m an on/off noobie but have been focusing on actually sticking with programming what I’ve been working on is Python but this question is for programming in general. For me it’s hard but I want to see how I can get better

Like are these good ways to get good:

Follow tutorials, then work on ways of adding your own twists or changes? Or trying to code it in something else?

Work on assignments from a resource you’re using like in my case Python Crash Course and attempt to redo the assignments without looking back?

Experiment with multiple libraries and library methods or built in methods?

Please share any other ways especially ones that helped you

Also when would be good to start a new language after learning one

    • inzen@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      4 days ago

      This. For me personally It helps to think of programming as as craft. It also helps a lot if you have someone more skilled than you available to discuss.

        • inzen@lemmy.world
          link
          fedilink
          arrow-up
          4
          ·
          4 days ago

          I’m not sure I understand the question but I will try to answer. I did not mean to question you skill in particular, I know nothing about you.

          I agree that programming requires repetition e.g. more programming, that’s why I said “This”.

          What followed was a generic advice that helped me personally to improve a lot as a developer. I got the chance to work side by side with developers experienced in different types of projects, developers I consider more skilled than me in different ways. I consider this avaluabe experience.

          Hope that clears it up a little, nothing to do with you’re skill in particular. English is not my first language so maybe my phrasing is a little weird.

          • Diplomjodler@lemmy.world
            link
            fedilink
            arrow-up
            4
            ·
            4 days ago

            You wrote:

            It also helps a lot if you have someone more skilled than you available to discuss.

            Which could be read as you addressing me directly. Which of course I’m aware was not what you meant. I was just trying to be funny.

    • koala@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      4 days ago

      And also, you learn to make programs of a given difficulty by making programs of a smaller difficulty first.

  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    8
    ·
    3 days ago

    I would say:

    1. Just practice, do projects. Also if you can work on projects with other people because you’ll read a lot of bad code and learn how not to do things (hopefully).

    2. Learn lots of programming languages. They often have different and interesting ways of doing things that can teach you lessons that you can bring to any language. For example Haskell will teach you the benefit of keeping functions pure (and also the costs!).

    If you only know Python I would recommend:

    1. Learn Python with type hints. Run Pyright (don’t use mypy; it sucks) on your project and get it to pass.

    2. Go is probably a sensible next step. Very quick to learn but you’ll start to learn about proper static typing, multithreading, build tools (Go has the best tooling too so unfortunately it’s all downhill from here…), and you can easily build native executables that aren’t dog slow.

    3. C++ or Rust. Big step up but these languages (especially C++) will teach you about how computers actually work. Pointers, memory layouts, segfaults (in C++). They also let you write what we’re now calling “foundational software” (formerly “systems software” but that was too vague a term).

    4. Optionally, if you want to go a bit niche, one of the functional programming languages like Haskell or OCaml. I’d probably say OCaml because it’s way easier (it doesn’t force everything to be pure). I don’t really like OCaml so I wouldn’t spend too much time on this but it has lots of interesting ideas.

    5. Final boss is probably a dependently typed language like Lean or Idris. Pretty hardcore and not really of much practical use it you aren’t writing software that Must Not Fail Ever. You’ll learn loads about type systems though.

    Also read programming articles on Hacker News.

    • the_strange@feddit.org
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 days ago

      I generally agree with your statement, just one thing to keep in mind: Mypy sucks for any library larger than a few thousand lines spread over a couple of files, but pyright is developed by M$ and might be part of their usual Embrace, extend, and extinguish strategy. The other two contenders are pytype (google) and pyre (facebook), so it’s not like there’s a good selection of independent, good and FOSS type checkers out there at the moment.

      Astral - the people behind the ruff linter - are currently developing ty, yet another static type checker for python, with a lot of promise, but it’s going to be a couple of months, maybe a year before it is in any shape to be used in production code.

      • FizzyOrange@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        2 days ago

        Yeah I’m watching Ty. Pytype and Pyre are not serious options. Nobody really uses them, and Pytype is discontinued. Facebook have a new project called Pyrefly that’s also worth watching.

        But for now, use Pyright. No argument. If you’re really worried about Microsoft (and not Facebook or Google for some reason) then use BasedPyright.

  • Azzu@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    53
    ·
    5 days ago

    I think the best way to get better at programming is to

    1. Write programs that you actually want to make
    2. Whenever you run into a hard part, first try to do it yourself
      1. Once you succeed or fail, research the problem and see how others solved it
      2. Always look up words/concepts you don’t understand while researching and don’t stop until you understand
    3. Repeat

    If you like, you can also just read some books or scour some programming related communities for general info, without some specific goal. However, most people don’t have the motivation to do that, because they don’t know what that information is good for yet. That’s why, for most people in my opinion, it’s better to just try to do something and then learn (better) ways of doing what you want, because then you actually immediately get what it’s good for and why you’d need it.

    • starshipwinepineapple@programming.dev
      link
      fedilink
      arrow-up
      15
      ·
      edit-2
      5 days ago

      That #1 is crucial. I see a lot of people get stuck in tutorial hell or burn out from doing other people’s projects. Some tutorials are okay if you’re just starting out but at some point switching to your own projects and challenging yourself is necessary

      And since OP mentioned being on/off, i would also just say be consistent. Dedicate some time to work on your own projects so you’re not forgetting stuff before it really sticks

  • theherk@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    4 days ago

    There is a lot here with varying degrees of helpfulness. I’ll add one thing. Many have commented essentially “build stuff”, and that is solid truth. That’s how you get better. But just like the whole perfect practice makes perfect, there is one fundamental detail that must be included. Build systems that you understand deeply. Not the code; that you are learning. But it is best to build things where you understand the outcome behavior of the system.

    For example, if you don’t really understand what graphics rasterization is, building a raster program, even with a good guide, isn’t going to help as much as you might think. Though it will help you understand graphics, so go nuts. But if you really understand how baseball stats are calculated, do something with that. It will be much more gratifying and the code will be the part you’re learning, not the system it is implementing.

  • ViperActual@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    5
    ·
    3 days ago

    Generally I start with an end goal, and break it down into logical pieces. For instance I recently wanted to make a custom soundboard for discord. First thing I needed to figure out was how to play sounds. Next was playing those sounds to a specific sound device so that it can be routed into the audio input for discord. Then I needed to figure out how to play the same sound at the same time through the audio output. Then I needed a form to interact with so I could click a button to play a sound. Then I needed to be able to load a config file so that I could update that form when I wanted to add or delete sounds. Then I needed a way to choose files to add to the sound board. And conversely a context menu so I could right click a button to remove it. Then I needed to figure out how to save and load this config file from the filesystem. Then I needed to be able to search for and update the form so I could now quickly find sounds if the list got too long. And then once I had all that working, figure out how to play the same sound multiple times before it finished resulting in a multi threaded soundboard that can interact with any sound device on the machine and saves and loads sound lists all in Python.

  • dream_weasel@sh.itjust.works
    link
    fedilink
    arrow-up
    10
    ·
    4 days ago

    Write code, get feedback, write more (better) code, get more feedback and repeat.

    Just hacking your own stuff 10 hours a day isn’t making you better if you’re just doing what you have already done or doing things the same way you’ve done them before.

  • morphballganon@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    4 days ago

    Be result-focused. You’re trying to achieve x. Look at however many tutorials you need to achieve x. Now x is part of your repertoire. Then repeat, with a new x.

    Later, you’ll think “I need to do y. I’ve done it before. I’ll just copy that syntax, with new variable names etc” and boom, you’re good at programming.

  • melsaskca@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    3 days ago

    Lots of good advice here. I’ll add a bit more that is non-technical. Get and study the book “Symbolic Logic” by Irving M. Copi. It’ll help you to think more critically and expose you to different logic patterns. More philosophical than technical but I see it as being like math for words. As with everything, you get better over time if you keep at it.

  • MagicShel@lemmy.zip
    link
    fedilink
    English
    arrow-up
    9
    ·
    4 days ago

    The hardest part about learning to code is that the projects you really want to do are far beyond your abilities as a beginner. I recommend starting with modding, creating websites, or even writing macros for stuff like excel. They get you started.

    Then also watch some YouTube videos on stuff like SOLID, design patterns, functional programming, and “getting started with <language>”.

    Then try to write your own versions of stuff. I learned a bunch of stuff by writing my own versions of stuff. Like I tried backporting Java Functions, BiFunctions, Predicates, etc to Java 7. It didn’t work great because the language support wasn’t there, but I learned a lot about what things are hard and why things are designed the way they are. I feel sorry for the poor bastards that inherited that code.

    Also, don’t let people give you too much shit about asking questions of AI. It frequently explains things way better than it executes. It’s a great first line of learning even if you really need a deeper dive into the documentation to understand the more esoteric stuff. If you have a question you can’t find the answer to, ChatGPT will explain it in 30 seconds where you might have to wait days on a forum for someone to feel like answering.

    Beware: ChatGPT is awful about mixing different versions of stuff so the answers it gives may well be obsolete. But if you’re really confused it can point you in the right direction. Yeah, you’ll have to learn a lot more nuance when you start doing shit professionally, but if you’re just fucking around it’s great. And googling for answers isn’t much better in that regard. The best answers come from the docs, but especially when you’re starting out, the documentation often assumes a baseline of contextual knowledge you aren’t going to have.

    Try implementing a custom collector in Java just based on the docs. Have fucking fun with that.

  • BilboBargains@lemmy.world
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    3 days ago

    Identify a problem that you can solve using code. Use ai to help with syntax and code structure. Chip away at the problem a little bit each day.

  • rozodru@piefed.social
    link
    fedilink
    English
    arrow-up
    8
    ·
    5 days ago

    I’ve been doing this for well over 20 years now and I taught myself by building Geocities sites and random stuff.

    Just build things and push them to a repo. Have an idea for something? build it. could just be something like a TUI for Mastodon or like an eReader with AI driven text to speech, I don’t know i’m just spit balling here but my point is you just have to build stuff. It’s like anything, the more you do it, the better you get at it. Like drawing. you just draw something every day and eventually you get good. it’s the same for coding. just work on something every day and you’ll get good at it.

    So just build something or contribute to your favourite open source project.

  • unknownuserunknownlocation@kbin.earth
    link
    fedilink
    arrow-up
    8
    ·
    5 days ago
    1. Learn different programming paradigms and approaches. Learn Java or C# to learn object-oriented programming. Learn Haskell to understand functional programming. Learn C to understand low-level programming. Learn C++ to see the wealth of opportunities a programming language can offer. Learn Assembly to understand what happens when your code gets compiled and how computers work on a very basic level. Learn Rust to learn about memory- and thread safety. You don’t have to be an expert in all of these, but a basic understanding can be really helpful (for instance, the C++ code I wrote significantly improved after learning Haskell and functional programming, even though I will probably never write an actual program in Haskell).
    2. Learn about programming practices. Learn about test driven development. Learn about fuzzing. Learn about penetration testing. Essentially make sure you’re not only learning the actual programming itself, but everything the comes (or should come) with it.
    3. Most importantly: practice, practice, practice. Find an open source project that you like and improve something. Fix a bug. Add a requested feature. Learn how to work with others on programming tasks. Ideally you have an open source project that you use and would like to see a bug fixed or a feature implemented - talk with the devs, make a PR, and don’t get frustrated if they criticize your code - learn from it (but also accept that some devs are self-centered or don’t want help - in that case, choose another project or fork the project).
    • Mr. Satan@lemmy.zip
      link
      fedilink
      arrow-up
      4
      ·
      4 days ago

      I’d say it takes a certain curiosity to make all of this work. Like the other day I read up on SQL indexes and how they work under the hood. I didn’t need to, I know what they do and what I needed them to do. But there was this itch when I realized that I don’t know how they do it.

      And there are many such things depending on the specialty. I’m in web dev and often the work I do is very detached from actual communication protocols and such. I see devs that don’t even know how cookies work in an MVC app. And while it’s not necessary, it helps a lot to have basic understanding of what happens when you call an API, how exactly HTTP differs from HTTPS, even what happens at TLS and TCP layer of things.

      I consider myself a generalist and it’s this curiosity that makes me adequate in many different subspecialties. I’m not the best at things, but I can get shit done myself when I need to.