I'm working on an authentification function for my project "ServerMonitor". My knowledge about such a topic is quite small, so I searched for a tutorial on YouTube to get it done.
Working through this tutorial helps me a lot but it feels wrong.
Everything I have programmed so far was a one to one copy of this tutorial which brings me to the following question.
Should you follow a tutorial about a specific topic and implement it into your project?
I mean, you get a lot done and learn something but it is not your own code.
Should you rather try to get through the documentation and try to solve everything on your own?
How do you deal with it?
Top comments (5)
Yes. Copy exactly if you need to or learn if you need deeper experience.
When iPhone apps launched I was copying 12 yr olds on YouTube to learn Xcode tips. Nothing to be ashamed of (the opposite, I'm impressed). Pretty much everything that exists came from people copying people.
If you can copy, then improve, value add or extend, that is usually better.
All the biggest sites in the world are copies of other sites, all the most famous art is copies of other art, same with design, development, product, anything really.
Try not to copy the wrong stuff though.
The truth is: The result matters. Does the thing do the thing it is supposed to do? How well does it do it compared to other things & how long did it take you? (if budget/time is critical, which is most of the time).
If you copy paste a site that improves a life, it still improves a life. The feelings should be invested in the result (impact) rather than the tool itself (it's nice to appreciate craftsmanship & all that of course).
Don't code airplanes like this.
Thanks for your comment. šš»
I got it.
Copying (if allowed) what you need and then expand as you need it is better than writing everything on your own because the result matters more.
You're welcome.
It's a bit like a Chef, you can get hung up on 13 course meals that the customer doesn't even like but a tiny bunch of snobs praise you for or you can deliver 10,000 meals a day to hungry workers but seem useless. It depends what you are looking for in terms of results or career too.
Example:
I do a combination of whatever is needed, I don't really think one is better than the other. For example, on my site I made my own share buttons because I don't want the privacy violations or slowness that all other options offer. I used the WP vanilla theme & customized instead of write one from scratch.
I work this way:
Result:
CSS customizable in-theme inline SVG share icons on posts that do not notify the service provider (twit/fb etc) of every visitor to the post (no embed, nice privacy for all) or slow things down (the fb btn is heavier than the sites I build). At the moment it has no share count (also solvable easily while private) but I am taking off social icons everywhere for the most part so I probably won't update it.
Effort? Slightly more than grabbing the regular code or using an existing plugin but I use it many times & it is much faster (paste into new theme & go, no updates, downloads, code inspection etc). Now it is a tool in my toolbox (they add up over time).
Good code changes a lot. Bad code doesn't. How likely is V1-2 to be good?
My advice is do it the way you think is right (but know why). That's how we got exactly where we are today.
I agree with what Vuild is saying here, but wanted to expand on one bit as well!
You said this in your post:
And it made me think about the difference between actually copying the code, and watching a tutorial and recreating the code. And I think there is a big difference between the two!
You probably could have gone to Github (or wherever) and found a completed project that already implemented the code you needed, and just copy and pasted it. And that probably would have got the job done.
BUT I think if you recreate the code in the tutorial, you are at least going through the physical act of writing the code and that helps you learn! Just cause it wasn't a completely original piece of code doesn't mean you didn't actually write it.
And I'll specifically say something about this question too!
It obviously depends on the problem and you're comfort in the area, but one big factor is what your goal in this project is. Are you interested in getting a working project done quickly and well? Is your goal to learn? Do you like building things from scratch and don't have a time constraint?
All these come into play when for instance I decide how I am going to approach a project, and especially a side project.
I'll give a little example! My currently deployed blog is written in a Ruby framework called Middleman, and it works pretty well! I have a custom CI/CD pipeline setup and I like it. BUT simply having a working project isn't really my main focus for my blog. It's also a place for me to play around and learn new things! So I recently decided to rewrite the guts of the thing using Gatsby! I'm gonna get a few nice 'user' facing benefits out of it like better offline support, but that wasn't really what motivated my decision. I wanted to learn Gatsby and that was more important that the project I actually shipped. And also, since I already have an existing blog I have no time pressure to finish the rewrite. All that boiled down to deciding to completely rewrite the project in Gatsby. I'm gonna take my time and do it how I want to do it, (copying liberally from online resources and projects š) and learn a lot along the way.
Thank you for your comment!š
It really makes a difference if I simply copy and paste an existing code or working through a tutorial, despite it was exactly the same.
The result is what matters and if I work on this part of the code in the future, I will surely extend it on my own.