A different take on 'don't look at the answer' advice

Hi all:

I’ve come across the ‘’do not look at the answer” advise a couple of times. I agree and disagree with it. Here’s why:

I’ve gotten stuck on some problems for a while. I searched the net for clues, took a look at past exercises, etc., but just hit a wall. So, I looked the answer up and did the following: pasted it on VSC or wrote it down on a piece of paper to understand how it worked, then analyzed my though process to see what went amiss. In my case, I understood that 1) I was overcomplicating 2) the logic was good 3) the syntax was poor. Now I had a plan of attack. I started with pseudo-code (thanks to the FCC folk for the tip), laid down the logic and assessed the syntax. I am also basically copying almost everything and pasting it on VSC so I have a code repository to refer to when trying to figure something out.

Now I find myself looking less and less at the answers, and if I need to I take quick glance at the first two or three lines of code to see if I am on or off the mark.

So, I think if you’re 110% stuck it’s cool to look at the answer, but you have to do the work to improve.

What are your thoughts?

2 Likes

I mostly disagree. Looking up and copying answers should be avoided.

Looking up specific fixes to a specific issue you are having is an important skill.

Designing a solution to a complex problem is an important skill.

Copy-pasting solutions to challenges, exercises, or projects builds nether of those skills.

You are better off asking questions and talking to people on the forum. Talking to other developers is an important skill and we can help guide you so that your solution is 95% your code and 100% your effort instead of being 100% someone else’s work and code.

2 Likes

Thanks for the reply. I’m fairly new to programming, thus ignorant. For example, I complete an exercise on Understand String Immutability and copy the code so I can look at it if I don’t remember the syntax, is that thought as using someone’s work? With regard to looking up the answer, I saw a video on YouTube by a guy called Aaron Jack, and he said it’s okay to do it if you’re completely stuck. I was reading a FCC blog on pseudo-code and this video is embedded in it.

I’m definitely going to start communicating more with other devs. That is a weakness of mine.

I agree with what Jeremy has said.

If you do end up looking up an answer (whether an FCC answer or some other source that have a solution to the algorithm or whatever) then I would advise coming back and trying to do it from memory a week later to prove that you understand it.

But I agree with Jeremey - you will learn a lot more by struggling through it and researching things. It will be frustrating, but it will develop important skills. I’d rather you come up with your own clunky solution than google someone’s sleek solution. After you have your own solution, then looking up other solutions for comparison can be a great exercise. But don’t rob yourself of coming up with your own solution.

And remember that some of these things are hard. A lot of people struggle with the algorithms, for example. That is normal. You’re supposed to struggle. It is what will happen on a lot of interviews and you won’t be able to cut and paste a solution then. They will want to see how you struggle and how you try to solve it. I even had an interview with an algorithm that he later told me no one had ever solved in the time given. He wanted to see how people dealt with that and how they attacked the problem. These are important skills.

2 Likes

Reading code can teach you a lot but it doesn’t directly exercise your problem-solving muscles. The process itself is more important than the outcome. By doing it often enough you will train parts of your brain to think about the problem-solving process.

Looking at solutions, or just code in general builds a different kind of knowledge. I definitely think you should be reading code and that it’s an important part of learning, it just won’t take you through the same process as solving a problem does.

If you can take code ideas and apply them to a different problem then you might see the benefit of both.

2 Likes

Hi Kevin:

You’re right. I remember when I finished an exercise last year and then posted it online. It was very clunky and a dev helped me smooth out the edges.

I thought about this and the technique I applied and delineated here is a double-edge sword. It was devised to use metacognition. I could tell that something was off regarding my thinking when I was trying to solve the problems, but I could not put my finger on it. So, I understood that I was leading myself astray. I was able to notice that my syntax was bad, as well. However, you end up seeing the answer and there’s no going back, and, like you wrote, one doesn’t get to do the necessary work.

Thanks for the constructive feedback, Kevin and lasjorg.

In my first reply, I addressed two points from my first post: the code that I paste on VSC is to look at syntax (akin to looking at a MDN page and I understand that that was not clear) and the reason as to why I though okay and beneficial to look at the answer of a problem. JeremyLT inferred that I’m copying and pasting 100% of other people’s work and using it as my own, which is untrue. That was uncalled for, and I don’t take that lightly.

I think you are missing my point. Copying out by typing instead of copy-pasting still doesn’t fix the fundamental problem with the approach - namely you aren’t the one who is designing the solution. Reading through someone else’s code is an important skill, but it is different than designing solutions of your own. The hard part of programming is designing solutions, not writing out syntax. The bulk of the effort is in designing the solution. If you aren’t practicing designing the solutions yourself, you’re hurting your learning.

2 Likes

I’m almost done with the Basic JS section. I’ve actually redone from scratch problems whose answers I could not remember and that was very beneficial.

Since I cannot go back in time, and I need to improve my problem-solving skills, what should I do next? Is CodeWars or something similar a good idea?

I think a good gague of your abilities is to see if you can do the advanced algorithms and the projects for the Javascript certification without looking up solutions.

i dont have the restrictions to not look in the answers, if you are stuck, but definitely do it, only when you are unable to come with a solution on your own and also(which it seems you do), do not copy/paste mechanically whats provided, but also make sure you understand it(to the best of your ability) and preferebly, try to write it on your own. Maybe, get the idea, the hint behind the solution and try to solve the challenge then. Also, even if you solve a challenge without using the ready made solution, its good practice to check and see the “cleaner” solutions, which also provide additional ways of solving the same thing. Overall, the main purpose of this whole thing is to learn to come up with logic and solving issues on your own, but also learn the mechanic and topic of the particular lesson; the way you manage to achieve those feats i dont think is of importance, or at least, i wouldnt stick to a honorable way of learning the material, as long as you really learn and progress, which is of the essence here.

This part I agree with. Looking up solutions is a great idea after you’ve successfully designed a solution. Before you have working code - that is when it’s time to ask questions on the forum.

2 Likes

Hello: Once again, thanks to everyone. I’ll wait a bit and redo the main exercises from the Basic JS section; I’ll start doing the projects for the JS certification; and start working with others in forums like this one or Stack Overflow. (And, of course, refrain from looking at the answer.)

Isn’t that why the answer is there?

Dunno, I always use the philosophie, that if I get stuck and don’t know what to do, I look at the answer. I read it, try to understand it and then do the task again with the answer in mind, but without having memorized it.
If I get stuck again, I look at the answer again and try to figure out what’s different.

Did that on Leetcode and this helped me understand how to use dictionaries and sets to speed up processes, linked-lists, binary-trees and how to deal with them in both a recursive and non-recursive way.

You should avoid looking at the answer, because you gotta think first. However in terms of a learning expirience AND even success, looking at the answer AFTER YOU TRIED is a decent strategy.

3 Likes

I’d suggest this isn’t a good idea. Do what @JeremyLT says and do the algorithms. That’s what they’re there for. There is no set way of doing them, they are a test of solving small, self-contained problems, and you can redo them over and over trying different techniques.

You can keep redoing the basic JS, but you’ve gone through it once and any returns from redoing it are likely to be extremely slim. It isn’t going to be any kind of challenge (for it to be a challenge you would have had to forget all your basic JS). And without challenge it’s pointless, you aren’t going to be learning. Algorithms + projects + help here + learning to use the documentation is going to far more useful

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.