re: How did you get out of the habit of copying/pasting code? VIEW POST

FULL DISCUSSION
 

Copying a pattern isn't bad.

Just improve your typing skills by typing it all out manually again.

This will do two things I can think of right now.

First it gives you a chance to rename things appropriately, otherwise you tend to forget things and then the code doesn't make sense later.

Second, while you type it out you might think to yourself, gee, all I am changing is this or that, perhaps I could make a common view or function that both use and then you will have dryer code!

I think there are more benefits but these are the two that really stick out to me.

 

That does make sense. The reason why I thought copying is bad is because I have always thought that creating your own patterns and being able to code out solutions to existing problems are what defines a good developer.

But when you put it into those two perspectives, it does not sound bad at all. Rather, it contributes to the learning process.

Thanks for the input :D

 

Copying a good pattern isn't bad. I've been developing for over ten years and I still copy good patterns from others. Just make sure you understand what you are copying. Next time you'll be able to use that solution from memory! Or better yet, improve it for your specific need.

code of conduct - report abuse