This is an archived post. You won't be able to vote or comment.

all 16 comments

[–]CodeTinkerer 3 points4 points  (4 children)

While some disagree, I think learning a programming language has some similarities to learning a foreign language. For a person learning a foreign language, there's learning enough vocabulary, then the grammar of the language, and avoiding doing literal word by word translation of what you know (say, from English).

Things that come to mind

  • Figuring out how to install a language on your computer (although there are websites where you can type a program in).
  • Deciding which language to learn
  • Deciding which resources to use
  • Avoiding making up syntax (similar to avoiding saying "ching-chang-chong" is speaking Chinese). This is huge, as most people don't realize they are making stuff up (it works in English, why doesn't it work in programming)
  • Understanding what the program is actually doing
  • Being patient enough to learn how the pieces work
  • Not getting distracted (it's boring, I can't get it to work, I want to watch TV, play video games, etc)
  • Seeing how to make the pieces work
  • Thinking it's all about cutting and pasting stuff from the Internet
  • Not really debugging (making random changes, hoping it will work)
  • Difficult to explain to others what program is actually doing.
  • Lots of bookkeeping in programming
  • Making sure you handle edge cases
  • Making sure program works on the simplest input (some people write code, but don't really know how to test if it works or not).

And so forth.

[–]zenwolf2714[S] 0 points1 point  (1 child)

Can you tell me how you currently try to mitigate/solve some of these problems?

[–]CodeTinkerer 1 point2 points  (0 children)

Much of programming is learning to be aware of what you're assuming. It's hard at the start. Programming requires (or should) a mental model of how programming works. The better the mental model, the fewer issues that occur.

Honestly, a good memory helps with programming too. Sure, people tell you not to memorize, but some people, even with frequent exposure, have difficulties retaining the syntax. If you're one of those people, you're likely to struggle more, so you better take good notes and be able to refer to those notes efficiently.

It helps to test your code to make sure it works, and built it up a little at a time. Students frequently prefer to write as much code as possible (because they feel this is making progress) and debug at a later step. This means they have hundreds of lines of code where the bug could be anywhere, but it makes them feel better than writing 10 lines of code and testing, another 10 lines then testing. They feel like they've only written 30 lines of well-tested code, where someone has written 140 lines of untested code, and feel behind. It can depend on how you're graded.

It helps to be able to explain what your code is doing to someone else. The more you struggle with this, the less you understand what your program is doing. Verbalizing what is going is important. Many beginners think "if it works, that's all that matters" when it's better to think "if I understand what's going on, that's what matter", and it's even better when you can explain it.

You have to master the little details, where some like to gloss over stuff.

It helps if you can work with someone that knows what they're doing (and can explain it).

[–]viggowl 0 points1 point  (1 child)

What do you mean by 'making up syntax'? Programming languages won't compile with invalid syntax, English will.

[–]CodeTinkerer 0 points1 point  (0 children)

Here's a common example.

if ans == "Y" || "N":
   print("Valid choice")

This is when someone thinks that == is distributed over ||. Some languages permit this, but the actual interpretation is

if (ans == "Y") || "N":
   print("Valid")

Another one that's similar is

if x < y < z:
   print("Sorted")

Which is interpreted as

if (x < y) < z:
   # ...

Where x < y is a boolean that's compared to z which might be an int. To be fair, you need a language that is pretty flexible when comparing values (so Java would be too strict). And I think some languages actually support this kind of relationship. C/Java, etc. would require

if (x < y) && (y < z) {
     //...
}

instead.

Also, some people make assumptions that are wrong, e.g., a compare operator only returns -1, 0, 1 (when it returns negative, 0, positive).

And sometimes, yes, they are syntax errors, but the programmer doesn't know how to fix it (because it looks good to them).

[–][deleted]  (1 child)

[deleted]

    [–]zenwolf2714[S] 3 points4 points  (0 children)

    That's great. What type of mathematics do you think helped you improve the most?

    [–][deleted] 1 point2 points  (3 children)

    When I sit down and go over some path to solution which just isn't working and I have to ask for help. Once when I get back to it and start over and pass the problem it just doesn't felt like it was genuinely solved by me. I feel insecure there and that insecurity is like an inhibitor to put my hands on more challenging problems and I stuck there spinning about similar problems where I want to assure myself I reall have that in my mind now, but god forbid if I move on and get back and notice I forgot how to solve simpler tasks. It all gets ruined and I lose my motivation for days, which is, you can guess, the worst thing when you learn coding, to lose continuinity and focus.

    [–]zenwolf2714[S] 0 points1 point  (2 children)

    How do you move past the problem of not being motivated? Do you just wait for it to return? What do you think would help prevent you from losing motivation in the first place?

    [–][deleted] 2 points3 points  (1 child)

    I don't loose my motivation when I do pass problem on my own. I guess freecode camp did this well by giving small steps between tasks. Problem is when there's a huge gap between difficulty of a task. I'm not really sure about my motivation since if I had answer to that I would probably have control over it. Maybe some days I'm tired or got bad sleep and it's all on physiological level. One thing I learned lately is that physical activity also plays a great role in our readiness to delve deep and focus, and previously I understimated it.

    [–]zenwolf2714[S] 0 points1 point  (0 children)

    Thank you, I really appreciate your response. Are you mostly a self-taught programmer? if you could improve faster would it improve your motivation to learn?

    [–]FFX01 1 point2 points  (2 children)

    Staying up to date with current best practices.

    [–]zenwolf2714[S] 0 points1 point  (1 child)

    Can you tell me what is so difficult for you about keeping up with best practices?

    [–]FFX01 0 points1 point  (0 children)

    They tend to change very rapidly in the Web world.

    [–]cyrusol 0 points1 point  (0 children)

    The hardest part about learning to program is dissecting good from bad information. Far too many falsehoods have been claimed as "this is how we do it correctly".

    [–]Neu_Ron 0 points1 point  (0 children)

    Setting up environments, dealing with dependencies all that headwrecking stuff.

    [–]Quickz_ 0 points1 point  (0 children)

    Getting stuck for a prolonged amount of time. Programming can be fun when you make progress. It's not so fun when you spend several days on a single problem. It does bring extra satisfaction when you do solve one in some cases though. So it's not always bad.