Good coders borrow, great coders steal

THURSDAY, JUNE 11, 2020    

Have you encountered situations when you are stuck in your solution implementation? How do you convert a number into roman numerals? Technically that is Leetcode question that you can try out and test yourself here.


If you are faced with a problem in your code, there is a high chance that someone else had probably faced it before and even solved it with an optimal solution as well. Why not use that code as a reference? Do not go about reinventing the wheel. But when you refer, seek to understand and you can be more efficient. What then should we look out for when we copy code?


Good artists borrow, great artists steal. - Picasso




In development work, there are many principles one may seek to follow for example 12 factor application, SOLID principles, one of them is: don’t repeat yourself. This seeks to ensure reusability of code. Write once and executed a million times. This works in the same fashion when we are able to reference outsource libraries. Copying code itself isn’t always a bad thing. Code reuse can promote efficiency in software development. But when the developers use example code without trying to understand the implications of it, that’s when problems can arise.


Depending on who you ask, code that are shipped to production constitute approximately 7-23%. We want to work smart, not hard. If the solution is there, use it, but use it smartly.


When we try to borrow code, we are essentially just taking people’s code whole sale and just utilizing it as it is. The ownership of code is still theirs, along with all its implementation and security flaws. If you take code wholesale and put them into your code, i understand there are regulations and policies regarding accreditation. So take note of that!


When we mention steal, even though there is a negative connotation to it, we actually just mean to take a good work, understand it and weave it into your own work. In a simpler way to put this:


You don’t have to reinvent the wheel but you have to make the wheel fit your car. And it has to fit securely and safely.


Even giants such as Apple became successful under Steve Jobs because they stole, incorporated, and refined - they made it their own.




TLDR;


In summary, anything done incautiously often worsen our situations rather than to improve them. In the same way, in development work. whenever we reference an existing solution to a problem. Always seek to understand its implementation. Understand the concept that may be used and not only are you able to be more efficient in your projects, you are able to prevent introducing more security risks hidden plainly in the code snippet that was copied.


I’ve found a video that has spoken about this topic, do check it out!





Reference:
Copy code and risk spreading security vulnerabilities
Don’t get busted copying code
Great coders steal