Understand Code but can't come up with it on my own?

Hi there!

So I’ve been learning to Code on fCC for a while now (1/2 to 2/3 through the Curriculum) and I’ve been supplementing it with several other sources (JavaScript30, WatchAndCode, fCC courses on Youtube).

However, I have one problem:
When it comes to code that is “on my level”, I understand it perfectly. I know what every line and function does, but when I try to build something “from scratch” (i.e. recreating something from a Tutorial), I cannot for the life of me come up with the right code and fail miserably.
Is this somehow normal or did I make a mistake somewhere in my learning curve? And: Do you guys have any tips on how to overcome this kind of problem?

Thanks! :slight_smile:

UPDATE about two weeks later:
In case anyone has the same problem and somehow finds this threat. I took @snowmonkey’s advice and sat down for a bit. I figured that I always learned fast from videos, so I thought it was time for a change. I bought a Udemy course about Javascript from Jonas Schmedtman (which was highly recommended) and gave it a shot. In his course, he has several exercises and after setting up my IDE and taking the approach that @snowmonkey suggested… oh my god, I was KILLING it! Coding the beginner challenges of his course, I somehow remembered and successfully applied fairly advanced stuff that I learned here on FCC and didn’t even think I remembered anymore. Fast forward a few days later, I coded a 300 line Web app WITHOUT any instructions or looking at the solution. IT FELT AMAZING! (Took me 2 full days but well… :smiley: )
Suddenly all the challenges I did here on FCC came together to one big blob of knowledge I thought I didn’t have and I am basically doing nothing besides Codewars, solving algorithms and building fun stuff in any spare minute I have. So in case anyone has the same problem:

  • Follow Snowmonkeys advice
  • Change the approach if you feel you’re stuck
  • Just start coding on your own and leave “Tutorial Hell”

So thanks again guys :slight_smile:

7 Likes

Hey there!

That does seem a little strange. Halfway through the curriculum but you can’t build your “own code”? That could mean one of three things:

  1. You struggle with learning the concepts w/o other source material

  2. You understand the concepts just fine on fCC, but don’t customize the projects / apply your learning enough.

  3. You aren’t consistent with learning/coding on FCC

Your issue sounds more like #2 and #3. Even if you “get” how to do the projects, coding takes practice and more practice. This is why many expert coders say reading code isn’t the same as doing code. Understanding code is the easy part. You have to work at it consistently, and continue doing challenges/ creating your own challenges along with the projects to ensure that you’ve mastered it. It’s the same principle as math. You could understand how calculus problems “work”, but you might not be able to sit down and actually work through a problem. It just means you have to work on your ability to do those types of challenges. Consistency and persistence is everything.

I recommend if you haven’t already, setting aside time everyday to work on FCC. Look back at the projects you’ve already done. If you had to start from scratch all over again, could you? You can test this, by forking a blank codepen and actually starting all over. You’ll be amazed by how much you’ve retained.

Hang in there and you’ll be much more confident in your ability in no time:)

3 Likes

It actually isn’t as strange as you’d like to believe. The problem is that of the artist faced with a blank canvas, who freezes up. She knows every brush stroke, she knows how to mix the paints, she knows the effects she wants… but to get from nothing to something can be terrifying.

So here’s what I do. Being an older coder, I come from the generation of pseudo-code. I sit down with a pad (yes. Step away from the computer), and I start building logic, as separate from language. There are formal pseudo-code structures, but that sort of defeats the point – I want to see, in my own way, the logic I intend to put out there.

So on your pad, start with where you want to end up. What is the goal, the challenge, the intent? Head the page with that. Then break it into main tasks, and break them into smaller tasks, until it gets to the point that it feels the tasks are small enough to be a couple lines of code.

If its a challenge like the javascript calculator (or anything that’ll be rendered), I draw pictures. They don’t have to be pretty. My stick people look like someone sort of sat on them. But I can understand them, and that’s what I need. So I’ll draw a box (the calculator itself), another box in it (the display), and buttons. Each of those bits need to be handled – so they become goals in themselves.

Walking through that, I’ll create a page for Display, and list all the things it needs to handle. Those become main tasks of Display, or (when we get there) functions of Display. Some of them may get complex, but for now just list them.

  • Update
  • Clear
  • … Actually, that’s pretty much it for display.

Then do the same for the buttons. Give them their own page, and list the tasks. Seems to me the only real task they have is handling a click.

So the calculator itself has a few tasks,

  • Reset
  • Listen to the buttons, and do stuff depending on which one
  • … Huh. Well crap. That’s it for the calculator. That’s really all it does.

But look at the calculator tasks. The first is pretty simple, but the second is gonna have a few sub-tasks, right?

That’s the process I use. I draw pictures, and I write myself “stories”. I walk through using the thing, and make sure I break it into the tiniest bits I can.

It seems to me, from what you say, that you’re sort of stuck on ‘big picture’. Getting down to the line-by-line is a challenge, but it takes practice and discipline. And being willing to trust that you know more than you think you do.

11 Likes

Being able to understand code is a different skill than being able to come up with programmatic solutions to problems. They are both important skills, but the latter takes much more work to build. What you are experiencing is extremely common. People look at explanations of code or solutions and feel like they’re learning - and they are, but they’re not learning how to arrive at a solution. Very often we help campers who become frustrated because they think that the best way for them to learn is to “reverse engineer” the solution, but when they come to challenges where no solution is provided or where they are really pushed to apply their problem-solving skills they are overwhelmed.

Struggling is part of the learning process. That’s where the growth is happening.

(Struggling is also part of the programming process. Because we are solving new problems on a regular basis, we are always facing the challenge of not knowing the solution.)

I can read a novel, understand it, critique it. I can see how the author is using narrative tools to pull their readers into the story. I cannot write a novel.
I can follow everything my partner says when they are talking about the research they are doing for their PhD dissertation in Mathematics. Everything makes sense when they’re talking about it. I couldn’t do it to save my life.

Being able to read code is very important. You will often find yourself reading uncommented code written by people whith a different style and mindset than your own. It doesn’t grant you code building skills though.

5 Likes

Thanks so much for your replies!
I think I’m gonna try @snowmonkey 's approach because that makes perfect sense. @ArielLeslie described my problem better than I described it myself: " they’re learning - and they are, but they’re not learning how to arrive at a solution." I think this might be the problem. I know concept X (and understand it) but I don’t really know when to apply it properly.
This showed a couple of hours ago when I tried to do a JavaScript30 challenge: At the beginning, I paused the video to try and come up with a solution myself: no chance. When I watched the Tutor do it, I understood every move he made and why he did it.

So I think snowmonkey’s approach might help me to improve. Will definitely try it! I’m the kind of person who’s kind of used to come up with a solution quickly, so I think I have to learn to take a break, sit down, take my time and break things into mini-challenges, structure them and solve them (semi-)seperately.
Thanks so much!

1 Like

Glad it worked out, my friend. Sometimes its just about changing the view.

1 Like