Is it better to strictly follow coding guides or explore alternative solutions to enhance learning and problem-solving skills?"

So I started Codecademy a month ago, and so far it’s been really great, but I’ve come across a bit of a dilemma. In codecademy projects, you are to follow a guide video in case you are stuck, and in most cases, I follow the guide whether i am unstuck or not. However, some times my codes don’t run properly even after following the videos, and it leaves me very confused, so i try to disregard the videos and tutorials and complete the projects in my own way: and sometimes i alter big parts of the code (but it works after i do it my own way).

So the question is are you supposed to write the code the way others and the instructor want you to write it, or is it okay to find different ways to write the code?

What’s important is getting a good sense of the fundamentals of what you’re code is doing, for what purpose, and in what context. There is often not a right way to write code. Even in places where some solutions are optimal, sometimes the maintainability of the code is better for a subobtimal-performance solution that is good enough for the context.

In terms of learning I find it’s often fruitful to be proactive. Read the description of the problem, try to code the solution, use documentation as the resource. If you get stuck on a sub-problem, google the most high-level approach to your sub-problem (as in, not the code itself but the strategy). Then afterwards when analyzing your own solution you can compare with others and learn from those, and maybe even appreciate/critique more the nuances of the differences you find.


To supplement @toastedpitabread’s excellent advice, I would add that as far as the lessons go, they’re structured to accept one answer. (Which is why if you write the code differently, but still arrive at the same answer they’re looking for, it will be “wrong”). That said, it’s a great idea to take the lessons and write the code in a code editor of your choice to explore different ways to write it. Is there a “best” way to write a piece of code? Well, that’s subjective.


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