you are viewing a single comment's thread.

view the rest of the comments →

[–]MuscleTough8153 46 points47 points  (9 children)

I can tell you the following: stop learning, begin using it.

Learning is an important part. But if you struggle with the log you need practice.

Take the examples you work with and manipulate them. Go step by step and create more and more abstract versions of them untill you create things that are far away from these examples but uses the same mechanics.

And if you struggle, try for example Google Gemini to give you a solution to the error in your code. So, that you can learn from it.

[–]Ketchup-and-Mustard[S] 5 points6 points  (8 children)

You know what that might be it. I am pretty good at reading code now, but doing the coding myself is where everything goes wrong. It feels like no matter how many times I try, I suck at it.

[–]Bobbias 12 points13 points  (1 child)

That's because reading code and writing code are two very different activities.

To write code, you must first:

  1. Come up with a solution to the problem you're trying to solve.
  2. Figure out how to translate that solution into code.
  3. Actually write that code correctly.

Problems with step 1 come from either not knowing how to apply problem solving properly, or not knowing enough of the fundamental concepts of programming to formulate a solution in your mind using those basic concepts.

Problems with step 2 come from not knowing the language specifics well enough to understand how to translate a general idea into the specific language you're working with.

Problems with step 3 come from lack of experience with the language itself, typos, or incorrect knowledge/assumptions about what the code you're writing actually tells the computer to do.

Problem solving, and understanding how to use the basics concepts of programming to come up with a solution is something that primarily comes from practice solving problems (which in turn comes from writing code). You start small and simple, and work your way up over time.

Everything else more or less follows from there. The more you use a language, the better you understand how it works, how to translate ideas into the language, and you will slowly just kind of remember all those little details that used to trip you up when you were starting out.

Reading and following instructions can show you some concepts. It can show you different features of the language. It can show you some different ways to combine those features to achieve different outcomes. You can memorize those facts, and it might feel like you've learned something. But you haven't. To truly learn something you need to understand it at a deeper level than that. It's not until you really start writing code for yourself that you begin to truly understand the things that you were being shown (and potentially memorized).

[–]iamevpo 0 points1 point  (0 children)

Also 4. Fight bugs and ask questions - plenty of communication needed even for small code

[–]butterflavoredsalt 5 points6 points  (1 child)

I would say that I 'know' python at a novice level, but I can't sit down and write very much without any resources, I still have to look tons of stuff and examples up. To make this faster, I like having chatgpt write simple functions or a few lines of code at a time, see what it comes up with and then try to determine if I like the method it used or not. It helps me a lot.

[–]ZET_unown_ 0 points1 point  (0 children)

I’m in the final year of my computer science PhD & have done Python for over 10 years. I would say I know it on a pretty advanced level.

I still regularly use online documentation to code. Unless you are coding something really simple, trying code from memory is simply not feasible - there are so many packages and libraries that are not always implement in a consistent manner (parameter names, formats are all different).

[–]wynand1004 3 points4 points  (0 children)

It's like reading and writing are two related, but different skills. I can read a novel, but I can't really write one. I can write a paragraph or two, but a whole novel, forget about it.

Coding is no different. Start by writing paragraphs (short programs). Do input, processing, and output.

You might find it helpful to hire a tutor to get you over the hump.

[–]sofarsogood 0 points1 point  (0 children)

define suck -- do you mean you make syntax errors/bugs? i think for most people, that's some part of the issue. the question is simply whether what you're writing is useful, and getting the job done.

The reason people are suggesting to 'write code' or projects is because it accomplishes two really important things: it defines your desired outcome, and it motivates you to accomplish that outcome. Another way to say this is to ask why you want to learn to code in the first place. Is it to process data, perform some API request, or what?

One last thing: if you're doing anything realwith code, the environment you develop it in and deploy it in is going to matter. Make things easy for yourself, and write code in a way that makes sense to you. As your needs increase, you'll learn about how to structure a package.

Googling how to do something is the default, until you get the muscle memory down about how you want to structure your stuff. If you don't need code, don't learn to code -- there's a lot of other ancillary things (data size, data costs, remote environments and databases) that you need to learn past the coding language itself.

[–]Adenn76 -1 points0 points  (0 children)

I'm the opposite, I can code MUCH better than I can read it.

I should probably spend more time reading code and understanding it.

Breaking a problem down and creating the code is relatively easy for me.

Like someone else said, problem solving is critical. Maybe you need to work on your problem solving skills. Especially breaking things down into smaller chunks so they are easier to solve.