So to be 100% confident that my solution is the one I want, there’s one more thing I need to do. That could be either because I’m using a new method, or that the copied code is too clever for me. If I cannot tell the difference between code that I trust, and code that I write myself, it usually means I don’t fully understand how it works. Because I now know that it probably won’t. If I don’t know the what and the how, I prefer to write my own solution from scratch than to trust that the code is going to work. But only when I fully understand what it does and how it does it. It’s a lot better to find the right solution that fits your current context than to find a quick solution.Įven though I still go to StackOverflow, I now do it to look for ideas.Īnd if I find a good one, I might copy it and adapt it to my needs. It turns out trust is not the best way to judge code quality. Even if that solution was perfect for a different context, it was not perfect for me. And it probably was, in the right context.īut the context I was in did not fit perfectly with the solution I’ve copied. I used to think that if others have already reviewed it, it has to be great. The code that was usually causing those bugs was the code that I have been blindly copy/pasting from StackOverflow.Īnd the keyword there is blindly. Obviously, I was the one fixing those bugs, so I discovered something interesting in the process. So, where were those bugs coming from anyway? I didn’t know what I was doing So it seemed that if I added up all that time spent fixing bugs, I wasn’t getting that much of a speed bump, nor was I looking like the smartest person in the room anymore. Even though I was writing a lot of code a lot faster, I had to go back and fix bugs a few times before I could release a new feature. Speed alone doesn’t help muchĪs I mentioned before, my code started to break in unexpected places. Well, if that was all there was to it, it would make a lot of sense to continue doing it. The value of speedįor some reason I cannot seem to remember now, I used to think that if I built my code fast enough, I would make my managers happy, and also look like the smartest person in the room. While if I come up with your own, I might not be so sure that it’s the best way I can solve the problem. It’s highly likely that there’s a better solution out there than the one I can come up with in just a few minutes.Īlso, the one that’s out there has the advantage of being vetted by the community. The reasoning behind copy/pasting code was “there should probably be a better solution out there than the one I could come up with, and it’s going to be faster to just copy/paste that instead of doing my own thinking”.Īnd I’m not saying there’s anything wrong with that. My code started breaking in unexpected places. Whenever I needed a quick solution to a problem, I used to jump on Google, hit the first link that seemed to solve my problem (and that was usually a link from StackOverflow), then check out the most voted answers, and then copy/paste code from the answer that seemed to be the best one out of the two or three most voted variants.Īnd it worked great for a while.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |