Code Reuse: a Blessing or a Burden?

In the world of development, coders are constantly faced with the problem of creating efficient code under a very tight deadline. The idea of Code Reuse, simply the use of code created by another developer, has been a staple concept in the world of programming since the start of development. Whether it is an open-source library or code written by a stranger on a frequently-visited forum, every developer has utilized code reuse at one point. Code reuse definitely has its place in development, but should we rely so heavily on this model?

The first thing you need to think about before using someone else’s code is, “Do I have the right to use this code?” It’s becoming commonplace to see a lawsuit based on one company stealing code or concepts from another. But, beyond the legal reasons against using other’s proprietary code, there are also the ethical obligations that everyone should consider for leaving this code alone. No developer wants their own work to be stolen, so it’s also their responsibility to not steal code that doesn’t belong to them.

Not all code is proprietary though. There are entire communities that revolve around open-source libraries, made to benefit everyone. Here at Algonquin Studios, we have a monthly meeting during which all of the developers get together and talk about the technology they either are working on or want to work on. Our last meeting was based around third-party solutions and not “reinventing the wheel.” If there are solutions to your problem already in existence, why should you waste the time of your employers and clients?

I agree with the idea that if a proper solution exists, there is no reason to recode the solution. The fine line lies with the word “proper”  though. Too many times, I’ve seen a complex solution to a problem be reused in many places it shouldn’t. Usually the solution gets a “band aid” so that it works within the scope of the new problem but this just evolves as more closely-related problems emerge and eventually the coder ends up with inefficient code that barely solves the problem. The world of development has  begun to rely on third-party libraries and frameworks and other people’s code so much that they sometimes have no original code in their project and there needs to be a happy medium between quality and speed of development. Sometimes it’s worth it to rewrite an entire procedure that isn’t quite getting the job done. Sometimes you have a completely unique problem that someone else just hasn’t encountered before.

I still go back the “don’t reinvent the wheel” idea. If you can use other code that’s available and satisfies the problem in an efficient manner, then it’s a good solution. We all need to realize, though, that wheels come in different sizes and shapes. You wouldn’t want to put a hamster wheel on your car, nor would you want tractor wheel in your amusement park instead of a Ferris wheel. In the end, code reuse is a blessing to developers. Being able to create rich software at a fraction of the time spent is a very powerful tool. The developer just needs to learn when it is appropriate to reuse code, and when they should develop a solution specific to their problem.

Advertisements

One thought on “Code Reuse: a Blessing or a Burden?

  1. Agreed. Also, if you’re going to copy and paste some code, don’t just modify it until it works and move on to your next issue. When you’re tasked with writing something, you should understand it in it’s entirety. If you don’t understand what you’re implementing, you probably shouldn’t be doing it. All it takes is digging in. Sometimes you can take the rims out of the wheel and put some racing tires on. Good post, food for thought.

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s