Living life by the motto, "You didn't get this far by giving up." It hasn't failed her yet.
When is copying code okay? When you know what you're doing with that code
If I want to put a picture carousel on my website, there is no way I am writing that CSS myself. I’m going to use a CSS library like https://getbootstrap.com/ or https://tailwindcss.com/ , and you should too—if you know what you’re doing.
But is that cheating? No, not really. When you get down to brass tacks, using a CSS library isn’t especially different from going back to an old project to re-use code you already wrote and know how to use. You’re saving time that you can devote to areas of your project that are unique.
The “and know how to use” is the key that elevates this from cheating to reusing existing code. CSS libraries like Bootstrap and Tailwind come with instructions for their use, and you both need to read them and need the foundational background it takes to understand what you’re reading.
Code at the click of a button... if you know how to use it
Would you use a chainsaw without reading the instructions first? You better, or you might forget to add bar and chain oil… or miss that a chainsaw is not the right tool for hammering in a nail. And before any of that, you need to know how to read the language the instructions are written in!
The same principle holds here: If I copy-paste an example snippet from Bootstrap’s website, then I need to know data-bs-target is referring to the id attribute of the enclosing div for the carousel. I need to know that an img source of “. . .” isn’t going to produce the image I want to see, I need to know where to put this code, and so much more.
So do yourself a favor and start using a CSS library if you aren’t already. But please, make sure to read the instructions first.
0 Comments