Reusable Code

When OOP was first becoming a big deal and especially when C++ was becoming popular, there was alot of talk about how things like encapsulation would enable more reuse of software. People wanted software to consist of components that you hooked together like when building computer hardware. The term “Software IC” became popular but not many general purpose libraries emerged. We didn’t see the huge revolution in the way software was going to be made that some people predicted.
I think the reason for this is that encapsulation really does very little to encourage sharing. What it allows is for the API to be re-implemented without breaking all the users. A noble cause to be sure but the fact is you get more users by having the right API and designing a good API is still hard. Inheritance can help some in this regard but again the hard problem is still coming up with a good design.
There is alot of code reuse today but its not because of OOP – its because of OSS. In the old days the Software IC idea was really about closed source immutable blocks of code that would be sold. Certaintly there are companies making money on this today, but its mostly in very specialized enviroments. The vast majority of code sharing (and the resulting cost reduction) is made possible by the Open Source movement. While the fact that the code is usually free (as in Beer) makes it more possible, the code being open and free (as in speech) is what makes it truely viable in commerical applications. In many cases the price of the code you want to license is less of a barrier than the fear that when you get it you will run into issues you can’t fix because you don’t have the source.

I don’t think there has ever been a time when I have used a 3rd party closed source library that I didn’t get burned in some way. At this point I will only do it when there is really no other choice and then usually only if I can write the code in such a way that I could replace it later.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *