Printed 2017/08/23 04:01PM

Use Patterns and Prior Code and Don't Reinvent the Wheel


In recent days I've seen folks try to recreate functionality when they had access to code that already did effectively the same thing they needed done. In some cases other folks were able to convince them to look at the code they had in their hip pocket and in other cases they weren't. Usually the issue came down to what I've called (and heard called) "wasn't written here syndrome." Because the code was written by someone else, it immediately is distrusted. Now I remember being of that mindset when I was a young programmer, but as I've gotten older and wiser, I've come to understand that if someone else has already solved the problem, and solved it well, there is no real reason for me to try and find another solution. Thank you, Dr. Kanat Durgun, for teaching me that lesson through mathematics.

Some might say, "But you're giving up your creativity!" No, I'm not. If I can re-use code to solve the problems I must solve as part of my job, I have more time available to develop solutions to problems I'm really interested in. In other words, I give a greater outlet for my creativity because I get to work on the things I want to work on. It also means my life is less stressful because the quicker I can solve the problem, the sooner I get out of the critical path of a project or I get out of the glaring spotlight that is cast whenever a production system/process goes down or is impaired due to a bug. Less stress means healthier me. Healthier me means a better ability to work on the things I find interesting. In other words, if I can re-use existing, decently written code, I help myself out. So why wouldn't I do this? Yet I see folks hitting this wall all the time. I don't know whether it's pride (this was my problem early on), ignorance, or a desire to look busy or some combination of the three. But I can always find things to do with my time that benefits me and my organization.

That's why you see architect types talking about design patterns like Microsoft's Enterprise Library. It's why you see folks like Andy Leonard (twitter | blog) preaching about design patterns in SSIS. It's why you see people working on benchmarks at the Center for Internet Security. And it's why you have folks working on things like the Open Web Application Security Project (OWASP). These are time savers and they reduce risk. Why do they reduce risk? Because they've been field tested. Because they are somewhat built for us. Because they've been at least partially debugged. New code is none of these things.

So if you are faced with a problem you think someone has already solved, do a bit of research. If you find that they have, and you like the solution, see about using it to solve the problem that is before you. Obviously honor all licenses and intellectual property rights, And then spend that time you saved on something you really want to do!

Copyright © 2002-2017 Redgate. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.