Relying on other people's code

Hi Zed,

I feel like I am learning and understanding more and more programming when I am typing in code from programming books and reading the theory behind it as well; however, it seems like I am unable to come up with solutions myself, which really demotivates me. For example, I google for some programming problem and then attempt to solve it, but my mind goes totally blank and it ends up with me finding a solution someone else has made and this makes me think that I will never be a “real” programmer and that I always will have to rely on other people’s code. Even when I’m typing this I sense that it sounds really dramatic, but I still can’t let go of that feeling and it doesn’t get better when I see other people being able to creatively make up their own solutions. Do you have any tips?

Yes, translate. I still do this when I’m stuck on what to write, and it’s similar to a technique that you might have used with writing an essay.

Were you ever taught the technique of writing the outline of an essay, then writing the headings, then the first sentence of the main paragraphs, then filling it in with the rest of the text?

You can do the same thing with code like this:

  1. Write up or draw your idea using plain old English in your code file.
  2. Turn that raw description into a sequence of steps in English. Think about how you would try to tell someone else to do this.
  3. Turn that sequence into a series of comments.
  4. Turn the comments into pseudo-code, which is english text that can’t actually run but looks like code.
  5. Turn the pseudo-code into code, and run it repeatedly as you do that. Every 1-2 lines of code you write should be run to confirm it’s working.

All I’m doing when you see me “naturally” crank out code is this 5 step process but my brain has been so well trained that it happens super fast and you don’t realize it. When I get stuck, I really do this process (although I skip the p-code part since I can just write the code).

Another trick is to focus on what the end result looks/works like–faking it entirely–and then work backwards from there. Once you have a user interface worked out it’s a lot easier to work toward that goal than to attempt to visualize it out of your brain.

2 Likes

Yes, I have heard about that technique for writing essays before, but haven’t really thought about applying the same principle to coding. Thank you so much for your response and I will definitely try this out!

@Noice20. I still experience the same thing. What has worked for me is to approach the problem with confidence that I can solve it. I like @zedshaw’s recommendations but I would also recommend coding the parts that you do know. Think of it like the word problems we all had to solve in grade school. I would start with simple print statements and go from there.

1 Like

@vacowboy Thank you for your tips as well! Yeah, I agree, I think we can get overwhelmed by all the facts we don’t know and thereby lose confidence in what we actually can solve. I also think the comparison with others can be unfair because we may be in the beginning of our programming journey (or at last haven’t programmed as much as someone who has done it for a decade, for example), so when we see them being fast and creative it is also because they have much more experience under their belt and thus it isn’t really a rightful comparison.

@Noice20. You make a good point when comparing ourselves to others. The blessing is that there are people in the community who reach back and help others. Feel free to reach out to me anytime you need.

1 Like
A free service run by Zed A. Shaw for learncodethehardway.org.