Does rewriting code from Stack Overflow help learn?

Based on the Learning - Wikipedia definition, it helps you to learn for sure. And this is one of the main purposes of the Stack Overflow - Where Developers Learn, Share, & Build Careers.

But at least you should check the code first, before use it in your application. For me “rewriting” means to check deeper the code instead of just copy/paste it. And when you do this kind of check, you get new skills, knowledge and understanding about a specific problem or topic.

Apart of that, you can learn and improve how to follow the KISS principle - Wikipedia. For me it happen very often to spend a hours of

Based on the Learning - Wikipedia definition, it helps you to learn for sure. And this is one of the main purposes of the Stack Overflow - Where Developers Learn, Share, & Build Careers.

But at least you should check the code first, before use it in your application. For me “rewriting” means to check deeper the code instead of just copy/paste it. And when you do this kind of check, you get new skills, knowledge and understanding about a specific problem or topic.

Apart of that, you can learn and improve how to follow the KISS principle - Wikipedia. For me it happen very often to spend a hours of solving a dev problem, and then I find very simple solution on such a learning resources as Stack Overflow. You can compare your solution with the others and think about what to improve next time to save some time.

Also, you can learn how to connect two or more solutions and extend them with your solution. This is a good way to share the knowledge you have discovered, with the community.

Blind cut and paste of code snippets from SO is very poor practice.

The very least you should do is refactor and adapt the code to your own or your team’s standards and the requirements of the project. This should allow you to understand what the code is doing, verify that it really does what you need, and potentially spot any omissions.

One could regard this as “rewriting code from SO” and it most certainly helps you to learn - but I’d say only if you are doing it for a meaningful project of some sort.

All things that require to code will help you with learning coding. Rewriting Stackoverflow code may not be the fastest way to lear to code but it sure is a way to learn it.

If you are interested in learning it over Youtube I have a course for absolute beginners here is my newest video: